public CombatScreen2D(LunchHourGames lhg, CombatSystem combatSystem)
     : base(lhg, Type.Combat)
 {
     this.combatSystem = combatSystem;
     this.lhg          = lhg;
     //this.hud = new CombatHUD(lhg, combatSystem);
 }
        public CombatSystem loadCombat(XmlNode combatSystemNode, string combatReferenceName)
        {
            this.progress.updateProgress("Loading Combat " + combatReferenceName, "Loading Combat System", 10);

            CombatSystem combatSystem = new CombatSystem(lhg);

            // Find level and combat
            string  xpath      = "/combatsystem/combat[@referenceName='" + combatReferenceName + "']";
            XmlNode combatNode = combatSystemNode.SelectSingleNode(xpath);

            if (combatNode != null)
            {
                XmlNodeList combatChildren = combatNode.ChildNodes;
                foreach (XmlNode childNode in combatChildren)
                {
                    switch (childNode.Name)
                    {
                    case "board":
                        progress.updateProgress("Loading Board Assets", "Loading Board Assets", 20);
                        combatSystem.MyBoard = loadBoard(childNode);
                        break;

                    case "screen":
                        progress.updateProgress("Loading Screen Assets", "Loading Screen Assets", 30);
                        combatSystem.MyScreen = loadScreen(childNode);
                        break;

                    case "audio":
                        break;
                    }
                }
            }

            // Now that the combat board has all the components loaded.  Initialilze all the components so the board and screen know how to
            // work with each other.
            // Tell our children about each other and this system
            combatSystem.MyBoard.MyCombatScreen = combatSystem.MyScreen;
            combatSystem.MyBoard.MyCombatSystem = combatSystem;

            combatSystem.MyScreen.MyCombatBoard  = combatSystem.MyBoard;
            combatSystem.MyScreen.MyCombatSystem = combatSystem;

            foreach (Player player in combatSystem.MyBoard.MyGameEntities.MyPlayers)
            {
                player.Location.screen = combatSystem.MyBoard.MyCombatScreen;
            }

            foreach (Obstacle obstacle in combatSystem.MyBoard.MyGameEntities.MyObstacles)
            {
                obstacle.Location.screen = combatSystem.MyBoard.MyCombatScreen;
            }

            progress.updateProgress("Finished Loading Combat System", "Loading", 100);

            return(combatSystem);
        }
Example #3
0
        private static Random random = new Random();  // Random number generator to make the dice appear more random

        public CombatTurnBased(LunchHourGames lhg, CombatSystem combatSystem)
        {
            this.lhg          = lhg;
            this.combatSystem = combatSystem;

            this.chooseAction  = new ChooseAction(lhg, combatSystem, this);
            this.moveAction    = new MoveAction(lhg, combatSystem, this);
            this.attackAction  = new AttackAction(lhg, combatSystem, this);
            this.useAction     = new UseAction(lhg, combatSystem, this);
            this.defendAction  = new DefendAction(lhg, combatSystem, this);
            this.endTurnAction = new EndTurnAction(lhg, combatSystem, this);

            currentAction = null;
            nextAction    = null;
        }
Example #4
0
 public CombatInterpreter(CombatSystem combatSystem)
 {
     this.combatSystem = combatSystem;
 }