Exemplo n.º 1
0
        // Update
        public void Update(GameTime gameTime, Darwin darwin)
        {
            //testRun();
            base.Update(gameTime);

            if (this.isOnTop(darwin) && !darwin.isZombie())
            {
                darwin.setAbsoluteDestination(2, 2);
            }

            //Random rand1 = new Random();
            //Random rand2 = new Random();

            if (movecounter > ZOMBIE_MOVE_RATE)
            {
                if (isRangeDetectionAllowed() && isDarwinInRange(darwin) && !darwin.isZombie())
                {
                    moveTowardsDarwin(darwin);
                }
                else
                {
                    this.RandomWalk();
                }


                movecounter = 0;
            }
            movecounter++;
        }
Exemplo n.º 2
0
        public void Update(GameTime gameTime, KeyboardState ks, Darwin darwin)
        {
            base.Update(gameTime);
            // if we be a zombie, we cant use switches
            if (!darwin.isZombie() && this.canEventHappen())
            {
                this.setEventFalse();

                // grab us the current
                LegendOfDarwin.Darwin.Dir facing = darwin.facing;

                // check switch position in relation to darwin's position + facing direction
                switch (facing)
                {
                case (LegendOfDarwin.Darwin.Dir.Left):
                    if (((this.X + 1) == darwin.X) && (this.Y == darwin.Y))
                    {
                        toggleSwitch(ks);
                    }
                    break;

                case (LegendOfDarwin.Darwin.Dir.Right):
                    if (((this.X - 1) == darwin.X) && (this.Y == darwin.Y))
                    {
                        toggleSwitch(ks);
                    }
                    break;

                case (LegendOfDarwin.Darwin.Dir.Up):
                    if ((this.X == darwin.X) && ((this.Y + 1) == darwin.Y))
                    {
                        toggleSwitch(ks);
                    }
                    break;

                case (LegendOfDarwin.Darwin.Dir.Down):
                    if ((this.X == darwin.X) && ((this.Y - 1) == darwin.Y))
                    {
                        toggleSwitch(ks);
                    }
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public void Update(GameTime gameTime, KeyboardState ks, Darwin darwin)
        {
            base.Update(gameTime);
            // if we be a zombie, we cant use switches
            if (!darwin.isZombie() && this.canEventHappen())
            {
                this.setEventFalse();

                // grab us the current
                LegendOfDarwin.Darwin.Dir facing = darwin.facing;

                // check switch position in relation to darwin's position + facing direction 
                switch (facing)
                {
                    case (LegendOfDarwin.Darwin.Dir.Left):
                        if (((this.X + 1) == darwin.X) && (this.Y == darwin.Y))
                            toggleSwitch(ks);
                        break;
                    case (LegendOfDarwin.Darwin.Dir.Right):
                        if (((this.X - 1) == darwin.X) && (this.Y == darwin.Y))
                            toggleSwitch(ks);
                        break;
                    case (LegendOfDarwin.Darwin.Dir.Up):
                        if ((this.X == darwin.X) && ((this.Y + 1) == darwin.Y))
                            toggleSwitch(ks);
                        break;
                    case (LegendOfDarwin.Darwin.Dir.Down):
                        if ((this.X == darwin.X) && ((this.Y - 1) == darwin.Y))
                            toggleSwitch(ks);
                        break;
                }
            }
        }
Exemplo n.º 4
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    checkForGameOver(firstZombie);
                    checkForGameOver(fastZombie1);
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            secondStair.Update(gameTime, darwin);

            firstZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            firstZombie.Update(gameTime, darwin, brain);

            foreach (Leaf leaf in this.leaves)
            {
                leaf.Update(darwin);
            }

            fastZombie1.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            fastZombie1.Update(gameTime, darwin, brain);

            //secondZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            //secondZombie.Update(gameTime, darwin, brain);
            //thirdZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            //thirdZombie.Update(gameTime, darwin, brain);

            firstSwitch.Update(gameTime, ks, darwin);
            secondSwitch.Update(gameTime, ks, darwin);

            brain.Update(gameTime, ks, darwin);

            checkForSwitchToLevelFour();
            //checkForGameWin();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Exemplo n.º 5
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            // only check for deaths if neccessary
            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    checkForGameOver(firstZombie);
                    checkForGameOver(secondZombie);
                    checkForGameOver(thirdZombie);
                    checkForGameOver(fourthZombie);
                    checkForGameOver(fifthZombie);
                    checkForGameOver(sixthZombie);
                }
                checkForGameOver(vortex);

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);

            firstZombie.Update(gameTime, darwin, brain);
            secondZombie.Update(gameTime, darwin, brain);
            thirdZombie.Update(gameTime, darwin, brain);
            fourthZombie.Update(gameTime, darwin, brain);
            fifthZombie.Update(gameTime, darwin, brain);
            sixthZombie.Update(gameTime, darwin, brain);

            firstSwitch.Update(gameTime, ks, darwin);

            brain.Update(gameTime, ks, darwin);

            vortex.Update(gameTime, ks);
            vortex.CollisionWithZombie(firstZombie);
            vortex.CollisionWithZombie(secondZombie);
            vortex.CollisionWithZombie(thirdZombie);
            vortex.CollisionWithZombie(fourthZombie);
            vortex.CollisionWithZombie(fifthZombie);
            vortex.CollisionWithZombie(sixthZombie);
            vortex.CollisionWithBO(brain, board);

            potion.Update(gameTime, ks, darwin, zTime);

            //checkForGameWin();
            checkForSwitchToLevelTwo();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Exemplo n.º 6
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            // only check for deaths if neccessary
            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    if (firstZombie.isZombieAlive())
                    {
                        checkForGameOver(firstZombie);
                    }
                    if (secondZombie.isZombieAlive())
                    {
                        checkForGameOver(secondZombie);
                    }
                    if (thirdZombie.isZombieAlive())
                    {
                        checkForGameOver(thirdZombie);
                    }
                    if (fourthZombie.isZombieAlive())
                    {
                        checkForGameOver(fourthZombie);
                    }
                }
                if (darwin.isZombie())
                {
                    checkForGameOver(cannibalZombie);
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);

            firstZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            firstZombie.Update(gameTime, darwin);

            secondZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            secondZombie.Update(gameTime, darwin);

            thirdZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            thirdZombie.Update(gameTime, darwin);

            fourthZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            fourthZombie.Update(gameTime, darwin);

            cannibalZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            cannibalZombie.Update(gameTime, darwin);

            potion.Update(gameTime, ks, darwin, zTime);

            //checkForGameWin();
            if (isAllZombiesDead())
            {
                foreach (BasicObject bo in removableWalls)
                {
                    if (!board.isGridPositionOpen(bo))
                    {
                        board.setGridPositionOpen(bo);
                    }
                }
                if (playSound)
                {
                    revealSound.Play();
                    playSound = false;
                }
            }

            checkUpdateToLevelThree();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Exemplo n.º 7
0
        // Update
        public void Update(GameTime gameTime,Darwin darwin)
        {
            //testRun();
            base.Update(gameTime);

            if( this.isOnTop(darwin) && !darwin.isZombie())
            {
                darwin.setAbsoluteDestination(2, 2);
            }

            //Random rand1 = new Random();     
            //Random rand2 = new Random();

            if (movecounter > ZOMBIE_MOVE_RATE)
            {
                if (isRangeDetectionAllowed() && isDarwinInRange(darwin) && !darwin.isZombie())
                    moveTowardsDarwin(darwin);
                else
                    this.RandomWalk();


                movecounter = 0;
            }
            movecounter++;

        }