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

Implemented new system for attacks.

parent 82653d92
No related branches found
No related tags found
1 merge request!25Ability rework.
......@@ -16,17 +16,19 @@ namespace BigSock {
//protected static readonly GameObject PROJECTILE_BASE = new AttackMovement();
public const string PROJECTILE_NAME = "attack";
/*
The attack stats of the ability.
*/
public IAttackStats AttackStats { get; set; }
public override ulong Id => 101;
public override string Name => "Basic Player Projectile Attack";
public override string Description => "A basic projectile shooting attack the player has.";
public BasicProjectile1() {
Name = "Basic Player Projectile Attack";
Id = 101;
Description = "A basic projectile shooting attack the player has.";
AttackStats = new AttackStats{
Damage = 1f,
Knockback = 1f,
Range = 10f,
ProjectileSpeed = 10f,
AttackSpeed = 1f,
};
}
......@@ -38,8 +40,21 @@ namespace BigSock {
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);
bullet.GetComponent<AttackMovement>().Actor = actor;
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;
......
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