Пример #1
0
        public void DoAttack(BattleCharacter attacker, BattleCharacter target)
        {
            Ability attack = Instantiate <Ability>(attackAnimation, attacker.transform.position, Quaternion.identity);

            attack.SetTargetPosition(target.transform.position);

            tooltip.GenerateAutoDismissTooltip(string.Format("{0} attacked {1}!", attacker.characterName, target.characterName));
            target.Hurt(attacker.attackPower, "attack");
            if (IsCharacterAPlayer(attacker))
            {
                PlaySound("playerAttack");
            }
            else
            {
                PlaySound("enemyAttack");
            }
        }
        public bool UseAbility(Ability ability, BattleCharacter targetCharacter)
        {
            bool successful = energyPoints >= ability.energyCost;

            BattleController.Instance.GetTooltip().GenerateAutoDismissTooltip(string.Format("{0} used {1} on {2}!", characterName, ability.abilityName, targetCharacter.characterName));
            if (successful)
            {
                Ability abilityToCast = Instantiate <Ability>(ability, transform.position, Quaternion.identity);
                energyPoints -= ability.energyCost;
                int powerToAdd = 0;
                if (upgradePointsDictionary.ContainsKey(abilityToCast.abilityName))
                {
                    powerToAdd = upgradePointsDictionary[abilityToCast.abilityName];
                }
                int power = ability.power + powerToAdd;
                abilityToCast.Cast(this, targetCharacter, power);
            }
            return(successful);
        }
Пример #3
0
 public void SetCurrentTarget(BattleCharacter target)
 {
     currentTarget = target;
 }
Пример #4
0
 public bool DoesPlayerAlreadyHaveAbility(BattleCharacter player, string abilityName)
 {
     return(player.GetAbilities().Contains(characterController.GetAbility(abilityName)));
 }
Пример #5
0
        public BattleCharacter GetCurrentCharacter()
        {
            BattleCharacter character = characters[actTurn][characterTurnIndex];

            return(character);
        }
Пример #6
0
 public bool IsCharacterAPlayer(BattleCharacter character)
 {
     return(GetListOfAlivePlayers().Contains(character));
 }
Пример #7
0
 public bool IsValidEnergyHealTarget(BattleCharacter target)
 {
     return(IsCharacterAPlayer(target) && target.IsCharacterMissingEnergy());
 }
Пример #8
0
 public bool IsValidHealTarget(BattleCharacter target)
 {
     return(IsCharacterAPlayer(target) && target.IsCharacterDamaged());
 }
Пример #9
0
 private void PerformAttack(BattleCharacter target)
 {
     BattleController.Instance.SetCurrentTarget(target);
     BattleController.Instance.DoAttack(this, target);
 }
        public BattleCharacter Spawn(BattleCharacter character)
        {
            BattleCharacter characterToSpawn = Instantiate <BattleCharacter>(character, this.transform);

            return(characterToSpawn);
        }