示例#1
0
 private void Update()
 {
     transform.Rotate(Vector3.right, 360.0f / dayNightCycleDuration * Time.deltaTime);
     if (night != (moon.position.y >= (sun.position.y + 1.5f)))
     {
         night = !night;
         if (night)
         {
             OnNight?.Invoke();
         }
         else
         {
             OnDay?.Invoke();
         }
     }
 }
示例#2
0
    public bool TurnNight(bool isButtonCalled)
    {
        if (isToogleBlocked)
        {
            return(false);
        }

        if (isButtonCalled)
        {
            cashedIsDay = false;
            StartCoroutine(Cooldown());
            OnNight?.Invoke();
        }

        OnNight?.Invoke();
        isDay = false;
        return(true);
    }