public override void Deactivate()
        {
            base.Deactivate();

            Viewscreen.EndSampoMode();

            Debug.Log("EndGameMode 2");
            _toyElevatorController.EndGameMode();
        }
        public override void Activate()
        {
            base.Activate();

            // When Sampo mode is activated, give extra balls thru the workshop.
            PinballManager.ActivateWorkshopExtraBalls();

            // Moved this here as this is probably the correct place.
            Viewscreen.StartSampoMode();

            _toyElevatorController.StartGameMode(State);
        }
예제 #3
0
        /// <summary>
        /// Deactivates the kantelehero panel minigame and all lights on it
        /// also reset all variables for the next round
        /// </summary>
        public void DeactivatePanel()
        {
            MusicPlayer.Instance.Unpause();
            _cameroController.MoveCurrentCamTo(CameraController.CameraPosition.Playfield, false);
            DeactivateAllMissLights();
            _leftTrigger.DeactivateLight();
            _rightTrigger.DeactivateLight();
            _kanteleLights.DeactivateAllObjects();
            _haukiKantele.DeactivateKantele();
            //Physics.gravity = new Vector3(0f, -98.1f, -65f);
            PanelActive = false;

            Viewscreen.EndKH();
        }
예제 #4
0
        private void Launch()
        {
            BallOnLauncher = false;
            SFXPlayer.Instance.Play(Sound.UkonKirves);
            _hitParticles.SetActive(true);
            PinballManager.Instance.SetPinballPhysicsEnabled(true);
            _pinball.AddImpulseForce(Vector3.forward * _launcherForce * _launcherForceMultiplier);
            _launchDone    = true;
            _launcherForce = _minForceTime;

            // 10 seconds of Shoot Again
            PinballManager.Instance.ActivateShootAgain(10);
            // No longer need to show launch prompt.
            Viewscreen.EndLaunch();
        }
        // All logic that makes the game mode change
        #region Game Mode Logic

        public void WorkshopKOHEntered()
        {
            if (GameMode != GameModeStateType.Sampo)
            {
                _workshopKOHEnteredNum++;

                // Starts the Sampo mode
                if (_workshopKOHEnteredNum >= _workshopKOHEnteredRequirement)
                {
                    StartGameMode(GameModeStateType.Sampo);
                    _workshopKOHEnteredNum = 0;
                }
                else
                {
                    Viewscreen.WorkShopEntered(_workshopKOHEnteredRequirement - _workshopKOHEnteredNum);
                }
            }
        }
예제 #6
0
        public void ResetGame()
        {
            _currentBallCount = _startingBallCount;
            Tilt       = false;
            Autosave   = false;
            ShootAgain = false;
            _extraBallSpawner.Deactivate();
            _status.ResetStatus();
            _resources   = 0;
            _pinballs    = new List <Pinball>(FindObjectsOfType <Pinball>());
            _activeBalls = _pinballs.Count;
            Debug.Log("Total balls : " + _currentBallCount.ToString());
            Debug.Log("Initial balls : " + _activeBalls.ToString());

            ResetAllPinballs();
            //SetPinballPhysicsEnabled(false);

            Viewscreen.BallCount(CurrentBallNumber);
        }
예제 #7
0
        public void StartLaunch(Pinball pinball)
        {
            BallOnLauncher = true;
            _hitParticles.SetActive(false);
            _pinball = pinball;
            _returnAxeToStartPosition = true;
            _hingejoint.useLimits     = true;
            _gatesClosed = false;
            if (_handler != null)
            {
                _handler.PathDeactivate();
            }

            foreach (SkillShotGate gate in _gates)
            {
                gate.OpenGate();
            }

            Viewscreen.StartLaunch();
        }
예제 #8
0
        private void RemoveBall(Pinball pinball)
        {
            if (!OutOfBalls)
            {
                // Returns the ball next to the launcher
                // and gets whether the ball is lost
                InstanceNextBall(pinball);

                _currentBallCount--;

                if (_currentBallCount == 1)
                {
                    if (GameManager.Instance.GameMode.State ==
                        GameModeStateType.Sampo)
                    {
                        GameManager.Instance.GameMode.
                        Owner.PerformTransition(GameModeStateType.Normal);

                        // TODO: Reset collectable chances
                    }
                }
                else if (OutOfBalls)
                {
                    Viewscreen.OutOfBalls();
                    Debug.Log("Out of balls - game over");
                    //GameManager.Instance.SaveOrRevertHighscores(true);

                    // The game is ended by ScreenState_Play
                }
                else
                {
                    Viewscreen.BallCount(CurrentBallNumber);
                    Debug.Log("Balls left: " +
                              _currentBallCount.ToString());
                }
            }
            else
            {
                Debug.Log("Out of balls");
            }
        }
예제 #9
0
        /// <summary>
        /// Starts the Kantelehero panel minigame
        /// </summary>
        public void ActivatePanel()
        {
            if (GameManager.Instance.GameMode.State == GameModeStateType.Sampo)
            {
                _haukiKantele.OpenDoor();
                return;
            }
            MusicPlayer.Instance.Pause();
            _cameroController.MoveCurrentCamTo(CameraController.CameraPosition.Kantele, false);
            //Physics.gravity = new Vector3(25f, -98.1f, -25f);
            PanelActive  = true;
            _spawnTimer  = 0;
            _currentNote = 0;
            _noteCount   = _notes.Count;
            CheckMissLights();
            _haukiKantele.ActivateKantele();
            _rightTrigger.ResetNoteNumber();
            _leftTrigger.ResetNoteNumber();
            _waitTimeElapsed = 0f;

            Viewscreen.StartKH();
        }
예제 #10
0
        public void AddScore(ScoreType scoreType, GameObject scoreObject = null)
        {
            if (GameManager.Instance.Screen.State != ScreenStateType.Play)
            {
                return;
            }
            int    _score   = 0;
            string _message = "";

            switch (scoreType)
            {
            case ScoreType.PopBumper:
                _score  += _popBumper;
                _message = "Bumber hit for {0} points.";
                break;

            case ScoreType.Slingshot:
                _score  += _slingshot;
                _message = "Slingshot hit for {0} points.";
                break;

            case ScoreType.Spinner:
                _score  += _spinner;
                _message = "Spinner gave you {0} points.";
                break;

            case ScoreType.DropTarget:
                _score  += _dropTarget;
                _message = "{0} points from the drop target.";
                break;

            case ScoreType.IlmarinenKOH:
                _score  += _ilmarinenKOH;
                _message = "The workshop gave {0} points.";
                break;

            case ScoreType.SwampKOH:
                _score  += _swampKOH;
                _message = "{0} points from the Swamp.";
                break;

            case ScoreType.TuonelaRollover:
                _score  += _tuonelaRollover * Rollover.ScoreMultiplier;
                _message = "Tuonela rollovers gave {0} points.";
                break;

            case ScoreType.Skillshot:
                _score  += _skillshot;
                _message = "Skill shot made for {0} points.";
                break;

            case ScoreType.CollectableGrain:
                _score  += _collectableGrain;
                _message = "{0} points from grain.";
                break;

            case ScoreType.CollectableSalt:
                _score  += _collectableSalt;
                _message = "{0} points from salt.";
                break;

            case ScoreType.CollectableGold:
                _score  += _collectableGold;
                _message = "{0} points from gold.";
                break;

            case ScoreType.KanteleBumper:
                _score  += _kanteleBumper;
                _message = "Kantele bumber hit for {0} points.";
                break;

            case ScoreType.KanteleLight:
                _score  += _kanteleLight;
                _message = "Kantele light gave {0} points.";
                break;

            case ScoreType.ShieldTarget:
                _score  += _shieldTarget;
                _message = "Shield target gave {0} points.";
                break;

            default:
                Debug.LogError("ScoreType not recognized.");
                _message = "Something broke. No score.";
                break;
            }

            //Check if it was an objective
            if (scoreObject != null)
            {
                if (ObjectiveManager.Instance.CheckObjective(scoreObject))
                {
                    _score = _score * 2;
                }
            }

            // To do: Apply possible score modifiers here.
            // VN : remember that some score modifiers are type dependent and go inside the switch statement.
            _score       = _score * ComboManager.Instance.ScoreMultiplier;
            _totalScore += _score;
            // Refactored the string processing to happen in the viewscreen class.
            // Why was I calling two functions that are always used together separately?
            Viewscreen.FormatScore(_totalScore, _score, _message);
            //Viewscreen.FormatScoreIncrement();

            _highscores.UpdateCurrentRanking(_totalScore);
        }
예제 #11
0
 public void ResetScore()
 {
     _totalScore = 0;
     Viewscreen.ResetScore();
 }
예제 #12
0
 // Use this for initialization
 void Awake()
 {
     _instance = this;
     _incrementVisibleCountdown = _incrementVisible;
 }