コード例 #1
0
        void SpawnItem(LevelItem_6 item)
        {
            GameNode node = null;

            if (item.Type == ItemType_6.Bug1) node = new Bug1(Config.Bug1SpriteSheet);
            else if (item.Type == ItemType_6.Bug2) node = new Bug2(Config.Bug2SpriteSheet);
            else if (item.Type == ItemType_6.Bug3) node = new Bug3(Config.Bug3SpriteSheet);
            else if (item.Type == ItemType_6.Bug4) node = new Bug4(Config.Bug4SpriteSheet);
            else if (item.Type == ItemType_6.BugDagger1) node = new BugDagger1(Config.BugDagger1SpriteSheet);
            else if (item.Type == ItemType_6.BugDagger2) node = new BugDagger2(Config.BugDagger2SpriteSheet);
            else if (item.Type == ItemType_6.BugDagger3) node = new BugDagger3(Config.BugDagger3SpriteSheet);
            else if (item.Type == ItemType_6.PowerupHealth) node = new PowerupHealth(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_6.PowerupMissiles) node = new PowerupMissiles(Config.PowerupMissileSpriteSheet);
            else if (item.Type == ItemType_6.PowerupWeaponAutoBurst) node = new PowerupWeaponAutoBurst(Config.PowerupSlowAllSpriteSheet);

            if (node != null)
            {
                //TODO: suppy levelItem Y position from item
                //node.Position = new Vector2(item.PositionX, -node.Sprite.Origin.Y);
                node.Position = new Vector2(item.PositionX, item.PositionY);
                node.Speed = item.Speed;
                node.Direction = item.Direction;
            }

        }
コード例 #2
0
        protected override void Explode()
        {
            for (int i = 0; i < rand.Next(1, 5); i++)
            {
                Coin coin = new Coin(Config.CoinSpriteSheet);
                coin.Position = this.Position + new Vector2(rand.Next(0, 20) - 10, rand.Next(0, 20) - 10);
                //GameStateManagementGame.Instance.soundManager.PlaySound("ShipExplode");
            }

            for (int i = 0; i < 3; i++)
            {
                GameNode node = null;
                node = new BugDagger3(Config.BugDagger3SpriteSheet);
                node.Position = this.Position;
            }

            base.Explode();
        }