示例#1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (!ignoringCollisions)
        {
            if (collision.gameObject.tag == "RecordKiller")
            {
                IntegrityManager integrityManager;
                if (IntegrityManager.TryGetInstance(out integrityManager))
                {
                    integrityManager.KilledRecord(recordType);
                }

                Destroy(gameObject);
            }
            else if (CollidedWithBooth(collision))
            {
                if (activeAnimator != null)
                {
                    activeAnimator.GetComponent <Animator>().SetTrigger("OnBreak");
                }

                moveSpeed          = 0f;
                ignoringCollisions = true;
                colliderDebugObject.SetActive(false);

                if (recordType == RecordSpawner.RecordType.Bad)
                {
                    GameObject newBadRecordKillAnimation = Instantiate(badRecordKillAnimation);
                    newBadRecordKillAnimation.transform.position = transform.position + badRecordKillAnimationOffset;
                }
            }
        }
    }
示例#2
0
    private void TriggerButtonAPrompt()
    {
        buttonPromptA.gameObject.SetActive(true);
        IntegrityManager integrityManager;

        if (IntegrityManager.TryGetInstance(out integrityManager))
        {
            integrityManager.TurnOffTimerGameObjects();
        }
    }
示例#3
0
    public void TriggerDestroy()
    {
        IntegrityManager integrityManager;

        if (IntegrityManager.TryGetInstance(out integrityManager))
        {
            integrityManager.OnBarAnimationEnd();
        }

        Destroy(gameObject);
    }
示例#4
0
    private void Update()
    {
        IntegrityManager integrityManager;

        if (IntegrityManager.TryGetInstance(out integrityManager))
        {
            if (integrityManager.gameState != IntegrityManager.GameState.Paused)
            {
                CheckForRecordSpawn();
            }
        }
    }
示例#5
0
    private void LateUpdate()
    {
        IntegrityManager integrityManager;

        if (IntegrityManager.TryGetInstance(out integrityManager))
        {
            if (integrityManager.gameState != IntegrityManager.GameState.Paused)
            {
                transform.position += deltaMovement;
            }
        }
    }
示例#6
0
    private void MainMenuHandler()
    {
        // press Y
        if (player.GetButtonDown("Y"))
        {
            waitingForTransition = true;
            targetCameraPosition = leaderboardCameraPosition;
            buttonPromptABXY.SetTrigger("outTrigger");
            Invoke("TransitionToLeaderboard", transitionToLeaderboardWaitTime);
        }
        // press A or start - START GAME
        else if (player.GetButtonDown("Start Game"))
        {
            IntegrityManager integrityManager;
            if (IntegrityManager.TryGetInstance(out integrityManager))
            {
                tutorialUI.SetActive(false);

                if (credits.gameObject.activeInHierarchy)
                {
                    credits.SetTrigger("outTrigger");
                }

                if (buttonPromptABXY.gameObject.activeInHierarchy)
                {
                    buttonPromptABXY.SetTrigger("outTrigger");
                }

                integrityManager.StartIntegrityManager();
                SetMenuState(MenuState.Game);
            }
        }
        // press B
        else if (player.GetButtonDown("Resume"))
        {
            buttonPromptABXY.SetTrigger("outTrigger");
            targetCameraPosition = titleCameraPosition;
            Invoke("TransitionToTitle", transitionToTitleWaitTime);
        }
        else if (player.GetButtonDown("X"))
        {
            if (credits.gameObject.activeInHierarchy)
            {
                credits.SetTrigger("outTrigger");
            }
            else
            {
                credits.gameObject.SetActive(true);
                credits.SetTrigger("inTrigger");
            }
        }
    }
示例#7
0
    private void Update()
    {
        if (player.GetButtonDown("DPadRight") || (player.GetAxis("Left Leg Horizontal") > kMenuDeadZone && player.GetAxisPrev("Left Leg Horizontal") <= kMenuDeadZone))
        {
            MoveLetterInput(1);
        }
        else if (player.GetButtonDown("DPadLeft") || (player.GetAxis("Left Leg Horizontal") < -kMenuDeadZone && player.GetAxisPrev("Left Leg Horizontal") >= -kMenuDeadZone))
        {
            MoveLetterInput(-1);
        }
        else if (player.GetButtonDown("Start Game"))
        {
            if (currentInputState == InputState.fourthLetter)
            {
                LeaderboardDataManager leaderboardDataManager;
                if (LeaderboardDataManager.TryGetInstance(out leaderboardDataManager))
                {
                    string condensedString = firstLetter.character.text + secondLetter.character.text + thirdLetter.character.text + fourthLetter.character.text;
                    string scoreString     = scoreText.text;
                    for (int i = 0; i < 4 - (scoreText.text.Length - 1); i++)
                    {
                        scoreString += "0";
                    }
                    leaderboardDataManager.AddHighScore(condensedString, scoreString);
                }

                IntegrityManager integrityManager;
                if (IntegrityManager.TryGetInstance(out integrityManager))
                {
                    LeaderboardPositionManager leaderboardPositionManager;
                    if (LeaderboardPositionManager.TryGetInstance(out leaderboardPositionManager))
                    {
                        leaderboardPositionManager.SetTargetLeaderboardPosition(leaderboardPositionManager.showAllPosition);
                    }

                    integrityManager.EndGame();
                    GameManager gameManager;
                    if (GameManager.TryGetInstance(out gameManager))
                    {
                        gameManager.OnFinishedEnteringHighScore();
                    }
                    gameObject.SetActive(false);
                }
            }
            else
            {
                MoveLetterInput(1);
            }
        }
    }