コード例 #1
0
    //--- Unity Methods ---//
    private void Awake()
    {
        // Init the private variables
        m_roomManager  = GameObject.FindObjectOfType <Room_Manager>();
        m_callLogUI    = GameObject.FindObjectOfType <CallerLog_UIManager>();
        m_callList     = new List <Call_Group>();
        totalCash      = GameObject.Find("Txt_Money").GetComponent <TextMeshProUGUI>();
        audioManager   = GameObject.Find("AudioManager").GetComponent <Audio_Manager>();
        persistManager = GameObject.Find("PersistenceManager").GetComponent <Persistence_Manager>();
        m_active       = false;

        // Sample the difficulty curve to determine how quickly calls should spawn throughout this day
        Persistence_Manager persistence = GameObject.FindObjectOfType <Persistence_Manager>();
        Day_Manager         dayManager  = GameObject.FindObjectOfType <Day_Manager>();
        float percentThroughWeek        = (float)persistence.m_dayNumber / (float)(dayManager.maxDayCounter - 1);

        m_timeBetweenCalls  = m_timeBetweenCallsCurve.Evaluate(percentThroughWeek);
        m_timeSinceLastCall = m_timeBetweenCalls;
        Debug.Log("Time Between Calls: " + m_timeBetweenCalls);
    }
コード例 #2
0
    void Start()
    {
        dayLengthIG        = dayEndTime - dayStartTime;
        timeElapsed        = 0.0f;
        txtDayCounter.text = "Day " + (dayCounter + 1).ToString();

        if (_instance == null)
        {
            _instance = GameObject.FindObjectOfType <Day_Manager>();

            if (_instance != null && _instance != this)
            {
                Destroy(this.gameObject);
            }
            else
            {
                _instance = this;
            }
        }

        clock = null ?? GameObject.Find("Timer").GetComponent <TextMeshProUGUI>();
        //dailyEarnings = null ?? GameObject.Find("Daily Earning").GetComponent<TextMeshProUGUI>();
        cashCalculator = null ?? GameObject.Find("Game_Controller");

        // Shouldn't start counting time until the day begins properly
        shouldCountTime = false;

        // Should prevent key input until the day starts
        GameObject.FindObjectOfType <Key_Manager>().enabled = false;

        // Show the day start text
        txtDayStart.SetActive(true);
        txtBackground.SetActive(true);

        // Turn off the day start text after a few seconds and then begin the day properly
        Invoke("StartDay", dayBufferLength);
    }