/// <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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static Command GetProcessInterfacer(AbilityDataItem facer)
        {
            if (facer == null)
            {
                Debug.LogError("Interfacer does not exist. Can't generate command.");
                return(null);
            }
            Command curCom = null;

            switch (facer.InformationGather)
            {
            case InformationGatherType.Position:
                curCom = new Command(facer.ListenInputID);
                curCom.Add <Vector2d>(RTSInterfacing.GetWorldPosD(Input.mousePosition));
                break;

            case InformationGatherType.Target:
                curCom = new Command(facer.ListenInputID);
                if (RTSInterfacing.MousedAgent.IsNotNull())
                {
                    curCom.SetData <DefaultData>(new DefaultData(DataType.UShort, RTSInterfacing.MousedAgent.LocalID));
                }
                break;

            case InformationGatherType.PositionOrTarget:
                curCom = new Command(facer.ListenInputID);
                if (RTSInterfacing.MousedAgent.IsNotNull())
                {
                    curCom.Add <DefaultData>(new DefaultData(DataType.UShort, RTSInterfacing.MousedAgent.GlobalID));
                }
                else
                {
                    curCom.Add <Vector2d>(RTSInterfacing.GetWorldPosD(Input.mousePosition));
                }
                break;

            case InformationGatherType.None:
                curCom = new Command(facer.ListenInputID);
                break;
            }

            return(curCom);
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 4
0
        private static void ProcessInterfacer(AbilityDataItem facer)
        {
            switch (facer.InformationGather)
            {
            case InformationGatherType.Position:
                curCom = new Command(facer.ListenInputID);
                curCom.Add <Vector2d>(RTSInterfacing.GetWorldPosD(Input.mousePosition));
                break;

            case InformationGatherType.Target:
                curCom = new Command(facer.ListenInputID);
                if (RTSInterfacing.MousedAgent.IsNotNull())
                {
                    curCom.SetData <DefaultData>(new DefaultData(DataType.UShort, RTSInterfacing.MousedAgent.LocalID));
                }
                break;

            case InformationGatherType.PositionOrTarget:
                curCom = new Command(facer.ListenInputID);
                if (RTSInterfacing.MousedAgent.IsNotNull())
                {
                    curCom.Add <DefaultData>(new DefaultData(DataType.UShort, RTSInterfacing.MousedAgent.GlobalID));
                }
                else
                {
                    curCom.Add <Vector2d>(RTSInterfacing.GetWorldPosD(Input.mousePosition));
                }
                break;

            case InformationGatherType.None:
                curCom = new Command(facer.ListenInputID);
                break;
            }

            Send(curCom);
        }