54 lines
775 B
C#
54 lines
775 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class DayController : MonoBehaviour {
|
|
|
|
public Animator machine;
|
|
public int maxDay;
|
|
public int maxNight;
|
|
float timer;
|
|
// Use this for initialization
|
|
void Start () {
|
|
|
|
machine.SetInteger ("day_status", 0);
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
if (machine.GetInteger("day_status")==0){
|
|
|
|
|
|
if (timer >= (float)maxDay){
|
|
timer =0;
|
|
machine.SetInteger("day_status",1);
|
|
print("il fait nuit");
|
|
}
|
|
|
|
else{
|
|
timer += Time.deltaTime;
|
|
}
|
|
|
|
}
|
|
|
|
if (machine.GetInteger("day_status")==1){
|
|
|
|
|
|
if (timer >= (float)maxNight){
|
|
timer =0;
|
|
machine.SetInteger("day_status",0);
|
|
print("il fait jour");
|
|
}
|
|
|
|
else{
|
|
timer += Time.deltaTime;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|