Ejemplo n.º 1
0
        public void Draw(Camera gameCamera, Room currentRoom)
        {
            foreach (Enemy e in Enemies.Where(en=>en.Room==currentRoom))
            {
                drawEffect.DiffuseColor = new Vector3(1f,1f-e.hitAlpha,1f-e.hitAlpha);
                drawEffect.Alpha = 1f;
                drawEffect.World = gameCamera.worldMatrix *
                    Matrix.CreateRotationX(MathHelper.PiOver2) *
                        Matrix.CreateRotationZ(e.Rotation-MathHelper.PiOver2) *
                        Matrix.CreateScale(e.Scale) *
                        Matrix.CreateTranslation(e.Position);

                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    if (e.Type != EnemyType.Ooze)
                    {
                        if (!e.attacking)
                            graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray.Length, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].IndexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray.Length / 2);
                        else
                            graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, e.spriteSheet.AnimChunks[e.numFrames + e.offsetFrame + e.attackFrame].VertexArray, 0, e.spriteSheet.AnimChunks[e.numFrames + e.offsetFrame + e.attackFrame].VertexArray.Length, e.spriteSheet.AnimChunks[e.numFrames + e.offsetFrame + e.attackFrame].IndexArray, 0, e.spriteSheet.AnimChunks[e.numFrames + e.offsetFrame + e.attackFrame].VertexArray.Length / 2);
                    }

                }

                if (e.Type == EnemyType.Ooze)
                {
                    foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                    {
                        pass.Apply();
                        graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame + 3].VertexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame + 3].VertexArray.Length, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame + 3].IndexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame + 3].VertexArray.Length / 2);
                    }

                    drawEffect.Alpha = 0.5f;

                    foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                    {
                        pass.Apply();
                        graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray.Length, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].IndexArray, 0, e.spriteSheet.AnimChunks[e.CurrentFrame + e.offsetFrame].VertexArray.Length / 2);
                    }
                }

                drawEffect.DiffuseColor = new Vector3(1f, 1f, 1f);
                drawEffect.Alpha = 0.2f;
                drawEffect.World = gameCamera.worldMatrix *
                    Matrix.CreateRotationX(MathHelper.PiOver2) *
                        Matrix.CreateRotationZ(e.Rotation-MathHelper.PiOver2) *
                        Matrix.CreateTranslation(new Vector3(0, 0, (-(e.spriteSheet.Z_SIZE * SpriteVoxel.HALF_SIZE)) + SpriteVoxel.HALF_SIZE)) *
                        Matrix.CreateScale(e.Scale) *
                        Matrix.CreateScale(new Vector3(1f,1f,0.1f)) *
                        Matrix.CreateTranslation(new Vector3(e.Position.X,e.Position.Y, e.groundHeight-0.35f));
                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, e.spriteSheet.AnimChunks[e.spriteSheet.AnimChunks.Count - 1].VertexArray, 0, e.spriteSheet.AnimChunks[e.spriteSheet.AnimChunks.Count - 1].VertexArray.Length, e.spriteSheet.AnimChunks[e.spriteSheet.AnimChunks.Count - 1].IndexArray, 0, e.spriteSheet.AnimChunks[e.spriteSheet.AnimChunks.Count - 1].VertexArray.Length / 2);
                }
            }
        }
Ejemplo n.º 2
0
        public void Draw(GraphicsDevice gd, Camera gameCamera, BasicEffect drawEffect)
        {
            drawEffect.World = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ((Dir == 1 || Dir == 3) ? MathHelper.PiOver2 : 0f) * Matrix.CreateTranslation(Position) * gameCamera.worldMatrix;

            foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                AnimChunk c = spriteSheet.AnimChunks[currentFrame];
                gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
            }
        }
Ejemplo n.º 3
0
        public void Update(GameTime gameTime, Camera gameCamera, Hero gameHero, Room currentRoom)
        {
            foreach (Pickup p in Pickups.Where(proj => proj.Active))
            {
                p.Update(gameTime, currentRoom, gameHero);
                if (gameHero.boundingSphere.Intersects(p.boundingSphere) && p.Room==currentRoom) p.Collect(gameHero);
            }

            Pickups.RemoveAll(proj => !proj.Active);

            drawEffect.World = gameCamera.worldMatrix;
            drawEffect.View = gameCamera.viewMatrix;
            drawEffect.Projection = gameCamera.projectionMatrix;
        }
Ejemplo n.º 4
0
        public void Draw(Camera gameCamera, Room currentRoom)
        {
            foreach (Pickup p in Pickups.Where(proj => proj.Type == PickupType.Health && proj.Room == currentRoom))
            {
                drawEffect.World = gameCamera.worldMatrix *
                                   Matrix.CreateRotationX(MathHelper.PiOver2) *
                                   Matrix.CreateRotationZ(p.Rotation - MathHelper.PiOver2) *
                                   Matrix.CreateScale(1f) *
                                   Matrix.CreateTranslation(p.Position);
                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, pickupStrip.AnimChunks[p.currentFrame + p.frameOffset].VertexArray, 0, pickupStrip.AnimChunks[p.currentFrame + p.frameOffset].VertexArray.Length, pickupStrip.AnimChunks[p.currentFrame + p.frameOffset].IndexArray, 0, pickupStrip.AnimChunks[p.currentFrame + p.frameOffset].VertexArray.Length / 2);

                }
            }
        }
Ejemplo n.º 5
0
        public void Update(GameTime gameTime, Camera gameCamera, VoxelWorld gameWorld)
        {
            int parts = 0;
            foreach (Particle p in Particles.Where(part => part.Active))
            {
                p.Update(gameTime, gameWorld);

                ParticleCube.Create(ref verts, ref indexes, p.Position, parts, p.Scale/2, p.Color);

                parts++;
            }

            currentParticleCount = Particles.Count(part => part.Active);

            drawEffect.World = gameCamera.worldMatrix;
            drawEffect.View = gameCamera.viewMatrix;
            drawEffect.Projection = gameCamera.projectionMatrix;
        }
Ejemplo n.º 6
0
        public void Draw(Camera gameCamera, Room currentRoom)
        {
            drawEffect.Projection = gameCamera.projectionMatrix;
            drawEffect.View = gameCamera.viewMatrix;

            foreach (Bomb b in Bombs.Where(bom=>bom.Room==currentRoom))
            {
                drawEffect.World = gameCamera.worldMatrix *
                                       Matrix.CreateRotationX(MathHelper.PiOver2) *
                                       Matrix.CreateRotationZ(-MathHelper.PiOver2) *
                                       Matrix.CreateScale(0.75f) *
                                       Matrix.CreateTranslation(b.Position);
                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, spriteSheet.AnimChunks[1 + b.CurrentFrame].VertexArray, 0, spriteSheet.AnimChunks[1 + b.CurrentFrame].VertexArray.Length, spriteSheet.AnimChunks[1 + b.CurrentFrame].IndexArray, 0, spriteSheet.AnimChunks[1 + b.CurrentFrame].VertexArray.Length / 2);

                }
            }
        }
Ejemplo n.º 7
0
        public void Draw(Camera gameCamera, Room currentRoom)
        {
            foreach (Projectile p in Projectiles.Where(proj => proj.Type == ProjectileType.Laserbolt && proj.Room == currentRoom))
            {
                drawEffect.Alpha = 0.5f;
                drawEffect.World = gameCamera.worldMatrix *
                                   Matrix.CreateRotationX(MathHelper.PiOver2) *
                                   Matrix.CreateRotationZ(-MathHelper.PiOver2) *
                                   p.Rotation *
                                   Matrix.CreateScale(0.5f) *
                                   Matrix.CreateTranslation(p.Position);
                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, projectileStrip.AnimChunks[1].VertexArray, 0, projectileStrip.AnimChunks[1].VertexArray.Length, projectileStrip.AnimChunks[1].IndexArray, 0, projectileStrip.AnimChunks[1].VertexArray.Length / 2);

                }
                drawEffect.Alpha = 1f;
            }
            foreach (Projectile p in Projectiles.Where(proj => proj.Type == ProjectileType.Rocket && proj.Room == currentRoom))
            {

                drawEffect.World = gameCamera.worldMatrix *
                                   Matrix.CreateRotationX(MathHelper.PiOver2) *
                                   Matrix.CreateRotationZ(-MathHelper.PiOver2) *
                                   p.Rotation *
                                   Matrix.CreateScale(0.5f) *
                                   Matrix.CreateTranslation(p.Position);
                foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, projectileStrip.AnimChunks[0].VertexArray, 0, projectileStrip.AnimChunks[0].VertexArray.Length, projectileStrip.AnimChunks[0].IndexArray, 0, projectileStrip.AnimChunks[0].VertexArray.Length / 2);

                }

            }
        }
Ejemplo n.º 8
0
        public void Draw(GraphicsDevice gd, Camera gameCamera, BasicEffect drawEffect)
        {
            drawEffect.DiffuseColor = wallColor.ToVector3();

             for (int x = 0; x < 15; x++)
                for (int y = 0; y < 9; y++)
                    if (x == 0 || x == 14 || y == 0 || y == 8)
                        if (x != 7 && y != 4)
                        {
                            drawEffect.World = Matrix.CreateRotationX(MathHelper.PiOver2) *
                                               Matrix.CreateRotationZ(wallRots[x,y]) *
                                               Matrix.CreateTranslation(VoxelWorld.ToScreenSpace((x * 16) + 7, (y * 16) + 7, 21) + (Vector3.One * Voxel.HALF_SIZE)) *
                                               gameCamera.worldMatrix;
                            foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
                            {
                                pass.Apply();

                                AnimChunk c = objectSheet.AnimChunks[7];
                                gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
                            }
                        }

             drawEffect.DiffuseColor = Color.White.ToVector3();
        }
Ejemplo n.º 9
0
        public void Update(GameTime gameTime, Camera gameCamera, Room currentRoom, List<Door> doors, ref Room[,] rooms, bool allRoomsComplete, int exitRoomX, int exitRoomY, Door exitDoor)
        {
            if (Dead) return;

            Health = MathHelper.Clamp(Health, 0f, MaxHealth);

            //Health = MaxHealth;

            Vector2 v2pos = new Vector2(Position.X, Position.Y);
            Vector2 v2speed = new Vector2(Speed.X, Speed.Y);
            if (Speed.Length() > 0f)
            {
                //if (!defending)
                Rotation = Helper.TurnToFace(v2pos, v2pos + (v2speed * 50f), Rotation, 1f, 0.5f);
            }
            if(introTargetReached) CheckCollisions(currentRoom.World, doors, currentRoom);
            Position += Speed;

            v2speed = new Vector2(Speed.X, Speed.Y);
            if (Speed.Length() > 0f)
            {
                frameTime += gameTime.ElapsedGameTime.TotalMilliseconds;
                if (frameTime >= frameTargetTime)
                {
                    frameTime = 0;
                    currentFrame++;
                    if (currentFrame == 4) currentFrame = 0;
                }
            }

            if (RoomX == exitRoomX && RoomY == exitRoomY && introTargetReached)
            {
                if (Position.X < doors[3].Position.X - 5f && doors[3] == exitDoor) { exitReached = true; }
                if (Position.X > doors[1].Position.X + 5f && doors[1] == exitDoor) { exitReached = true; }
                if (Position.Y < doors[0].Position.Y - 5f && doors[0] == exitDoor) { exitReached = true; }
                if (Position.Y > doors[2].Position.Y + 5f && doors[2] == exitDoor) { exitReached = true; }
            }

            if (introTargetReached)
            {
                if (Position.X < doors[3].Position.X && !(doors[3] == exitDoor && RoomX == exitRoomX && RoomY == exitRoomY)) { RoomX--; Position = doors[1].Position + new Vector3(0f, 0f, 4f); ResetDoors(doors, ref rooms, allRoomsComplete, exitRoomX, exitRoomY, exitDoor); }
                if (Position.X > doors[1].Position.X && !(doors[1] == exitDoor && RoomX == exitRoomX && RoomY == exitRoomY)) { RoomX++; Position = doors[3].Position + new Vector3(0f, 0f, 4f); ResetDoors(doors, ref rooms, allRoomsComplete, exitRoomX, exitRoomY, exitDoor); }
                if (Position.Y < doors[0].Position.Y && !(doors[0] == exitDoor && RoomX == exitRoomX && RoomY == exitRoomY)) { RoomY--; Position = doors[2].Position + new Vector3(0f, 0f, 4f); ResetDoors(doors, ref rooms, allRoomsComplete, exitRoomX, exitRoomY, exitDoor); }
                if (Position.Y > doors[2].Position.Y && !(doors[2] == exitDoor && RoomX == exitRoomX && RoomY == exitRoomY)) { RoomY++; Position = doors[0].Position + new Vector3(0f, 0f, 4f); ResetDoors(doors, ref rooms, allRoomsComplete, exitRoomX, exitRoomY, exitDoor); }

            }

            Vector2 p = Helper.RandomPointInCircle(Helper.PointOnCircle(ref v2pos, 1f, (Rotation - MathHelper.Pi) + 0.1f), 0f, 2f);
            ParticleController.Instance.Spawn(new Vector3(p, Position.Z-1f), new Vector3(0f, 0f, -0.01f - ((float)Helper.Random.NextDouble() * 0.01f)), 0.5f, Color.Black*0.2f, 2000, false);

            drawEffect.Projection = gameCamera.projectionMatrix;
            drawEffect.View = gameCamera.viewMatrix;
            drawEffect.World = gameCamera.worldMatrix *
                               Matrix.CreateRotationX(MathHelper.PiOver2) *
                               Matrix.CreateRotationZ(Rotation - MathHelper.PiOver2) *
                               Matrix.CreateTranslation(new Vector3(0, 0, (-(spriteSheet.Z_SIZE * SpriteVoxel.HALF_SIZE)) + SpriteVoxel.HALF_SIZE)) *
                               Matrix.CreateScale(0.9f) *
                               Matrix.CreateTranslation(Position);

            boundingSphere = new BoundingSphere(Position + new Vector3(0f,0f,-4f), 3f);

            timeSinceLastHit -= gameTime.ElapsedGameTime.TotalMilliseconds;

            if (attacking)
            {
                attackTime += gameTime.ElapsedGameTime.TotalMilliseconds;
                if (attackTime >= attackTargetTime)
                {
                    attackTime = 0;
                    attackFrame+=attackDir;

                    if (attackFrame == 1 && attackDir == 1)
                    {
                        bool hit = false;
                        float radiusSweep = 1f;
                        foreach (Enemy e in EnemyController.Instance.Enemies.Where(en => en.Room == currentRoom))
                        {
                            for (float az = 0f; az > -8f; az -= 1f)
                            {
                                for (float a = Rotation - radiusSweep; a < Rotation + radiusSweep; a += 0.02f)
                                {
                                    for (float dist = 0f; dist < 5f; dist += 0.2f)
                                    {
                                        Vector3 attackPos = new Vector3(Helper.PointOnCircle(ref v2pos, dist, Rotation), Position.Z + az);

                                        if (e.boundingSphere.Contains(attackPos) == ContainmentType.Contains && !hit)
                                        {
                                            e.DoHit(attackPos, new Vector3(Helper.AngleToVector(Rotation, 0.01f), 0f), 10f);
                                            hit = true;
                                        }
                                    }
                                }
                            }
                        }

                    }

                    if (attackFrame == 3) { attackDir = -1; attackFrame = 1; }
                    if (attackFrame == -1) { attackFrame = 0; attacking = false; }

                }
            }

            if (hitAlpha > 0f) hitAlpha -= 0.1f;

            if (Health <= 0f) Die();

            bombRespawnTime -= gameTime.ElapsedGameTime.TotalMilliseconds;
            if (bombRespawnTime <= 0 && numBombs < 3)
            {
                numBombs++;
                bombRespawnTime = 5000;
                if (numBombs == 3) bombRespawnTime = 0;
            }

            if (!introTargetReached)
            {
                if (IntroTarget.X < Position.X) Move(new Vector2(-0.3f, 0f));
                if (IntroTarget.X > Position.X) Move(new Vector2(0.3f, 0f));
                if (IntroTarget.Y < Position.Y) Move(new Vector2(0f,-0.3f));
                if (IntroTarget.Y > Position.Y) Move(new Vector2(0f,0.3f));

                if(Vector3.Distance(IntroTarget, Position)<1f) introTargetReached = true;
            }
        }
Ejemplo n.º 10
0
        public void Draw(GraphicsDevice gd, Camera gameCamera)
        {
            if (Dead) return;

            drawEffect.DiffuseColor = new Vector3(1f, 1f - hitAlpha, 1f - hitAlpha);
            foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                AnimChunk c = spriteSheet.AnimChunks[currentFrame];
                gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);

                if (!attacking && !defending)
                {
                    c = spriteSheet.AnimChunks[currentFrame + 4];
                    gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
                }

                if (attacking)
                {
                    c = spriteSheet.AnimChunks[attackFrame + 8];
                    gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
                }

                if(defending)
                {
                    c = spriteSheet.AnimChunks[12];
                    gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            generatedPercent = 0;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            if (firstRun)
            {
                AudioController.LoadContent(Content);

                tileSheet = new VoxelSprite(16, 16, 16);
                LoadVoxels.LoadSprite(Path.Combine(Content.RootDirectory, "tiles.vxs"), ref tileSheet);
                doorSheet = new VoxelSprite(16, 16, 16);
                LoadVoxels.LoadSprite(Path.Combine(Content.RootDirectory, "door.vxs"), ref doorSheet);
                objectSheet = new VoxelSprite(16, 16, 16);
                LoadVoxels.LoadSprite(Path.Combine(Content.RootDirectory, "dynamic.vxs"), ref objectSheet);
            }
            else if (AudioController.instances["roomscrape"].State == SoundState.Playing) AudioController.instances["roomscrape"].Pause();

            gameCamera = new Camera(GraphicsDevice, GraphicsDevice.Viewport);
            particleController = new ParticleController(GraphicsDevice);
            projectileController = new ProjectileController(GraphicsDevice);
            pickupController = new PickupController(GraphicsDevice);
            bombController = new BombController(GraphicsDevice, objectSheet);
            enemyController = new EnemyController(GraphicsDevice);

            projectileController.LoadContent(Content);
            pickupController.LoadContent(Content);
            enemyController.LoadContent(Content);

            drawEffect = new BasicEffect(GraphicsDevice)
            {
                World = gameCamera.worldMatrix,
                View = gameCamera.viewMatrix,
                Projection = gameCamera.projectionMatrix,
                VertexColorEnabled = true,
            };

            gameHero = new Hero(0, 0, Vector3.Zero, Vector3.Zero);
            gameHero.LoadContent(Content, GraphicsDevice);

            ThreadPool.QueueUserWorkItem(delegate { CreateRoomsAsync(); });

            doorCountdown = 10000;
            roomMovesLeft = 0;
            roomShift = null;
            roomState = RoomState.DoorsOpen;
            deadTime = 0;
            allRoomsComplete = false;
            shownComplete = false;
            showCompleteTime = 0;
            showCompleteAlpha = 0f;

            Doors.Clear();
            Doors.Add(new Door(VoxelWorld.ToScreenSpace((7 * 16) + 7, 7, 21) + new Vector3(Voxel.HALF_SIZE,Voxel.HALF_SIZE,Voxel.HALF_SIZE), 0, doorSheet));
            Doors.Add(new Door(VoxelWorld.ToScreenSpace((14 * 16) + 7, (4 * 16) + 7, 21) + new Vector3(Voxel.HALF_SIZE, Voxel.HALF_SIZE, Voxel.HALF_SIZE), 1, doorSheet));
            Doors.Add(new Door(VoxelWorld.ToScreenSpace((7 * 16) + 7, (8 * 16) + 7, 21) + new Vector3(Voxel.HALF_SIZE, Voxel.HALF_SIZE, Voxel.HALF_SIZE), 2, doorSheet));
            Doors.Add(new Door(VoxelWorld.ToScreenSpace(7, (4 * 16) + 7, 21) + new Vector3(Voxel.HALF_SIZE, Voxel.HALF_SIZE, Voxel.HALF_SIZE), 3, doorSheet));

            if (firstRun)
            {
                roomIcon = Content.Load<Texture2D>("roomicon");
                texHud = Content.Load<Texture2D>("hud");
                texTitle = Content.Load<Texture2D>("titlesheet");
                texTitleBG = Content.Load<Texture2D>("title-bg");
                texStingers = Content.Load<Texture2D>("stingers");
                font = Content.Load<SpriteFont>("font");
                timerFontLarge = Content.Load<SpriteFont>("timerfont-large");
                timerFontSmall = Content.Load<SpriteFont>("timerfont-small");
            }

            firstRun = false;
        }
Ejemplo n.º 12
0
        public void Update(GameTime gameTime, Camera gameCamera, Hero gameHero, Room currentRoom)
        {
            foreach (Projectile p in Projectiles.Where(proj => proj.Active))
            {
                p.Update(gameTime, currentRoom, gameHero);
            }

            Projectiles.RemoveAll(proj => !proj.Active);

            drawEffect.World = gameCamera.worldMatrix;
            drawEffect.View = gameCamera.viewMatrix;
            drawEffect.Projection = gameCamera.projectionMatrix;
        }
Ejemplo n.º 13
0
        public void Update(GameTime gameTime, Camera gameCamera, Room currentRoom, Hero gameHero, List<Door> doors)
        {
            for(int i=Enemies.Count-1;i>=0;i--) Enemies[i].Update(gameTime, currentRoom, gameHero, doors);

            Enemies.RemoveAll(en => !en.Active);

            drawEffect.World = gameCamera.worldMatrix;
            drawEffect.View = gameCamera.viewMatrix;
            drawEffect.Projection = gameCamera.projectionMatrix;
        }
Ejemplo n.º 14
0
        public void Update(GameTime gameTime, Camera gameCamera, bool isCurrent)
        {
            X_SIZE = X_CHUNKS * Chunk.X_SIZE;
            Y_SIZE = Y_CHUNKS * Chunk.Y_SIZE;
            Z_SIZE = Z_CHUNKS * Chunk.Z_SIZE;

            redrawTime += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (redrawTime > REDRAW_INTERVAL)
            {
                for (int i = 0; i < 1; i++)
                {
                    if (updateQueue.Count > 0)
                    {
                        redrawTime = 0;
                        Chunk uC = updateQueue.Dequeue();
                        uC.UpdateMesh();
                    }
                }
            }

            if (isCurrent)
            {
                for (int y = 0; y < Y_CHUNKS; y++)
                {
                    for (int x = 0; x < X_CHUNKS; x++)
                    {
                        Chunk c = Chunks[x, y, 0];
                        if (!gameCamera.boundingFrustum.Intersects(c.boundingSphere))//.Transform(Matrix.CreateTranslation(-gameCamera.Position))))
                        {
                            if (c.Visible)
                            {
                                c.Visible = false;
                                //c.ClearMem();
                            }
                        }
                        else
                        {
                            if (!c.Visible)
                            {
                                c.Visible = true;
                                //if (c.Updated) c.UpdateMesh();
                                //c.UpdateMesh();
                            }
                        }
                    }
                }
            }
        }