Skip to content
Snippets Groups Projects
Commit 68d76037 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Created a second attack that is slower but hits harder.

parent fabae040
No related branches found
No related tags found
1 merge request!26Added second attack to player for testing.
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using BigSock.Service;
namespace BigSock {
/*
Basic projectile attack for the player..
*/
public class BiggerSlowerProjectile : BaseAttack {
//protected static readonly GameObject PROJECTILE_BASE = new AttackMovement();
public const string PROJECTILE_NAME = "bullets/bigslowbullet";
public override ulong Id => 102;
public override string Name => "Big Ball";
public override string Description => "It's big and slow, but it packs a punch.";
public BiggerSlowerProjectile() {
AttackStats = new AttackStats{
Damage = 4f,
Knockback = 5f,
Range = 5f,
ProjectileSpeed = 3f,
AttackSpeed = 1f,
};
Cooldown = new TimeSpan(0, 0, 0, 2, 0);
}
/*
Activates the ability.
Returns true if the ability was successfully activated.
- Even if nothing was hit, used to indicate that cooldowns should be updated.
This should be overridden in sub-classes for the actual abilities.
*/
protected override bool Activate(Character actor, Vector3? target) {
if(target == null) return false;
var attack = (AttackStats) AttackStats.Apply(actor.Stats);
attack.Actor = actor;
var temp = (target.Value - actor.transform.position);
temp.z = 0;
var bullet = PrefabService.SINGLETON.Instance(PROJECTILE_NAME, actor.transform.position);
var bulletScript = bullet.GetComponent<AttackMovement>();
//bulletScript.Actor = actor;
bulletScript.Stats = attack;
bulletScript.Direction = temp.normalized;
//MonoBehaviour.Instantiate(PROJECTILE_BASE, (Vector3) actor.transform.position, PROJECTILE_BASE.transform.rotation);
return true;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c80b74b32e3dc7745a400cec3fae0641
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment