Esempio n. 1
0
    void OnTriggerEnter(Collider collider)
    {
        soundsManager.PlayAlarm1();
        if (collider.tag == "Ball")
        {
            retainedBall             = collider.GetComponent <Rigidbody>();
            retainedBall.isKinematic = true;
            retainedBall.velocity    = Vector3.zero;
            _scoreManager.AddScore(ScoreManager.RETAINER_SCORE);
            if (_missionManager.GetCurrentState() == MissionManager.MissionState.LOCK_BALL)
            {
                // Ball locked for multiball, launch a new ball
                _missionManager.Process(MissionManager.MissionEvent.BALL_LOCKED);
                _lockedBalls.Enqueue(retainedBall);

                if (_missionManager.GetCurrentState() == MissionManager.MissionState.MULTIBALL)
                {
                    Invoke("ReleaseRetainedBall", 1f);
                    Invoke("ReleaseRetainedBall", 6f);
                    Invoke("ReleaseRetainedBall", 11f);
                }
                else
                {
                    Invoke("NewBall", 1f);
                }
            }
            else
            {
                Invoke("ReleaseBall", 1f);
            }
        }
    }