Example #1
0
 public DTCharacter(int baseHP, EnCharacterType type)
 {
     BaseHP    = baseHP;
     Type      = type;
     CurrentHP = baseHP;
     lastHP    = CurrentHP;
 }
Example #2
0
    void CheckCharacterAction()
    {
        // Check and setup Action
        List <Character> characterHadActions = new List <Character>();

        DefensorTotalHP  = 0;
        AttackterTotalHP = 0;

        foreach (var c in attackers)
        {
            Character closestDefensor = FindClosestDefensor(c);
            c.UpdateClosestEnemy(closestDefensor);
            bool isHadAction = c.CheckAction();
            if (isHadAction)
            {
                characterHadActions.Add(c);
            }
            AttackterTotalHP += c.Data.CurrentHP;
        }
        foreach (var c in defensors)
        {
            bool isHadAction = c.CheckAction();
            if (isHadAction)
            {
                characterHadActions.Add(c);
            }
            DefensorTotalHP += c.Data.CurrentHP;
        }

        foreach (var c in characterHadActions)
        {
            c.DoAction();
        }

        if (!isEndGame)
        {
            isEndGame = defensors.Count == 0 || attackers.Count == 0;
            if (isEndGame)
            {
                EnCharacterType winner = defensors.Count > 0 ? EnCharacterType.Defensor : EnCharacterType.Attacker;
                battleUI.ShowResult(winner);
                miniMap.gameObject.SetActive(false);
            }
        }
    }
Example #3
0
 public void ShowResult(EnCharacterType winner)
 {
     result.Show(winner, OnReplayAction, OnBackToMenuAction);
 }