예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     SetUpDayNight();
     //Should write an else that gets the daynightscript IF NULL
     if (dayNightScript)
     {
         cycleFraction = dayNightScript.getCycleFraction();
     }
 }
예제 #2
0
 private void Update()
 {
     if (dayNightScript && text)
     {
         double fraction = dayNightScript.getCycleFraction();
         if (fraction == 0.75)
         {
             text.text = "Start of Day " + dayNightScript.getDayCount();
             StartCoroutine(TriggerDisplay());
         }
         else if (fraction == 0.25)
         {
             text.text = "Start of Night " + dayNightScript.getDayCount();
             StartCoroutine(TriggerDisplay());
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (dayNightScript == null)
        {
            SetUpDayNight();
        }

        if (dayNightScript)
        {
            cycleFraction = dayNightScript.getCycleFraction();
        }
        else
        {
            print("cant find DayNight");
        }

        float alpha;

        if (name == "clouds")
        {
            alpha = AlphaFunction(cycleFraction);
        }
        else if (name == "stars")
        {
            alpha = AlphaFunction(cycleFraction + 0.5);
        }
        else
        {
            alpha = 1;
        }

        if (image)
        {
            image.color = new Color(1, 1, 1, alpha);
        }
    }