예제 #1
0
        public BreakableWall[] LoadInBreakableWalls(Scene scene)
        {
            BreakableWall[] breakableWallsObj = new BreakableWall[breakableWalls.Count];

            for (int i = 0; i < breakableWalls.Count; i++)
            {
                breakableWallsObj[i] = breakableWalls[i];
                scene.AddChild(breakableWallsObj[i].GetSprite());
            }

            if (blackHoles.Count != 0)
            {
                return(breakableWallsObj);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public void AddObject(string type, float x, float y, float rotation)
        {
            switch (type)
            {
            // Collectables
            case "Coin":
                Coin coin = new Coin();
                coin.setPosition(new Vector2(x, y));
                coin.setRotation(-rotation);
                coins.Add(coin);
                break;

            case "Gem":
                Gem gem = new Gem();
                gem.setPosition(new Vector2(x, y));
                gem.setRotation(-rotation);
                gems.Add(gem);
                break;

            // Obstacles
            case "Small Spikes":
                Spikes smallSpikes = new Spikes(1);

                if (rotation == 0)
                {
                    smallSpikes.setPosition(new Vector2(x, y - 100.0f));
                }
                else
                {
                    smallSpikes.setPosition(new Vector2(x - 220.0f, y - 165.0f));
                }

                //rotation += 270;
                smallSpikes.setRotation(-rotation);
                spikes.Add(smallSpikes);
                break;

            case "Large Spikes":
                Spikes largeSpikes = new Spikes(2);

                if (rotation == 0)
                {
                    largeSpikes.setPosition(new Vector2(x, y - 100.0f));
                }
                else
                {
                    largeSpikes.setPosition(new Vector2(x - 240.0f, y - 210.0f));
                }

                //rotation += 270;
                largeSpikes.setRotation(-rotation);
                spikes.Add(largeSpikes);
                break;

            case "Black Hole":
                BlackHole blackHole = new BlackHole();

                if (rotation == 0)
                {
                    blackHole.setPosition(new Vector2(x, y));
                }
                else
                {
                    blackHole.setPosition(new Vector2(x, y));
                }

                blackHole.setRotation(-rotation);
                blackHole.setDirection((int)rotation);
                blackHoles.Add(blackHole);
                break;

            case "Breakable Wall":
                BreakableWall breakableWall = new BreakableWall();

                if (rotation == 0)
                {
                    breakableWall.setPosition(new Vector2(x, y));
                }
                else
                {
                    breakableWall.setPosition(new Vector2(x, y));
                }

                breakableWall.setRotation(-rotation);
                breakableWall.setDirection((int)rotation);
                breakableWalls.Add(breakableWall);
                break;

            case "Laser Gate":
                LaserGate laserGate = new LaserGate(rnd.Next(0, 18));

                if (rotation == 0)
                {
                    laserGate.setPosition(new Vector2(x, y));
                }
                else
                {
                    laserGate.setPosition(new Vector2(x, y));
                }

                laserGate.setRotation(-rotation);
                laserGate.setDirection((int)rotation);
                laserGates.Add(laserGate);
                break;

            case "Wind Tunnel":
                WindTunnel windTunnel = new WindTunnel();

                if (rotation == 0)
                {
                    windTunnel.setPosition(new Vector2(x, y));
                }
                else
                {
                    windTunnel.setPosition(new Vector2(x, y));
                }

                windTunnel.setRotation(-rotation);
                windTunnel.setDirection((int)rotation);
                windTunnels.Add(windTunnel);
                break;

            // Level Flag
            case "Level":
                levelFlag = new LevelFlag();
                levelFlag.setPosition(new Vector2(x, y - 80.0f));

                levelFlag.setRotation(-rotation);
                break;

            // Player Position
            case "Player":
                playerPos = new Vector2(x, y);
                break;
            }
        }