Ejemplo n.º 1
0
        public void updateLocation(CombatLocation combatLocation)
        {
            Vector3 position = combatLocation.position;

            position.Y += (this.height - 30);

            // Align the sprite in the center of the position
            float centerX = this.width / 2;

            position.X -= centerX;

            MyPosition = position;
        }
Ejemplo n.º 2
0
        public override void Start()
        {
            if (allowUserInteraction())
            {
                // Current player is under user control, so highlight the cells the player can move.
                CombatLocation location = CurrentPlayer.Location;
                int            radius   = CurrentPlayer.MyAttributes.actionPoints;

                MyBoard.selectAttackCells(location.i, location.j, radius);
            }

            base.Start();
        }
Ejemplo n.º 3
0
        private CombatLocation loadCombatLocation(CombatBoard board, XmlNode locationNode, ObstacleSprite sprite)
        {
            CombatLocation location = null;

            try
            {
                int row = Convert.ToInt16(locationNode.Attributes["row"].Value);
                int col = Convert.ToInt16(locationNode.Attributes["col"].Value);
                location = new CombatLocation(board, row, col);
            }
            catch (Exception ex)
            {
            }

            return(location);
        }
Ejemplo n.º 4
0
        private CombatLocation loadCombatLocation(CombatBoard combatBoard, Player player, XmlNode locationNode)
        {
            CombatLocation location = null;

            try
            {
                int          row       = Convert.ToInt16(locationNode.Attributes["row"].Value);
                int          col       = Convert.ToInt16(locationNode.Attributes["col"].Value);
                AnimationKey direction = getDirectionFromString(locationNode.Attributes["facing"].Value);
                location = new CombatLocation(combatBoard, row, col, direction);
            }
            catch (Exception ex)
            {
            }

            return(location);
        }
Ejemplo n.º 5
0
        public Player createPlayerForCombat(CombatBoard combatBoard, XmlNode playerNode)
        {
            string referenceName = playerNode.Attributes["referenceName"].Value;
            string name          = playerNode.Attributes["name"].Value;

            progress.updateProgress("Creating player " + name + " for combat", "Loading", 0);

            Player player = createPlayerFromTemplate(referenceName);

            player.MyName  = name;
            player.IsAlive = true;

            PrimaryStatistics stats    = null;
            CombatLocation    location = null;

            XmlNodeList childNodes = playerNode.ChildNodes;

            foreach (XmlNode childNode in childNodes)
            {
                switch (childNode.Name)
                {
                case "stats":
                    progress.updateProgress("Loading " + name + " stats", "Loading", 0);
                    stats = loadStats(childNode);
                    break;

                case "location":
                    progress.updateProgress("Loading " + name + " location", "Loading", 0);
                    location = loadCombatLocation(combatBoard, player, childNode);
                    break;
                }
            }

            player.Location = location;
            return(player);
        }
Ejemplo n.º 6
0
 public void setCombatPosition(CombatLocation combatLocation)
 {
     sprite.updateLocation(combatLocation);
 }
Ejemplo n.º 7
0
 public void setCombatPosition(CombatLocation combatLocation, bool isAnimating)
 {
     this.combatLocation = combatLocation;
     this.isAnimating    = isAnimating;
     updateCombatPosition();
 }