public BattleEngine(Controller controller, Heroes.Core.Hero attacker, Heroes.Core.Hero defender, Heroes.Core.Monster monster, Heroes.Core.Town castle) : base() { _isFirstRun = true; _disableControl = false; _controller = controller; _inputCommand = new InputCommand(); _battleTerrain = new Heroes.Core.Battle.Terrains.BattleTerrain(controller); _spells = new Hashtable(); _spellActions = new ArrayList(); // init hero and armies { _activeCharacters = new ArrayList(); InitHero(attacker, ArmySideEnum.Attacker, controller, out _attacker); if (defender != null) { InitHero(defender, ArmySideEnum.Defender, controller, out _defender); } if (monster != null) { InitMonster(monster, ArmySideEnum.Defender, controller, out _monster); } // sort armies by speed SortBySpeed(_activeCharacters); } // initialize graphics { foreach (StandardCharacter c in _activeCharacters) { c.Initalize(); c.Command = _inputCommand; c.Command.InitalizeGraphics(c); } _attacker.Initalize(); if (_defender != null) _defender.Initalize(); } _turn = new Turn(_activeCharacters, _attacker, _defender); _turn.NextTurned += new Turn.NextTurnedEventHandler(_turn_NextTurned); _actions = new ArrayList(); }
public DialogResult ShowDialog(Heroes.Core.Hero attackHero, Heroes.Core.Hero defendHero, Heroes.Core.Monster monster, Heroes.Core.Town defendCastle) { _attackHero = attackHero; _defendHero = defendHero; _monster = monster; _defendCastle = defendCastle; _controller = new Controller(this, null, new Size(800, 600), null); _poller = new Poller(this); _inputMethod = new InputPollerCommand(_poller); SetupEngine(); SetupRenderer(); return this.ShowDialog(); }