Ejemplo n.º 1
0
        public Terrain(Game g)
            : base(g)
        {
            terrain      = Engine.ContentManager.Load <Texture2D>("mapTop");
            collisionMap = Engine.ContentManager.Load <Texture2D>("collisionMap");

            powerups = new List <Powerup>();

            waterOne = Engine.ContentManager.Load <Texture2D>("waterOne");
            waterTwo = Engine.ContentManager.Load <Texture2D>("waterTwo");

            Color[] collisionColours = new Color[collisionMap.Width * collisionMap.Height];
            collisionData = new bool[collisionMap.Width * collisionMap.Height];
            collisionMap.GetData <Color>(collisionColours);

            for (int i = 0; i < collisionColours.Length; i++)
            {
                collisionData[i] = collisionColours[i] != Colour.Black;
            }

            rand = new Random(DateTime.Now.Millisecond);

            powerupSettings = new ParticleSettings(Engine.graphics.GraphicsDevice, null, 1000);
            powerupSettings.LoadFromFile("Content/powerup.psf", true);

            powerupEmitters = new List <ParticleEmitter>(10);
        }
Ejemplo n.º 2
0
Archivo: Hut.cs Proyecto: h4l/x48-incas
        public Hut(Vector2 position, int maxPeons, float spawnRadius, Engine game, Texture2D texture)
        {
            this.position    = position;
            this.maxPeons    = maxPeons;
            this.spawnRadius = spawnRadius;
            this.game        = game;
            hutTexture       = Engine.ContentManager.Load <Texture2D>("vilageSingle");

            smokeSettings = new ParticleSettings(Engine.graphics.GraphicsDevice, null, 1000);
            smokeSettings.LoadFromFile("Content/Smoke.psf", true);
            smokeSettings.StartColours[0] = new Color(Color.White, 0.5f);
            smokeSettings.EndColours[0]   = new Color(Color.Gray, 0.5f);
            smokeEmitter           = new ParticleEmitter(Engine.spriteBatch, smokeSettings);
            smokeEmitter.Position  = this.position + new Vector2(61, 60);
            smokeEmitter.TimeLimit = TimeSpan.FromDays(1);
            peonsAvaible           = new List <Peon>();
        }
Ejemplo n.º 3
0
        public ButtonCombo(PlayerIndex player)
        {
            this.player = player;

            particleSettings = new ParticleSettings(Engine.graphics.GraphicsDevice, null, 500);
            particleSettings.LoadFromFile("Content/buttonpress.psf", true);
            emitter           = new ParticleEmitter(Engine.spriteBatch, particleSettings);
            emitter.Position += this.position + buttonPosition + new Vector2(10, 10);

            background = Engine.ContentManager.Load <Texture2D>("combo_background");

            if (buttonTextures == null)
            {
                buttonTextures    = new Texture2D[4];
                buttonTextures[0] = Engine.ContentManager.Load <Texture2D>("button_a");
                buttonTextures[1] = Engine.ContentManager.Load <Texture2D>("button_b");
                buttonTextures[2] = Engine.ContentManager.Load <Texture2D>("button_x");
                buttonTextures[3] = Engine.ContentManager.Load <Texture2D>("button_y");
            }

            if (buttons == null)
            {
                buttons    = new Buttons[4];
                buttons[0] = Buttons.A;
                buttons[1] = Buttons.B;
                buttons[2] = Buttons.X;
                buttons[3] = Buttons.Y;
            }

            if (rand == null)
            {
                rand = new Random(DateTime.Now.Millisecond);
            }

            buttonQueue = new Queue <byte>(5);

            for (int i = 0; i < 5; i++)
            {
                buttonQueue.Enqueue((byte)rand.Next(4));
            }

            Engine.InputManager.ButtonUp += new Input.ControllerButtonEvent(InputManager_ButtonUp);
        }