示例#1
0
        public void SortObjectives()
        {
            ForcedOrder?.CalculatePriority();
            AIObjective orderWithHighestPriority = null;
            float       highestPriority          = 0;

            foreach (var currentOrder in CurrentOrders)
            {
                var orderObjective = currentOrder.Objective;
                if (orderObjective == null)
                {
                    continue;
                }
                orderObjective.CalculatePriority();
                if (orderWithHighestPriority == null || orderObjective.Priority > highestPriority)
                {
                    orderWithHighestPriority = orderObjective;
                    highestPriority          = orderObjective.Priority;
                }
            }
            CurrentOrder = orderWithHighestPriority;
            for (int i = Objectives.Count - 1; i >= 0; i--)
            {
                Objectives[i].CalculatePriority();
            }
            if (Objectives.Any())
            {
                Objectives.Sort((x, y) => y.Priority.CompareTo(x.Priority));
            }
            GetCurrentObjective()?.SortSubObjectives();
        }
示例#2
0
 public void SortObjectives()
 {
     if (Objectives.Any())
     {
         Objectives.Sort((x, y) => y.GetPriority().CompareTo(x.GetPriority()));
     }
     CurrentObjective?.SortSubObjectives();
 }
示例#3
0
 public void SortObjectives()
 {
     CurrentOrder?.GetPriority();
     Objectives.ForEach(o => o.GetPriority());
     if (Objectives.Any())
     {
         Objectives.Sort((x, y) => y.Priority.CompareTo(x.Priority));
     }
     GetCurrentObjective()?.SortSubObjectives();
 }
示例#4
0
 public void SortObjectives()
 {
     CurrentOrder?.GetPriority();
     for (int i = Objectives.Count - 1; i >= 0; i--)
     {
         Objectives[i].GetPriority();
     }
     if (Objectives.Any())
     {
         Objectives.Sort((x, y) => y.Priority.CompareTo(x.Priority));
     }
     GetCurrentObjective()?.SortSubObjectives();
 }
示例#5
0
        public void SortObjectives()
        {
            ForcedOrder?.GetPriority();

            AIObjective orderWithHighestPriority = null;
            float       highestPriority          = 0;

            foreach (var currentOrder in CurrentOrders)
            {
                var orderObjective = currentOrder.Objective;
                if (orderObjective == null)
                {
                    continue;
                }
                orderObjective.GetPriority();
                if (orderWithHighestPriority == null || orderObjective.Priority > highestPriority)
                {
                    orderWithHighestPriority = orderObjective;
                    highestPriority          = orderObjective.Priority;
                }
            }
#if SERVER
            if (orderWithHighestPriority != null && orderWithHighestPriority != currentOrder)
            {
                GameMain.NetworkMember.CreateEntityEvent(character, new object[] { NetEntityEvent.Type.ObjectiveManagerOrderState });
            }
#endif
            CurrentOrder = orderWithHighestPriority;

            for (int i = Objectives.Count - 1; i >= 0; i--)
            {
                Objectives[i].GetPriority();
            }
            if (Objectives.Any())
            {
                Objectives.Sort((x, y) => y.Priority.CompareTo(x.Priority));
            }

            GetCurrentObjective()?.SortSubObjectives();
        }