Пример #1
0
    ////////////////////////////////////////////////////////////////

    public override void Tick()
    {
        if (m_PlayerController == null)
        {
            // Happens when no level is loaded
            return;
        }

        ////////////////////////////////////////////////////////////////

        if (m_IsResetting)
        {
            return;
        }

        ////////////////////////////////////////////////////////////////

        if (GameCore.Get().GetManager <PhysicsManager>().IsPhysicsSimulationPaused())
        {
            return;
        }

        ////////////////////////////////////////////////////////////////

        // Debug: Tick only every x ticks!
        if (GameCore.Get().GetCurrentTickCalls() % m_Debug_UpdatePlayerEvery != 0)
        {
            return;
        }

        ////////////////////////////////////////////////////////////////

        PlokothInput input = GameCore.Get().GetInput();

        if (Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.JoystickButton6))
        {
            StatisticManager.Get().ToggleDrawStats();
        }

        ////////////////////////////////////////////////////////////////
        // Shall we start the game?

        if (m_GameState == GameState.Pregameplay)
        {
            bool startGameplay = Input.anyKeyDown || input.Player.Jump.ReadValue <float>() != 0.0f || input.Player.Dash.ReadValue <float>() != 0.0f ||
                                 input.Player.StickDirection.ReadValue <Vector2>().x != 0.0f || input.Player.StickDirection.ReadValue <Vector2>().y != 0.0f;

            if (!startGameplay)
            {
                return;
            }

            m_GameState = GameState.Cutscene;

            ////////////////////////////////////////////////////////////////

            LogoFadeHandler introLogo = GameObject.FindObjectOfType <LogoFadeHandler>();
            if (!introLogo)
            {
                Debug.LogError("Could not find introLogo object");
                return;
            }

            introLogo.StartLogoFade();
        }

        if (m_GameState == GameState.Cutscene)
        {
            return;
        }

        ////////////////////////////////////////////////////////////////

        m_PlayerController.Tick();
        TickPlatforms();
        TickSpawnPoints();
        TickBlobs();
        TickResetPlants();

        if (m_CurrentPlayerSpawnPoint != null && m_DrawCurrentSpawnID)
        {
            DebugDrawingInterface.DrawPersistentSSText("SavePoint " + m_CurrentPlayerSpawnPoint._LevelID.ToString() + "_" + m_CurrentPlayerSpawnPoint.Index, new Vector2(Screen.width - 200, 5), Color.white, m_Debug_UpdatePlayerEvery);
        }
    }