示例#1
0
        public void Update()
        {
            if (_Player.CurrentBitmapSize() < 160)
            {
                if (SplashKit.Rnd() < 0.02)
                {
                    var snapper = new Snapper(_GameWindow, _Player);

                    _fishes.Add(snapper);
                }


                if (SplashKit.Rnd() < 0.01)
                {
                    var smallJellyfish = new SmallJellyfish(_GameWindow, _Player);

                    _fishes.Add(smallJellyfish);
                }

                if (SplashKit.Rnd() < 0.01)
                {
                    var salmon = new Guppy(_GameWindow, _Player);

                    var predetor = new Predetor(_GameWindow, _Player);

                    _fishes.Add(salmon);
                    _fishes.Add(predetor);
                }

                if (SplashKit.Rnd() < 0.002)
                {
                    var jellyfish = new Jellyfish(_GameWindow, _Player);

                    _fishes.Add(jellyfish);
                }

                if (SplashKit.Rnd() < 0.001)
                {
                    var bigPredator = new BigPredetor(_GameWindow, _Player);

                    _fishes.Add(bigPredator);
                }
            }
            //else
            //{
            //    var mermaid = new Mermaid(_GameWindow,_Player);

            //    _fishes.Add(mermaid);
            //}



            foreach (var fish in _fishes) //check the size of the player and fish
            {
                if (_Player.CheckScale() < fish._FishBitmap.CellHeight)
                {
                    fish.Update(_Player);  //if bigger then chase the player
                }
                else if (_Player.CheckScale() > fish._FishBitmap.CellHeight)
                {
                    fish.Update(_GameWindow);  // if small run away
                }
                else
                {
                    fish.Update(_Player);
                }
            }

            CheckCollisions();
        }