public void SetType(Character.CharacterType type) { if (type == Character.CharacterType.Magic) { _animator.SetBool("isMagic", true); } if (type == Character.CharacterType.Archer) { _animator.SetBool("isArcher", true); } }
public ItemSetup GetItemSetup(Character.CharacterType characterType) { foreach (ItemSetup setup in itemSetup) { if (setup.type == characterType) { return(setup); } } return(null); }
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; } }
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"); } }
// 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"); } } }
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(); } }
public void SetOwnerCharacterType(Character.CharacterType characterType) { _characterType = characterType; }