Exemple #1
0
        public GameScene(MyGame myGame, IGameFactory gameFactory, List <Block> blocks, Catcher catcher, int score)
        {
            _blocks  = blocks;
            _catcher = catcher;
            _score   = score;
            _myGame  = myGame;

            _gameFactory = gameFactory;

            _collisionDetection = new CollisionDetection();

            _collisionDetection.Hit += delegate(CollisionEventArgs e)
            {
                ++_score;
                _blocks.Remove(e.Block);
            };

            _collisionDetection.Hit += gameFactory.BlockHit;

            _collisionDetection.Miss += e => new NewRecordScene(_myGame, _score, _gameFactory.Difficulty);

            _scoreFont = _myGame.Content.Load <SpriteFont>("ScoreFont");

            _previousState = Keyboard.GetState();
        }
Exemple #2
0
 void GameOver()
 {
     Catcher.ClearCatcher();
     MoleSpawner.ClearHole();
     MoleSpawner.GameStop();
     //set HighScore
 }
Exemple #3
0
        void GameStart()
        {
            Game1_Leveling.ResetGame(gController.mainMenu.Item4.IsSelect);
//			MoleSpawner.ClearHole ();
            MoleSpawner.GameStart();
            Catcher.CreateCatcher(snailCount);
        }
Exemple #4
0
 void GameReset()
 {
     GlobalPause = false;
     MoleSpawner.GameStop();
     Catcher.ClearCatcher();
     MoleSpawner.ClearHole();
 }
Exemple #5
0
 public GameObjects(List <Block> blocks, Catcher catcher, int score, double timeSinceLastBlock, int blockInterval, Difficulties difficulty)
 {
     _blocks             = blocks;
     _catcher            = catcher;
     _score              = score;
     _timeSinceLastBlock = timeSinceLastBlock;
     _blockInterval      = blockInterval;
     _difficulty         = difficulty;
 }
Exemple #6
0
        public static void CreateCatcher(int number)
        {
            GameObject prefab = GlobalGuage.GetCatcherPrefab();

            for (int i = 0; i < number; i++)
            {
                GameObject snail = (GameObject)GameObject.Instantiate(prefab);
                Catcher    ca    = snail.GetComponent <Catcher>();
                ca.setLevel();
                //set random position
                CatcherList.Add(ca);
            }
        }
Exemple #7
0
        IEnumerator DestroyHole()
        {
            IsPop = false;
            LockOn.SetActive(false);
            MoleAnimator = GetComponent <Animator> ();
            GetComponent <AudioSource>().PlayOneShot(hitSound[Random.Range(0, 2)]);
            MoleAnimator.Play("HoleTouch");
            if (type == MoleType.MOLE_RIGHT)
            {
                Catcher.BoringCatcher();
                //catcher make bored face here
                GameObject hpObj = GameObject.Instantiate(HPNortify) as GameObject;
                hpObj.SetActive(true);
                hpObj.transform.position = this.transform.position;
                hpObj.GetComponent <HPNotification>().DecreaseLife(1);
                GlobalGuage.DecreaseLife();
                GlobalGuage.BrokeCombo();
            }
            else
            {
                GlobalGuage.AddScore(Game1_Leveling.GetTouchMoleScore());
                GlobalGuage.AddCombo();
            }
            while ((MoleAnimator != null) && MoleAnimator.GetCurrentAnimatorStateInfo(0).IsName("HolePop"))
            {
                yield return(null);
            }
            if (MoleAnimator == null)
            {
                yield break;
            }
            yield return(StartCoroutine(Wait(MoleAnimator.GetCurrentAnimatorStateInfo(0).length)));

            MoleSpawner.DestroyHole(this);
            if (!IsLock)
            {
                MoleSpawner.ReleaseHole(this);
            }
        }
Exemple #8
0
        public void CheckCollision(List <Block> blocks, Catcher catcher)
        {
            if (blocks.Count == 0)
            {
                return;
            }

            // Only checks the lowest block
            Block b = blocks.First();

            if (b.Rectangle.Bottom > catcher.Rectangle.Top)
            {
                // Checks if whole block hits the right color
                if (b.Color.Equals(catcher.GetColorAtX(b.Rectangle.Left)) &&
                    b.Color.Equals(catcher.GetColorAtX(b.Rectangle.Right)))
                {
                    OnHit(new Vector2(b.Rectangle.Center.X, b.Rectangle.Bottom), b);
                }
                else
                {
                    OnMiss(new Vector2(b.Rectangle.Center.X, b.Rectangle.Bottom), b);
                }
            }
        }