Exemplo n.º 1
0
        private void NextAct()
        {
            IScheduleable scheduleable = ScheduleManager.Get();

            if (scheduleable == null)
            {
                TickAll();
                AddAll();
                return;
            }
            System.Console.WriteLine("{0}", (scheduleable as Actor).GetParent().NAME);
            if ((scheduleable as Actor).GetParent() == Player)
            {
                IsPlayerTurn = true;
            }
            else
            {
                var ai = (scheduleable as Actor).GetComponent <ConsoleScreenGameHelper.Core.Entity.Components.AI>(ComponentType.AI);
                ai.Act();
                (scheduleable as Actor).GetParent().Update();
                if ((scheduleable as Actor).Stats.Energy >= 7)
                {
                    ScheduleManager.Add((scheduleable as Actor));
                }
                else if ((scheduleable as Actor).Stats.Energy > 0)
                {
                    ScheduleManager.Add((scheduleable as Actor), 5);
                }
                else
                {
                    ScheduleManager.Add((scheduleable as Actor), 7);
                }
                NextAct();
            }
        }
Exemplo n.º 2
0
 public void Update()
 {
     if (Player == null)
     {
         GetPlayer();
     }
     DidPlayerAct = false;
     if (IsPlayerTurn)
     {
         Player.Update();
         if (DidPlayerAct == true)
         {
             if (Player.GetComponent <Statistic>(ComponentType.Stats).Energy >= 7)
             {
                 ScheduleManager.Add(Player.GetComponent <Actor>(ComponentType.Actor));
             }
             else if (Player.GetComponent <Statistic>(ComponentType.Stats).Energy > 0)
             {
                 ScheduleManager.Add(Player.GetComponent <Actor>(ComponentType.Actor), 5);
             }
             else
             {
                 ScheduleManager.Add(Player.GetComponent <Actor>(ComponentType.Actor), 7);
             }
             IsPlayerTurn = false;
             TickAll();
         }
     }
     else
     {
         NextAct();
         TickAll();
     }
 }
Exemplo n.º 3
0
        public new void Add(BaseEntity be)
        {
            base.Add(be);
            var a = be.GetComponent <Actor>(ComponentType.Actor);

            if (a != null)
            {
                ScheduleManager.Add(a);
            }
        }
Exemplo n.º 4
0
        private void scheduleAdd_Click(object sender, EventArgs e)
        {
            var addedSchedule = scheduleManager.Add(new Schedule
            {
                Date        = DateTime.Now,
                EventId     = eventManager.GetSingleObjectByName(cmbx.SelectedItem.ToString()).Data.Id,
                EventStatus = isSuccess.Checked
            });

            isSuccess.Checked = false;
            SetDGW();
        }
Exemplo n.º 5
0
 private void UpdateRestartManager()
 {
     // Start by clearing the ScheduleManager
     RestartManager.Clear();
     // Then loop through all server profiles and add all schedules to the ScheduleManager
     for (int p = 0; p < Config.Profiles.Count; p++)
     {
         for (int s = 0; s < Config.Profiles[p].Schedules.Length; s++)
         {
             RestartManager.Add(
                 Config.Profiles[p].ID,                       // The ServerHostID
                 Config.Profiles[p].Schedules[s].EventHour,   // The hour at which to trigger
                 Config.Profiles[p].Schedules[s].EventMinute, // The minute at which to trigger
                 Config.Profiles[p].Schedules[s].Backup       // Whether it's a backup event or a restart event
                 );
         }
     }
 }
Exemplo n.º 6
0
 private void AddAll()
 {
     foreach (BaseEntity be in this)
     {
         var a = be.GetComponent <Actor>(ComponentType.Actor);
         if (a != null)
         {
             if (a.Stats.Energy >= 7)
             {
                 ScheduleManager.Add(a);
             }
             else if (a.Stats.Energy > 0)
             {
                 ScheduleManager.Add(a, 5);
             }
             else
             {
                 ScheduleManager.Add(a, 7);
             }
         }
     }
 }