public void BailWater()
    {
        if (floodController.currentPosition.y < floodController.waterOnDeck.y)
        {
            bucketStates.currentState = BucketStates.BucketState.Held;
            Debug.Log("No water to bail");
            return;
        }

        else if (floodController.currentPosition.y >= floodController.waterOnDeck.y)
        {
            timer -= Time.deltaTime;

            float inverseLerp = Mathf.InverseLerp(BAIL_TIMER, 0, timer);

            if (projector == null)
            {
                projector = playerController.transform.GetChild(2).transform.GetChild(1).GetComponent <Projector>();
            }
            projector.orthographicSize = inverseLerp * 2.15f;

            Debug.Log("Bail Timer");
            if (timer <= 0)
            {
                PS_splash.Play();
                floodController.BailWater();
                bucketStates.currentState = BucketStates.BucketState.Held;
                timer = BAIL_TIMER;
                projector.orthographicSize = 2.1f;
                projector = null;
            }
        }
    }
Example #2
0
 public void BailWater()
 {
     Debug.Log("Bailed the water");
     bucketState.currentState = BucketStates.BucketState.Held;
     floodController.BailWater();
 }