Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!reachedEndGoal)
        {
            if (!allObstaclesCompleted)
            {
                // when player reached waiting position
                if (playerMovement.ReachedDestination())
                {
                    // mark next obstacle
                    points[currentObstacleIndex].IsNextObstacle = true;
                    // test correctness
                    int correctness = points[currentObstacleIndex].rightCameraPerspective();
                    // if threshold reached move to next obstacle
                    if (correctness < this.threshold)
                    {
                        this.moveToNextObstacle();
                    }
                }
            }
            else
            {
                // when player reached the endpoint
                if (playerMovement.ReachedDestination())
                {
                    // set flag
                    reachedEndGoal = true;
                    // disable agent to move with boat
                    playerMovement.DisableAgent();
                    // set boat as parent to move player with boat
                    playerMovement.transform.parent = this.riseWater.boat;
                    // rise water to boat
                    this.riseWater.AccelerateRising();
                    // show message
                    playerMessage.FadeInMessage("Danke, dass du mich gerettet hast!", 5, 6);

                    uiManager.ShowVictory();
                }
            }

            if (WaterIsAbovePlayer())
            {
                uiManager.ShowGameOver();
                playerMovement.StopMoving();
            }
        }
    }