Example #1
0
 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];
 }
Example #2
0
    private void HitResult(Collision2D collision)
    {
        HealthAbility health = hitObject.GetComponent <HealthAbility>();

        health?.DoDamage(Damage);
        ShowEffects(collision);
        OnDamage();
    }
Example #3
0
 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);
 }
Example #4
0
    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);
    }
Example #5
0
 protected void Awake()
 {
     health            = GetComponent <HealthAbility>();
     damageOnCollision = GetComponent <DoDamageOnCollision>();
 }