Exemplo n.º 1
0
    /// <summary>
    /// Returns whether the widget should be currently highlighted as far as the UICamera knows.
    /// </summary>

    static public bool IsHighlighted(GameObject go)
    {
        for (int i = mHighlighted.Count; i > 0;)
        {
            Highlighted hl = mHighlighted[--i];
            if (hl.go == go)
            {
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 2
0
        public void ResetHighlights()
        {
            lock (_providers)
            {
                Highlighting?.Invoke(this, EventArgs.Empty);

                foreach (var provider in _providers)
                {
                    provider.ResetHighlight();
                }

                Highlighted?.Invoke(this, EventArgs.Empty);
            }
        }
        public void ResetHighlights()
        {
            lock (_providers)
            {
                Highlighting.SafeInvoke(this);

                foreach (var provider in _providers)
                {
                    provider.ResetHighlight();
                }

                Highlighted.SafeInvoke(this);
            }
        }
Exemplo n.º 4
0
    public static bool IsHighlighted(GameObject go)
    {
        int num = mHighlighted.Count;

        while (num > 0)
        {
            Highlighted highlighted = mHighlighted[--num];
            if (highlighted.go == go)
            {
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Name != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Name) : 0);
         hashCode = (hashCode * 397) ^ (Analyzer != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Analyzer) : 0);
         hashCode = (hashCode * 397) ^ SortOption.GetHashCode();
         hashCode = (hashCode * 397) ^ Highlighted.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)MapReduceOperation;
         hashCode = (hashCode * 397) ^ (int)Storage;
         hashCode = (hashCode * 397) ^ (int)Indexing;
         hashCode = (hashCode * 397) ^ (int)TermVector;
         return(hashCode);
     }
 }
        public void HighlightSearchables(IEnumerable <object> searchables)
        {
            lock (_providers)
            {
                Highlighting.SafeInvoke(this);

                foreach (var searchable in searchables)
                {
                    foreach (var provider in _providers)
                    {
                        provider.HighlightSearchable(searchable);
                    }
                }

                Highlighted.SafeInvoke(this);
            }
        }
Exemplo n.º 7
0
        public void HighlightSearchables(IEnumerable <object> searchables)
        {
            lock (_providers)
            {
                Highlighting?.Invoke(this, EventArgs.Empty);

                foreach (var searchable in searchables)
                {
                    foreach (var provider in _providers)
                    {
                        provider.HighlightSearchable(searchable);
                    }
                }

                Highlighted?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 8
0
 private static void Highlight(GameObject go, bool highlighted)
 {
     if (go != null)
     {
         int count = mHighlighted.Count;
         while (count > 0)
         {
             Highlighted item = mHighlighted[--count];
             if ((item != null) && (item.go != null))
             {
                 if (item.go == go)
                 {
                     if (highlighted)
                     {
                         item.counter++;
                         return;
                     }
                     if (--item.counter < 1)
                     {
                         mHighlighted.Remove(item);
                         Notify(go, "OnHover", false);
                     }
                     return;
                 }
             }
             else
             {
                 mHighlighted.RemoveAt(count);
             }
         }
         if (highlighted)
         {
             Highlighted highlighted3 = new Highlighted {
                 go      = go,
                 counter = 1
             };
             mHighlighted.Add(highlighted3);
             Notify(go, "OnHover", true);
         }
     }
 }
Exemplo n.º 9
0
    /// <summary>
    /// Apply or remove highlighted (hovered) state from the specified object.
    /// </summary>

    static void Highlight(UIReceiver go, bool highlighted)
    {
        if (go != null)
        {
            for (int i = mHighlighted.Count; i > 0;)
            {
                Highlighted hl = mHighlighted[--i];

                if (hl == null || hl.go == null)
                {
                    mHighlighted.RemoveAt(i);
                }
                else if (hl.go == go)
                {
                    if (highlighted)
                    {
                        ++hl.counter;
                    }
                    else if (--hl.counter < 1)
                    {
                        mHighlighted.Remove(hl);
                        go.OnHover(false);
//						Notify(go, "OnHover", false);
                    }
                    return;
                }
            }

            if (highlighted)
            {
                Highlighted hl = new Highlighted();
                hl.go      = go;
                hl.counter = 1;
                mHighlighted.Add(hl);
//				Notify(go, "OnHover", true);
                go.OnHover(true);
            }
        }
    }
Exemplo n.º 10
0
    private static void Highlight(GameObject go, bool highlighted)
    {
        if (!(go != null))
        {
            return;
        }
        int num = mHighlighted.Count;

        while (num > 0)
        {
            Highlighted highlighted2 = mHighlighted[--num];
            if (highlighted2 == null || highlighted2.go == null)
            {
                mHighlighted.RemoveAt(num);
            }
            else if (highlighted2.go == go)
            {
                if (highlighted)
                {
                    highlighted2.counter++;
                }
                else if (--highlighted2.counter < 1)
                {
                    mHighlighted.Remove(highlighted2);
                    Notify(go, "OnHover", false);
                }
                return;
            }
        }
        if (highlighted)
        {
            Highlighted highlighted3 = new Highlighted();
            highlighted3.go      = go;
            highlighted3.counter = 1;
            mHighlighted.Add(highlighted3);
            Notify(go, "OnHover", true);
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// Apply or remove highlighted (hovered) state from the specified object.
    /// </summary>

    static void Highlight(GameObject go, bool highlighted)
    {
        if (go != null)
        {
            for (int i = mHighlighted.Count; i > 0;)
            {
                Highlighted hl = mHighlighted[--i];

                if (hl == null || hl.go == null)
                {
                    mHighlighted.RemoveAt(i);
                }
                else if (hl.go == go)
                {
                    if (highlighted)
                    {
                        ++hl.counter;
                    }
                    else if (--hl.counter < 1)
                    {
                        mHighlighted.Remove(hl);
                        go.SendMessage("OnHover", false, SendMessageOptions.DontRequireReceiver);
                    }
                    return;
                }
            }

            if (highlighted)
            {
                Highlighted hl = new Highlighted();
                hl.go      = go;
                hl.counter = 1;
                mHighlighted.Add(hl);
                go.SendMessage("OnHover", true, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Exemplo n.º 12
0
        private static void InteractiveMain()
        {
            var useColoredInput = !HasFlag("--no-color");

            if (useColoredInput)
            {
                _readLine = () => Highlighted.ReadLine(ref _highlighter);

                Console.CancelKeyPress += (sender, eventArgs) => Console.ResetColor();
            }
            else
            {
                _readLine = Console.ReadLine;
            }

            _input = new Queue <char>();
            _first = true;

            var state = CreateState(true, out var options);

            while (true)
            {
                try
                {
                    options.FirstLineNumber = _line + 1;

                    foreach (var program in MondProgram.CompileStatements(ConsoleInput(), "stdin", options))
                    {
                        InteractiveRun(state, program);
                    }
                }
                catch (Exception e)
                {
                    PrintException(e);
                }
            }
        }
Exemplo n.º 13
0
	/// <summary>
	/// Apply or remove highlighted (hovered) state from the specified object.
	/// </summary>

	static void Highlight (GameObject go, bool highlighted)
	{
		if (go != null)
		{
			for (int i = mHighlighted.Count; i > 0; )
			{
				Highlighted hl = mHighlighted[--i];

				if (hl == null || hl.go == null)
				{
					mHighlighted.RemoveAt(i);
				}
				else if (hl.go == go)
				{
					if (highlighted)
					{
						++hl.counter;
					}
					else if (--hl.counter < 1)
					{
						mHighlighted.Remove(hl);
						Notify(go, "OnHover", false);
					}
					return;
				}
			}

			if (highlighted)
			{
				Highlighted hl = new Highlighted();
				hl.go = go;
				hl.counter = 1;
				mHighlighted.Add(hl);
				Notify(go, "OnHover", true);
			}
		}
	}
Exemplo n.º 14
0
    /// <summary>
    /// Apply or remove highlighted (hovered) state from the specified object.
    /// </summary>
    static void Highlight(GameObject go, bool highlighted)
    {
        if (go != null)
        {
            for (int i = mHighlighted.Count; i > 0; )
            {
                Highlighted hl = mHighlighted[--i];

                if (hl == null || hl.go == null)
                {
                    mHighlighted.RemoveAt(i);
                }
                else if (hl.go == go)
                {
                    if (highlighted)
                    {
                        ++hl.counter;
                    }
                    else if (--hl.counter < 1)
                    {
                        mHighlighted.Remove(hl);
                        go.SendMessage("OnHover", false, SendMessageOptions.DontRequireReceiver);
                    }
                    return;
                }
            }

            if (highlighted)
            {
                Highlighted hl = new Highlighted();
                hl.go = go;
                hl.counter = 1;
                mHighlighted.Add(hl);
                go.SendMessage("OnHover", true, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Exemplo n.º 15
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gameState = GameState.Menu;

            // Set the previous keyboard state variable to what the current keyboard state is (which is nothing)
            _prevKbState = Keyboard.GetState();

            _Extraction = new GamePiece(400, 560, 256, 256);

            // Set the button state to hightlight the "Play Button"
            buttonState = Highlighted.Play;

            // Create height and width varibles that can be used throughout the class
            gameHeight = graphics.PreferredBackBufferHeight;
            gameWidth = graphics.PreferredBackBufferWidth;

            // Set all of the Human values:
            _p = new Player(GameVariables.playerStartX, GameVariables.playerStartY, GameVariables.spriteWidth, GameVariables.spriteHeight);    // The actual Player
            humanStep = GameVariables.stepSpeed;                                                           // The rate at which the player will take a step

            zombieStep = GameVariables.stepSpeed;
            //The HUD rectangle object
            _h = new GamePiece(-9, -1, 480, 110);
            scoreTimer = 0;
            // Create the map objects (It is important to note that the first digit is the Y value, while the second is the X)
            mt00 = new MapTile(3, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("00"));
            mt01 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("01"));
            mt02 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("02"));
            mt03 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("03"));
            mt04 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("04"));
            mt05 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("05"));
            mt06 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("06"));
            mt07 = new MapTile(1, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("07"));

            //mt02 = new MapTile(2, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("grass"));
            //mt03 = new MapTile(5, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("grass"));
            mt10 = new MapTile(2, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("10"));
            mt11 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("11"));
            mt12 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("12"));
            mt13 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("13"));
            mt14 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("14"));
            mt15 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("15"));
            mt16 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("16"));
            mt17 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("17"));

            //mt12 = new MapTile(0, 2, gameWidth, gameHeight, this.Content.Load<Texture2D>("road"));
            mt20 = new MapTile(2, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("20"));
            mt21 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("21"));
            mt22 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("22"));
            mt23 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("23"));
            mt24 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("24"));
            mt25 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("25"));
            mt26 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("26"));
            mt27 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("27"));

            mt30 = new MapTile(2, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("30"));
            mt31 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("31"));
            mt32 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("32"));
            mt33 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("33"));
            mt34 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("34"));
            mt35 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("35"));
            mt36 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("36"));
            mt37 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("37"));

            mt40 = new MapTile(2, 1, gameWidth, gameHeight, this.Content.Load<Texture2D>("40"));
            mt41 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("41"));
            mt42 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("42"));
            mt43 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("43"));
            mt44 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("44"));
            mt45 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("45"));
            mt46 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("46"));
            mt47 = new MapTile(3, 0, gameWidth, gameHeight, this.Content.Load<Texture2D>("47"));

            // Then add them to the list to reference by number
            listofMaptiles = new List<MapTile>();
            listofMaptiles.Add(mt00);
            listofMaptiles.Add(mt01);
            listofMaptiles.Add(mt02);
            listofMaptiles.Add(mt03);
            listofMaptiles.Add(mt04);
            listofMaptiles.Add(mt05);
            listofMaptiles.Add(mt06);
            listofMaptiles.Add(mt07);

            //listofMaptiles.Add(mt03);

            listofMaptiles.Add(mt10);
            listofMaptiles.Add(mt11);
            listofMaptiles.Add(mt12);
            listofMaptiles.Add(mt13);
            listofMaptiles.Add(mt14);
            listofMaptiles.Add(mt15);
            listofMaptiles.Add(mt16);
            listofMaptiles.Add(mt17);

            listofMaptiles.Add(mt20);
            listofMaptiles.Add(mt21);
            listofMaptiles.Add(mt22);
            listofMaptiles.Add(mt23);
            listofMaptiles.Add(mt24);
            listofMaptiles.Add(mt25);
            listofMaptiles.Add(mt26);
            listofMaptiles.Add(mt27);

            listofMaptiles.Add(mt30);
            listofMaptiles.Add(mt31);
            listofMaptiles.Add(mt32);
            listofMaptiles.Add(mt33);
            listofMaptiles.Add(mt34);
            listofMaptiles.Add(mt35);
            listofMaptiles.Add(mt36);
            listofMaptiles.Add(mt37);

            listofMaptiles.Add(mt40);
            listofMaptiles.Add(mt41);
            listofMaptiles.Add(mt42);
            listofMaptiles.Add(mt43);
            listofMaptiles.Add(mt44);
            listofMaptiles.Add(mt45);
            listofMaptiles.Add(mt46);
            listofMaptiles.Add(mt47);
            // And also to a dictionary for reference by name for their number that references which
            // Maptile its connected to
            dictionaryofMaptiles = new Dictionary<MapTile, int>();
            for (int i = 0; i < listofMaptiles.Count; i++)
            {
                dictionaryofMaptiles.Add(listofMaptiles[i], i);
            }

            // Set the current maptile
            currentMaptile = listofMaptiles[0];

            // Method where you can connect all of the barriers to a map tile
            SetUpBarrierConnections();

            //making the lsit of zombies
            _zs = new List<Zombie>();
            foreach (Zombie z in currentMaptile.GetSetZombieList)
            {
                _zs.Add(z);
            }

            //Bullet stuffs
            listBullet = new List<Bullet>();
            _b = new Bullet();
            bulletTimer = GameVariables.bTimer;

            //changing how much ammo
            ammo = 20;

            dcs = new List<DartCollectible>();
            foreach (DartCollectible dc in currentMaptile.GetSetDartCollectibles)
            {
                dcs.Add(dc);
            }

            //making the start score 0
            score = 0;
            //CheckExternal();
            base.Initialize();
        }
Exemplo n.º 16
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            // Puts whatever the current keyboard state is into this variable to be used later
            _kbstate = Keyboard.GetState();
            _gpstate = GamePad.GetState(PlayerIndex.One);
                    if (bulletTimer < GameVariables.bTimer)
                    {
                        bulletTimer += gameTime.ElapsedGameTime.TotalSeconds;
                        if (bulletTimer >= GameVariables.bTimer)
                        {
                            bulletTimer = GameVariables.bTimer;
                        }
                    }
            // Finite state machine for the menu, the game, the pause screen,
            // and the game over screen
            switch (gameState)
            {
                #region The Start Menu

                case GameState.Menu:
                    switch (buttonState)                // Press button to alter which item is highlighted to
                    {                                   // to change where player will go on the menu
                        // If the "Play" button is highlighted
                        case Highlighted.Play:
                            {
                                if (SingleKeyPress(Keys.D) || _gpstate.ThumbSticks.Left.X == 1 || _gpstate.DPad.Right == ButtonState.Pressed)             // Press "D" to move right to the Credits option
                                    if (bulletTimer == GameVariables.bTimer)
                                    {
                                        buttonState = Highlighted.Credits;
                                    }

                                if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)         // Press "Enter" to start the game
                                    gameState = GameState.GameManager;
                                break;
                            }

                        // If the "Credits" button is highlighted
                        case Highlighted.Credits:
                            {
                                if (SingleKeyPress(Keys.D) || _gpstate.ThumbSticks.Left.X == 1 || _gpstate.DPad.Right == ButtonState.Pressed)             // Press "D" to move right to the Quit option
                                    buttonState = Highlighted.Quit;

                                else if (SingleKeyPress(Keys.A) || _gpstate.ThumbSticks.Left.X == -1 || _gpstate.DPad.Left == ButtonState.Pressed)        // Press "A" to move left to the Play option
                                    buttonState = Highlighted.Play;

                                if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)         // Press "Enter" to enter the credits menu
                                    gameState = GameState.Credits;
                                break;
                            }

                        // If the "Quit" button is highlighted
                        case Highlighted.Quit:
                            {
                                if (SingleKeyPress(Keys.A) || _gpstate.ThumbSticks.Left.X == -1 || _gpstate.DPad.Left == ButtonState.Pressed)             // Press "A" to move Left to the Credits option
                                    buttonState = Highlighted.Credits;

                                if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)         // Press "Enter" to quit the game
                                    this.Exit();
                                break;
                            }
                    }
                    break;

                #endregion

                 #region The Game

                case GameState.GameManager:
                    MediaPlayer.Pause();                                                        // Stop the music from playing from the menu
                    timer -= gameTime.ElapsedGameTime.TotalSeconds;                             // Start the timer up for later use
                    if (SingleKeyPress(Keys.Escape) || SingleKeyPress(Keys.P) || _gpstate.Buttons.Start == ButtonState.Pressed)
                    {
                        // If "P" or "Escape" is press opent he pause menu
                        gameState = GameState.Pause;
                    }

                    // To move the player
                    if (_kbstate.IsKeyDown(Keys.W) || _gpstate.ThumbSticks.Left.Y > 0 || _gpstate.DPad.Up == ButtonState.Pressed)                 // Press "W" to move up
                    {
                        _p.YValue -= _p.moveSpeed;
                        _p.DState = GamePiece.Direction.Up;
                    }

                    if (_kbstate.IsKeyDown(Keys.A) || _gpstate.ThumbSticks.Left.X < 0 || _gpstate.DPad.Left == ButtonState.Pressed)                 // Press "A" to move left
                    {
                        _p.XValue -= _p.moveSpeed;
                        _p.DState = GamePiece.Direction.Left;
                    }

                    if (_kbstate.IsKeyDown(Keys.S) || _gpstate.ThumbSticks.Left.Y < 0 || _gpstate.DPad.Down == ButtonState.Pressed)                 // Press "S" to move down
                    {
                        _p.YValue += _p.moveSpeed;
                        _p.DState = GamePiece.Direction.Down;
                    }

                    if (_kbstate.IsKeyDown(Keys.D) || _gpstate.ThumbSticks.Left.X > 0 || _gpstate.DPad.Right == ButtonState.Pressed)                 // Press "D" to move right
                    {
                        _p.XValue += _p.moveSpeed;
                        _p.DState = GamePiece.Direction.Right;
                    }

                    if (bulletTimer == GameVariables.bTimer)
                    {
                        if (SingleKeyPress(Keys.Space) || _gpstate.Triggers.Right == 1)
                        {
                            if (ammo > 0)
                            {
                                _b.Active = true;
                                AddProjectile(new Vector2(_p.XValue, _p.YValue));
                                ammo--;
                            }
                        }
                        bulletTimer = 0;
                        //bulletTimer -= gameTime.ElapsedGameTime.TotalSeconds;
                    }
                    foreach (DartCollectible dc in dcs)
                    {
                        if (_p.CheckCollision(dc) == true && dc.GetSetCollected != true && ammo +5 <= 20 )
                        {
                            ammo += GameVariables.dartCollectibleWorth;
                            dc.GetSetCollected = true;
                        }
                    }
                    updateScore();
                    //troll code
                    //if (_kbstate.IsKeyDown(Keys.Space))
                    //{
                    //    AddProjectile(new Vector2(_p.XValue, _p.YValue));
                    //{

                    //makes sure bullets dont fly off the screen
                    UpdateProjectiles();

                    //checks if bullets collide with zombies
                    bulletCollision();

                    //Screen"wrap", more like a big wall
                    ScreenWrap();
                    ScreenWall(_p);
                    // For each zombie activate their AI's and make sure they don't run into one another
                    for (int i = 0; i < _zs.Count; i++)
                    {
                        _zs.ElementAt(i).AI(_p, gameTime.ElapsedGameTime.TotalSeconds);
                        ScreenWall(_zs.ElementAt(i));
                        for (int j = 0; j < _zs.Count; j++)
                        {
                            if (j != i)
                            {
                                _zs.ElementAt(i).HitOtherZomibe(_zs.ElementAt(j));
                            }
                        }
                    }

                    //***game over condition(s) goes here***
                    if (score >= 300 && extracted == false)
                    {
                        extraction = true;
                        currentMaptile.extraction = true;
                    }
                    if (extraction == true)
                    {
                        currentMaptile.GetSetZombieList.Clear();
                        currentMaptile.SpawnZombies(10);

                        foreach (Zombie z in currentMaptile.GetSetZombieList)
                        {
                            _zs.Add(z);
                        }
                        extracted = true;
                        extraction = false;
                    }

                    #if DEBUG
                    if (SingleKeyPress(Keys.NumPad0) == true)
                    {
                        gameState = GameState.GameOver;
                    }
                    #endif
                    break;

                #endregion

                #region The Pause Menu

                case GameState.Pause:
                    switch (highlight)
                    {
                        // If the Resume button is highlighted
                        case Pause.Resume:
                            {
                                if (SingleKeyPress(Keys.D) || _gpstate.ThumbSticks.Left.X == 1 || _gpstate.DPad.Right == ButtonState.Pressed)                 // Press "D" to move right to the Quit option
                                    highlight = Pause.Quit;

                                if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)             // Press "Enter" to go back to the game
                                    gameState = GameState.GameManager;

                                break;
                            }

                        // If the Quit button is highlighted
                        case Pause.Quit:
                            {
                                if (SingleKeyPress(Keys.A) || _gpstate.ThumbSticks.Left.X == -1 || _gpstate.DPad.Left == ButtonState.Pressed)                 // Press "A" to move left to the Resume option
                                    highlight = Pause.Resume;

                                if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)             // Press "Enter" to exit the game
                                {
                                    Reset();                                // Reset the game before exiting
                                    gameState = GameState.Menu;
                                }
                                break;
                            }
                    }
                    break;

                #endregion

                //***pust to options conditions here***//
                #region The GameOver Screen

                case GameState.GameOver:
                    if (SingleKeyPress(Keys.Enter) || _gpstate.Buttons.Start == ButtonState.Pressed || _gpstate.Buttons.A == ButtonState.Pressed)
                    {
                        //reset the values of the game
                        Reset();
                        gameState = GameState.Menu;
                    }
                    //***quick quit from game over conditons could go here if needed***//
                    break;

                #endregion

                #region The Credits Screen

                case GameState.Credits:
                    if (SingleKeyPress(Keys.Escape) || _gpstate.Buttons.B == ButtonState.Pressed || _gpstate.Buttons.Back == ButtonState.Pressed)        // Press "Escape" to exit the Credits screen
                    {
                        gameState = GameState.Menu;
                    }
                    break;

                #endregion
            }

            // Set the current keyboard state into the previous keyboard variable
            _prevKbState = _kbstate;

            base.Update(gameTime);
        }
Exemplo n.º 17
0
 public static void CallHighlightIncomplete()
 {
     Highlighted?.Invoke();
 }