public void SetType(Character.CharacterType type)
 {
     if (type == Character.CharacterType.Magic)
     {
         _animator.SetBool("isMagic", true);
     }
     if (type == Character.CharacterType.Archer)
     {
         _animator.SetBool("isArcher", true);
     }
 }
Exemplo n.º 2
0
    public ItemSetup GetItemSetup(Character.CharacterType characterType)
    {
        foreach (ItemSetup setup in itemSetup)
        {
            if (setup.type == characterType)
            {
                return(setup);
            }
        }

        return(null);
    }
Exemplo n.º 3
0
        public void OnAttackTypeSliderEndDrag()
        {
            int type = Mathf.FloorToInt(attackTypeSlider.value);

            characterType = (Character.CharacterType)type;

            if (Mathf.FloorToInt(attackTypeSlider.maxValue) <= type)
            {
                attackTypeSlider.value = attackTypeSlider.maxValue;
            }
            else
            {
                attackTypeSlider.value = type;
            }
        }
Exemplo n.º 4
0
        internal TCharacter this[Character.CharacterType characterType]
        {
            get
            {
                foreach (TCharacter character in Characters)
                {
                    if (character.Category == characterType)
                    {
                        return(character);
                    }
                }

                throw new NotSupportedException($"{characterType} is not related to this party");
            }
        }
Exemplo n.º 5
0
 // Enemy forager/warrior generator
 private void EnemyGenerator(Character.CharacterType type)
 {
     if (type == Character.CharacterType.Forager)
     {
         if (enemyUnitCount < maxUnits && enemyCash - foragerCost >= 0)
         {
             Forager newForager;
             newForager = Instantiate(enemyForager, transform);
             newForager.transform.position = new Vector3(75, 2.5f, 75);
             newForager.transform.rotation = Quaternion.identity;
             newForager.CurrentPosition    = mMap.mMap[mMap.Size.x - 1][mMap.Size.y - 1];
             newForager.tag           = "Enemy";
             newForager.MyType        = Character.CharacterType.Forager;
             newForager.CurrentTarget = null;
             newForager.OwnedBy       = Character.Ownership.Enemy;
             EnemyForagerList.Add(newForager);
             enemyUnitCount++;
             enemyCash -= foragerCost;
         }
         else
         {
             Debug.Log("Failed to spawn enemy");
         }
     }
     else if (type == Character.CharacterType.Warrior)
     {
         if (enemyUnitCount < maxUnits && enemyCash - warriorCost >= 0)
         {
             Warrior newWarrior;
             newWarrior = Instantiate(enemyWarrior, transform);
             newWarrior.transform.position = new Vector3(75, 2.5f, 75);
             newWarrior.transform.rotation = Quaternion.identity;
             newWarrior.CurrentPosition    = mMap.mMap[mMap.Size.x - 1][mMap.Size.y - 1];
             newWarrior.tag           = "Enemy";
             newWarrior.MyType        = Character.CharacterType.Warrior;
             newWarrior.CurrentTarget = null;
             newWarrior.OwnedBy       = Character.Ownership.Enemy;
             EnemyWarriorList.Add(newWarrior);
             enemyUnitCount++;
             enemyCash -= warriorCost;
         }
         else
         {
             Debug.Log("Failed to spawn enemy warrior");
         }
     }
 }
Exemplo n.º 6
0
        public void RunBattle(Character.CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController)
        {
            _heroes   = new HeroParty(this, _ai);
            _monsters = new MonsterParty(this, _ai);

            Character userControlledCharacter = _heroes[userControlledCharacterType];

            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(_heroes))
                {
                    break;
                }

                if (LetPartyAct(_monsters))
                {
                    break;
                }

                currentTurn++;
            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }
        static void Main(string[] args)
        {
            IMessageHandler consoleMessageHandler = new ConsoleOutput();
            ConsolePlayer   player = new ConsolePlayer();

            while (true)
            {
                DisplayGameTitle();

                Character.CharacterType type = player.ChooseHeroCategory();
                string name = player.ChooseHeroName();

                Battlefield battlefield = new Battlefield(consoleMessageHandler);
                battlefield.RunBattle(type, name, player);

                Console.WriteLine("Do you want to play again? [Y/N]");
                if (Console.ReadKey(true).Key != ConsoleKey.Y)
                {
                    return;
                }

                Console.Clear();
            }
        }
Exemplo n.º 8
0
 public void SetOwnerCharacterType(Character.CharacterType characterType)
 {
     _characterType = characterType;
 }