/// <summary>
        /// Requests the next bomb to show up.
        /// </summary>
        protected virtual void GetNextBomb()
        {
            _oldBomb = _currentBomb;

            if (_bombQueue.Count != 0)
            {
                _currentBomb = _bombQueue.Dequeue();
                _currentBomb.AttachToConveyor(Room.GetNextConveyorNode());
            }
            else
            {
                _currentBomb = null;
            }

            if (_currentBomb != null)
            {
                //For any adaptations, let them know a bomb has started
                foreach (FactoryGameModeAdaptation adaptation in Adaptations)
                {
                    adaptation.OnStartBomb(_oldBomb, _currentBomb);
                }

                _currentBomb.BombConfigured();
            }

            Room.GetNextBomb();
        }
Beispiel #2
0
        private IEnumerator DelayCreateBomb()
        {
            yield return(new WaitForSeconds(0.2f));

            FactoryBomb nextBomb = AddAnotherBomb();

            nextBomb.SetupStartPosition(Room.InitialSpawn);
            _bombQueue.Enqueue(nextBomb);
        }
        protected FactoryBomb AddAnotherBomb()
        {
            Bomb        newBomb        = Room.CreateBombWithCurrentMission();
            FactoryBomb newFactoryBomb = newBomb.gameObject.AddComponent <FactoryBomb>();

            _bombs.Add(newFactoryBomb);

            return(newFactoryBomb);
        }
Beispiel #4
0
        private IEnumerator DelayDestroyBomb(FactoryBomb bomb)
        {
            if (bomb == null || bomb.InternalBomb == null)
            {
                yield break;
            }

            while (!bomb.Ended)
            {
                yield return(null);
            }

            DestroyBomb(bomb);
        }
        private void SetSelectableBomb(FactoryBomb bomb)
        {
            KTInputManager.Instance.ClearSelection();

            Selectable selectable = bomb?.Selectable;

            _roomChildren[_bombSelectableIndex] = selectable;

            KTInputManager.Instance.RootSelectable = _roomSelectable;
            KTInputManager.Instance.SelectableManager.ConfigureSelectableAreas(KTInputManager.Instance.RootSelectable);
            KTInputManager.Instance.SelectRootDefault();

            _roomSelectable.Init();
        }
        internal override void OnStartBomb(FactoryBomb previousBomb, FactoryBomb thisBomb)
        {
            if (previousBomb != null)
            {
                //Need to preserve the initial time value, otherwise 'remaining time' on the results screen is incorrectly adjusted
                FieldInfo initialTimeField = typeof(TimerComponent).GetField("initialTime", BindingFlags.NonPublic | BindingFlags.Instance);
                float     initialTime      = (float)initialTimeField.GetValue(previousBomb.Timer);

                thisBomb.Timer.SetTimeRemaing(previousBomb.Timer.TimeRemaining);

                //Set the initial time field back
                initialTimeField.SetValue(thisBomb.Timer, initialTime);
            }
        }
 /// <summary>
 /// Ends the 'old' bomb.
 /// </summary>
 /// <remarks>Invoked by animation event.</remarks>
 internal override void OnEndBomb()
 {
     _oldBomb?.EndBomb();
     _oldBomb = null;
 }
 protected void DestroyBomb(FactoryBomb bomb)
 {
     _bombs.Remove(bomb);
     Room.DestroyBomb(bomb.InternalBomb);
 }