public PlayerAbilities(Dictionary <AbilityType, Ability> _attributes) { this.Agility = _attributes[AbilityType.AGILITY]; this.Attack = _attributes[AbilityType.ATTACK]; this.Health = (HealthAbility)_attributes[AbilityType.HEALTH]; this.Defense = _attributes[AbilityType.DEFENSE]; }
private void HitResult(Collision2D collision) { HealthAbility health = hitObject.GetComponent <HealthAbility>(); health?.DoDamage(Damage); ShowEffects(collision); OnDamage(); }
public PlayerAbilities( int agility, int attack, int health, int defense) { this.Attack = new Ability(attack); this.Agility = new Ability(agility); this.Health = new HealthAbility(health); this.Defense = new Ability(defense); }
public void Execute() { HealthAbility healthAbility = (HealthAbility)target.getAbility(typeof(HealthAbility)); if (healthAbility == null) { Debug.Log("Don't have HealthAbility"); return; } healthAbility.health--; healthAbility.health = Mathf.Max(0, healthAbility.health); }
protected void Awake() { health = GetComponent <HealthAbility>(); damageOnCollision = GetComponent <DoDamageOnCollision>(); }