예제 #1
0
    public int Attack(BattlerType t, iBattleable target)
    {
        int totalDamage = 0;

        if (t == BattlerType.Instigator)
        {
            totalDamage = _instigatorBattlers.Sum(x => x.GetStrength());
            Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound());
        }
        else
        {
            totalDamage = _oppositionBattler.GetStrength();
            Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound());
        }
        target.ReduceHP(totalDamage);
        OnBattleAbleTakeDamage(target, totalDamage);
        OnBattleAbleUpdate(target);

        if (target.IsKO())
        {
            Audio.AudioInstance.PlaySFX(target.GetDeathSound());
        }
        else
        {
            Audio.AudioInstance.PlaySFX(target.GetHitSound());
        }

        Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage.");
        Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage() * 100 + "%)");
        return(totalDamage);
    }
예제 #2
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
     if (_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID()))
     {
         _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage();
     }
 }
예제 #3
0
	public int Attack(BattlerType t, iBattleable target) {
		int totalDamage = 0;
		if (t == BattlerType.Instigator) {
			totalDamage = _instigatorBattlers.Sum(x => x.GetStrength());
			Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound());
		}
		else {
			totalDamage = _oppositionBattler.GetStrength();
			Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound());
		}
		target.ReduceHP(totalDamage);
		OnBattleAbleTakeDamage (target, totalDamage);
		OnBattleAbleUpdate (target);

		if (target.IsKO()) {
			Audio.AudioInstance.PlaySFX(target.GetDeathSound());
		} else {
			Audio.AudioInstance.PlaySFX(target.GetHitSound());
		}

		Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage.");
		Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage()*100 + "%)");
		return totalDamage;
	}
예제 #4
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
     if(_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID()))
         _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage();
 }