Exemplo n.º 1
0
 void OnTriggerStay(Collider other)
 {
     if (other.name == "roast")
     {
         if (stick.transform.localRotation.eulerAngles.x < 180 && stick.transform.rotation.eulerAngles.x > 0)
         {
             n += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
         else if (stick.transform.localRotation.eulerAngles.x > 180 && stick.transform.rotation.eulerAngles.x < 360)
         {
             s += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
     }
     if (other.name == "burn")
     {
         if (bottomInd.transform.position.x < topInd.transform.position.x)
         {
             n += (float)burn_inc * Time.deltaTime;
             s += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
         else if (bottomInd.transform.position.x > topInd.transform.position.x)
         {
             s += (float)burn_inc * Time.deltaTime;
             n += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
     }
 }
Exemplo n.º 2
0
 void OnTriggerStay(Collider other)
 {
     if (other.name == "roast")
     {
         if (bottomInd.transform.position.y < topInd.transform.position.y)
         {
             n += (float)roast_inc * Time.deltaTime;
             //North.GetComponent<UnityEngine.UI.Text>().text = (n).ToString();
         }
         else if (bottomInd.transform.position.y > topInd.transform.position.y)
         {
             s += (float)roast_inc * Time.deltaTime;
             //South.GetComponent<UnityEngine.UI.Text>().text = (s).ToString();
         }
     }
     if (other.name == "burn")
     {
         if (bottomInd.transform.position.y < topInd.transform.position.y)
         {
             n += (float)burn_inc * Time.deltaTime;
             s += (float)roast_inc * Time.deltaTime;
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
         }
         else if (bottomInd.transform.position.y > topInd.transform.position.y)
         {
             s += (float)burn_inc * Time.deltaTime;
             n += (float)roast_inc * Time.deltaTime;
             South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
             North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
         }
     }
 }
Exemplo n.º 3
0
 public void resetMarshmallow()
 {
     checkForAchievements(n, s);
     n = 0f;
     s = 0f;
     gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_1", new Color(1f, 1f, 1f, 1f));
     gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_2", new Color(1f, 1f, 1f, 1f));
     South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString();
     North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString();
 }
Exemplo n.º 4
0
    public void resetMarshmallow()
    {
        checkForAchievements(n, s);
        n = 0f;
        s = 0f;
        var white = new Color(1f, 1f, 1f, 1f);

        gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_1", white);
        gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_2", white);
        South.GetComponent <UnityEngine.UI.Text>().text = (s).ToString() + "%";
        North.GetComponent <UnityEngine.UI.Text>().text = (n).ToString() + "%";
        topBar.GetComponent <Image>().color             = white;
        bottomBar.GetComponent <Image>().color          = white;
        topMarshmallow.GetComponent <Image>().color     = white;
        bottomMarshmallow.GetComponent <Image>().color  = white;
        isOnFire = false;
        marshmallowFire.SetActive(false);
        timePassedPerMallow  = 0.0f;
        fireCounterPerMallow = 0;
    }
Exemplo n.º 5
0
    void updateVisualIndicators()
    {
        if (n > 0f)
        {
            var currentColor = gameObject.GetComponent <MeshRenderer>().material.GetColor("Color_2");

            var red   = currentColor.r;
            var blue  = 1f - (n * 0.10f);
            var green = 1f - (n * 0.05f);

            if (green <= 0.5f)
            {
                red   = 1f - (n * 0.10f);
                green = 1f - (n * 0.10f);
            }

            if (red <= 0f)
            {
                red = 0f;
            }
            if (blue <= 0f)
            {
                blue = 0f;
            }
            if (green <= 0f)
            {
                green = 0f;
            }
            var newColor = new Color(red, green, blue, 1f);
            gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_2", newColor);
            topBar.GetComponent <Image>().color = newColor;
            if (n <= 10f)
            {
                topBar.GetComponent <RectTransform>().localScale = new Vector3(n * 0.1f, 1f, 1f);
            }
            North.GetComponent <UnityEngine.UI.Text>().text = (n * 10).ToString("F0") + "%";
            topMarshmallow.GetComponent <Image>().color     = newColor;
        }
        if (s > 0f)
        {
            var currentColor = gameObject.GetComponent <MeshRenderer>().material.GetColor("Color_1");

            var red   = currentColor.r;
            var blue  = 1f - (s * 0.10f);
            var green = 1f - (s * 0.05f);

            if (green <= 0.5f)
            {
                red   = 1f - (s * 0.10f);
                green = 1f - (s * 0.10f);
            }

            if (red <= 0f)
            {
                red = 0f;
            }
            if (blue <= 0f)
            {
                blue = 0f;
            }
            if (green <= 0f)
            {
                green = 0f;
            }
            var newColor = new Color(red, green, blue, 1f);
            gameObject.GetComponent <MeshRenderer>().material.SetColor("Color_1", new Color(red, green, blue, 1f));
            bottomBar.GetComponent <Image>().color = newColor;
            if (s <= 10f)
            {
                bottomBar.GetComponent <RectTransform>().localScale = new Vector3(s * 0.1f, 1f, 1f);
            }
            South.GetComponent <UnityEngine.UI.Text>().text = (s * 10).ToString("F0") + "%";
            bottomMarshmallow.GetComponent <Image>().color  = newColor;
        }
    }