/// <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 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); }
/// <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); } } }
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); }