Exemplo n.º 1
0
        public override void OnEnterState()
        {
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            IncidentVO[] incidents = calendar.GetEvents <IncidentVO>();
            foreach (IncidentVO incident in incidents)
            {
                if (AmbitionApp.CheckRequirements(incident.Requirements))
                {
                    QueueIncident(calendar, incident);
                }
                else
                {
                    calendar.Timeline[incident.Date].Remove(incident);
                }
            }

            incidents = calendar.Unscheduled.OfType <IncidentVO>().ToArray();
            foreach (IncidentVO incident in incidents)
            {
                if (incident.Requirements.Length > 0 && AmbitionApp.CheckRequirements(incident.Requirements))
                {
                    calendar.Schedule(incident, calendar.Today);
                    QueueIncident(calendar, incident);
                }
            }
            if (calendar.Incident != null)
            {
                AmbitionApp.SendMessage(IncidentMessages.START_INCIDENT);
            }
        }
Exemplo n.º 2
0
        public override void OnEnterState()
        {
            CalendarModel  calendar = AmbitionApp.GetModel <CalendarModel>();
            DateTime       today    = calendar.Today;
            List <PartyVO> parties  = calendar.GetEvents <PartyVO>(today).Where(p => p.RSVP == RSVP.New).ToList();

            if (Util.RNG.Generate(0, 3) == 0)            // Chance of a random future engagement
            {
                PartyVO party = new PartyVO
                {
                    InvitationDate = today,
                    Date           = today.AddDays(Util.RNG.Generate(1, 8) + Util.RNG.Generate(1, 8)), // +2d8 days
                    RSVP           = RSVP.New
                };
                AmbitionApp.Execute <InitPartyCmd, PartyVO>(party);
                parties.Add(party);
            }
            parties.ForEach(p => AmbitionApp.OpenDialog(RSVPDialog.DIALOG_ID, p));
        }