Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        isAngry   = false;
        timeIsSet = false;

        clock        = GameObject.FindGameObjectWithTag("Timer");
        timer        = clock.GetComponent <TimeManager>();
        can          = GameObject.Find("Trash Can");
        trashcan     = can.GetComponent <TrashController>();
        laundrybin   = GameObject.Find("Laundry");
        laundry      = laundrybin.GetComponent <LaundryController>();
        momAnim      = transform.GetChild(0).gameObject.GetComponent <Animator>();
        doorCollider = gameObject.GetComponent <BoxCollider2D> ();
        anim         = GetComponent <Animator>();
        momAudio     = GetComponent <AudioSource> ();

        intervalMax = (int)(timer.length / momMinVisits - 1);      //This is based on the level length in TimeManager

        knocking       = false;
        penaltyApplied = false;
        momIsHere      = false;
    }
    // OCCURS BEFORE INITIALIZATION
    void Awake()
    {
        // CHECKS IF THERE ARE OTHER INSTANCES OF GAMECONTROLLER
        if (instance == null)
        {
            instance = this;
        }
        //DESTROYS ITSELF IF ANOTHER INSTANCE EXISTS
        else if (instance != null)
        {
            Destroy(this);
        }

        trash         = GameObject.Find("Trash Can").GetComponent <TrashController>();
        laundry       = GameObject.Find("Laundry").GetComponent <LaundryController>();
        mother        = GameObject.Find("Door").GetComponent <Mother>();
        hw            = GameObject.Find("HomeworkInterface").GetComponent <HomeworkInterface> ();
        window        = GameObject.Find("Window").GetComponent <WindowController> ();
        timeManager   = GameObject.Find("TimeManager").GetComponent <TimeManager> ();
        bed           = GameObject.Find("Bed").GetComponent <BedController> ();
        bedtimeFilter = GameObject.Find("Bedtime Filter").GetComponent <BedtimeFilterController> ();
        setDayStats();
    }