Esempio n. 1
0
    private IEnumerator MoveHoleToNextStage(Transform holeTransform)
    {
        TouchController.instance.Deactivate();
        DeactivateFirstStageObstacles();
        OpenGates();

        float playgroundCenter   = GroundGenerator.PlaygroundCenter;
        WaitForFixedUpdate delay = new WaitForFixedUpdate();

        while (Mathf.Abs(holeTransform.position.x - playgroundCenter) > 0.01f)
        {
            holeTransform.position = Vector3.MoveTowards(holeTransform.position, holeTransform.position.SetX(playgroundCenter), 2f * Time.fixedDeltaTime);
            GroundGenerator.UpdateGround();

            yield return(delay);
        }

        HoleBehabiour.EnableAroundHoleMesh();
        holeTransform.position = holeTransform.position.SetX(playgroundCenter);

        float nextStageStartZ = GroundGenerator.PLAYGROUND_HEIGHT + GroundGenerator.GROUNDS_OFFSET + GroundGenerator.HOLE_INITIAL_OFFSET_Z;

        CameraController.instance.MoveToSecondStage();
        GroundGenerator.stopVerticalMeshGen = true;

        while (Mathf.Abs(holeTransform.position.z - nextStageStartZ) > 0.01f)
        {
            holeTransform.position = Vector3.MoveTowards(holeTransform.position, holeTransform.position.SetZ(nextStageStartZ), 4f * Time.fixedDeltaTime);
            GroundGenerator.UpdateGround();

            GroundGenerator.UpdateConnectingPath();

            yield return(delay);
        }

        ActivateFirstStageObstacles();
        HoleBehabiour.DisableAroundHoleMesh();
        GameController.OnSecondStageReached();

        GroundGenerator.stopVerticalMeshGen = false;
        GroundGenerator.RecalculateNormals();
        GroundGenerator.UpdateGround();
    }
Esempio n. 2
0
 private void Awake()
 {
     instance = this;
 }