Пример #1
0
 // Use this for initialization
 void Start()
 {
     dialogScript = GameObject.Find(EventDialogScript.EventDialogName).GetComponent <EventDialogScript>();
     dialogScript.QueueEvent(new InstructionEventScript());
     notificationScript  = GameObject.Find(NotificationDialogScript.NotificationDialogName).GetComponent <NotificationDialogScript>();
     TotalGameTimePassed = 0;
     CurrentTimeInMonth  = 0;
     CurrentTimeInYear   = 0;
     DeltaTime           = 0;
     Paused = false; // Instruction event will keep game paused otherwise when it launches on startup
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (TimeManager.TotalGameTimePassed > TimeUntilEventsStart)
        {
            // Turn on events after a year has passed
            EventsEnabled = true;
        }

        if (EventsEnabled && !dialog.DialogOpen)
        {
            float value = Random.Range(0.0f, 10.0f);

            // Only trial income random events if no dialog is open
            if (IncomeManager.CurrentIncomeLevel != IncomeManager.IncomeLevel.kExcellent)
            {
                if (value > 9.998f)
                {
                    dialog.QueueEvent(new SalaryIncreasedEventScript());
                }
            }
            else if (IncomeManager.CurrentIncomeLevel != IncomeManager.IncomeLevel.kLow)
            {
                if (value > 9.998f)
                {
                    dialog.QueueEvent(new SalaryDecreasedEventScript());
                }
            }

            // Recreate a new value here - want the chances of fighting to break out to be independent of other events occuring
            // If we use the same old value, income level change event occurring will prevent this one from occurring
            value = Random.Range(0.0f, 10.0f);

            if (value > 9.997f)
            {
                dialog.QueueEvent(new FightingBreaksOutEventScript());
            }
        }
    }
Пример #3
0
 private void MidYear()
 {
     dialogScript.QueueEvent(new PayBillsEventScript());
     midYearReached = true;
 }