/// <summary>
        /// Sends the command for all AgentControllers under the control of this PlayerManager...
        /// Mainly for shared control capabilities
        /// </summary>
        /// <param name="com">COM.</param>
        public static void SendCommand(Command com)
        {
            com.Add <Selection>(new Selection());
            for (int i = 0; i < AgentControllers.PeakCount; i++)
            {
                if (AgentControllers.arrayAllocation [i])
                {
                    AgentController cont = AgentControllers [i];

                    if (cont.SelectedAgents.Count > 0)
                    {
                        com.ControllerID = cont.ControllerID;

                                                #if false
                        if (cont.SelectionChanged)
                        {
                            com.SetData <Selection>(new Selection(cont.SelectedAgents));
                            cont.SelectionChanged = false;
                        }
                        else
                        {
                            com.ClearData <Selection>();
                        }
                                                #else
                        //we always sending selection data
                        com.SetData <Selection>(new Selection(cont.SelectedAgents));
                        cont.SelectionChanged = false;
                                                #endif
                        CommandManager.SendCommand(com);
                    }
                }
            }
        }
        public static void OrderSpawn(AgentController cont, string agentCode, int count, Vector2d position)
        {
            Command com = new Command(InputCode.Spawn);

            com.ControllerID = cont.ControllerID;
            com.Position     = position;
            com.Target       = (ushort)AgentController.GetCodeIndex(agentCode);
            com.Count        = count;
            CommandManager.SendCommand(com);
        }
Пример #3
0
        /// <summary>
        /// Sends the command for all AgentControllers under the control of this PlayerManager...
        /// Mainly for shared control capabilities
        /// </summary>
        /// <param name="com">COM.</param>
        public static void SendCommand(Command com)
        {
            com.Add <Selection>(new Selection());
            for (int i = 0; i < AgentControllers.Count; i++)
            {
                AgentController cont = AgentControllers[i];
                if (cont.SelectedAgents.Count > 0)
                {
                    com.ControllerID = cont.ControllerID;

                    if (cont.SelectionChanged)
                    {
                        com.SetData <Selection>(new Selection(cont.SelectedAgents));
                        cont.SelectionChanged = false;
                    }
                    else
                    {
                        com.ClearData <Selection> ();
                    }
                    CommandManager.SendCommand(com);
                }
            }
        }
Пример #4
0
 public static void SendCommand(Command com)
 {
     com.Select = new Selection();
     for (int i = 0; i < AgentControllers.Count; i++)
     {
         AgentController cont = AgentControllers[i];
         if (cont.SelectedAgents.Count > 0)
         {
             if (cont.SelectionChanged)
             {
                 com.Select            = new Selection(cont.SelectedAgents);
                 cont.SelectionChanged = false;
             }
             else
             {
                 com.HasSelect = false;
             }
             com.ControllerID = cont.ControllerID;
             com.Select.Serialize(AgentControllers[i].SelectedAgents);
             CommandManager.SendCommand(com);
         }
     }
 }