Ejemplo n.º 1
0
        public void MixingSlabs()
        {
            IsMixing = true;

            int index = 0;
            int start = Player.Score + 1;
            int count = _countSpawned;

            int[] replacedNumbers = Enumerable.Range(start, count).ToArray();

            replacedNumbers.GenerateEnum(0, count);

            var search = Slabs.ToList().Where(x => x.IsAlive == true);

            foreach (var slab in search)
            {
                slab.SetupNewIndex(replacedNumbers[index]);
                index++;
            }

            IsMixing = false;
        }
Ejemplo n.º 2
0
        public void OnSlabClicked(int index)
        {
            if (!IsGameStart)
            {
                IsGameStart = true;
            }

            var slab = Slabs.ToList().Where(x => x.Index == index).SingleOrDefault();

            if (_currentIndex == index)
            {
                slab.Kill();

                _countSpawned--;
                _currentIndex++;
                Player.AddScore(1);

                if (Player.Score > 0 && Player.Score % 10 == 0)
                {
                    MixingSlabs();
                }

                //if(_countSpawned < 10 && Random.Range(0, 100) < 20)
                //    TeleportSlabs();

                return;
            }
            else if (slab.CanInteract)
            {
                Player.ApplyDamageToHealth(1);

                if (Player.HealthPoint == 0)
                {
                    Lose();
                }
            }
        }