Example #1
0
        private void CreateStage()
        {
            // spawn units
            for (int i = 0; i < 10; i++)
            {
                Unit red = new Unit(20, 20, 15, 50 + i * 55, 50, "red");
                red.CurrentAngle = red.CurrentAngle + (float)Math.PI;
                red.TargetAngle = red.CurrentAngle;

                _gameState.Units.Add(red);
                _gameState.Units.Add(new Unit(20, 20, _map.Width - 15, 50 + i * 55, 50, "blue"));

                Special special = new Special(i % 2 == 0 ? "build" : "blink", 1000, 200);

                _gameState.Units[_gameState.Units.Count - 2].Special = special;
                _gameState.Units[_gameState.Units.Count - 1].Special = special;
            }

            GenerateStage(800, 5, 7, 10, 10); // big blocks
            GenerateStage(800, 3, 4, 6, 6); // medium blocks
            GenerateStage(800, 0, 0, 3, 3); // small blocks
        }
Example #2
0
        internal static Special Deserialize(XmlNode node)
        {
            Special p = new Special
            {
                Complete = bool.Parse(Helper.GetAttribute(node, "Complete")),
                Cooldown = float.Parse(Helper.GetAttribute(node, "Cooldown")),
                Elapsed = float.Parse(Helper.GetAttribute(node, "Elapsed")),
                Power = float.Parse(Helper.GetAttribute(node, "Power")),
                Type = Helper.GetAttribute(node, "Type"),
            };

            return p;
        }