Exemple #1
0
    void Start()
    {
        cam = Camera.main;

        cam.clearFlags = CameraClearFlags.SolidColor;

        rend = GetComponent <SpriteRenderer>();

        timer = 0;


        changeDuration = dayLength / 4;

        player = GameObject.Find("Player");
        day    = false;
        cam.backgroundColor = color1;

        DayTimeTracker.ChangeNight();
    }
Exemple #2
0
 void ChangeColor()
 {
     if (day == false)
     {
         down = false;
         UpdateTime();
         UpdateSpriteTime();
         StartCoroutine(ChangeToNight());
         DayTimeTracker.ChangeNight();
     }
     else if (day == true)
     {
         down = false;
         UpdateTime();
         UpdateSpriteTime();
         StartCoroutine(ChangeToDay());
         DayTimeTracker.ChangeDay();
     }
 }
    bool offBeat; // Randomly selected

    private void Start()
    {
        dayTime      = FindObjectOfType <DayTimeTracker>() as DayTimeTracker;
        musicManager = MusicManager.FindObjectOfType <MusicManager>();
        spriteRend   = GetComponent <SpriteRenderer>();

        // Randomise starting frame. 3 is excluded
        spriteFrame = Random.Range(1, 3);
        int i = Random.Range(0, 5);

        offBeat = (i == 3) ? true : false;
        Debug.Log("i = " + i);

        beatChange = musicManager.BPMinSec;
        if (offBeat)
        {
            beatChange += (musicManager.BPMinSec / 2); // add a half beat
        }
    }