private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.name == "Cup")
     {
         cup = null;
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Cup")
     {
         Debug.Log("we got the cup");
         cup = other.GetComponent <CupScript>();
     }
 }
Example #3
0
 // Start is called before the first frame update
 void Start()
 {
     bs     = GameObject.Find("Button_colliders").GetComponent <buttonscript>();
     cs     = GameObject.Find("cup").GetComponent <CupScript>();
     ss     = GameObject.Find("Sink").GetComponent <SinkScript>();
     water  = GameObject.Find("Water");
     coldPS = GameObject.Find("ColdTapPS");
     coldPS.SetActive(false);
     hotPS = GameObject.Find("HotTapPS");
     hotPS.SetActive(false);
     water.SetActive(false);
     pz  = GameObject.Find("Mercury_zone").GetComponent <Planet_zones>();
     pzN = GameObject.Find("Neptune_zone").GetComponent <Planet_zones>();
 }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        if (!showBigText)
        {
            cup = check.cup;

            if (cup != null)
            {
                SellJuice();
            }

            timeRemaining -= Time.deltaTime;

            timeText.text  = "Day " + day + "   Time: " + timeRemaining.ToString("F0") + "s";
            moneyText.text = "Money: $" + money.ToString("F2");
            goalText.text  = "Goal: $" + goal.ToString("F2");

            CheckWin();
        }
        else
        {
            timedPause += Time.deltaTime;

            if (timedPause > 3.0f && !win)
            {
                timedPause   = 0.0f;
                bigText.text = "";
                showBigText  = false;
            }
            else if (lose && timedPause > 5.0f)
            {
                timedPause = 0.0f;
                DisplayDay();
                lose = false;
            }
        }
    }