Ejemplo n.º 1
0
        public void Execute(Command com)
        {
            if (com.ContainsData <Selection>())
            {
                previousSelection = com.GetData <Selection>();
            }

            BehaviourHelperManager.Execute(com);
            Selection selection = GetSelection(com);

            for (int i = 0; i < selection.selectedAgentLocalIDs.Count; i++)
            {
                ushort selectedAgentID = selection.selectedAgentLocalIDs[i];
                if (LocalAgentActive[selectedAgentID])
                {
                    var agent = LocalAgents[selectedAgentID];
                    ////Prevent executing twice on commander
                    //if (Commander.IsNull() || agent != Commander.Agent) {
                    agent.Execute(com);
                    //}
                }
            }
            //if (Commander.IsNotNull())
            //Commander.Agent.Execute (com);
        }
        public void Execute(Command com)
        {
            if (com.ContainsData <Selection>())
            {
                previousSelection = com.GetData <Selection>();
            }

            BehaviourHelperManager.Execute(com);
            Selection selection = GetSelection(com);
            Influence influence = GetInfluencedAgent(com);

            // check if command is an influence from AI
            if (influence.IsNotNull())
            {
                ushort influencedAgentID = influence.InfluencedAgentLocalID;
                if (LocalAgentActive[influencedAgentID])
                {
                    var agent = LocalAgents[influencedAgentID];
                    agent.Execute(com);
                }
            }
            // otherwise it's an input command
            else if (selection != null && selection.selectedAgentLocalIDs.Count > 0)
            {
                for (int i = 0; i < selection.selectedAgentLocalIDs.Count; i++)
                {
                    ushort selectedAgentID = selection.selectedAgentLocalIDs[i];
                    if (LocalAgentActive[selectedAgentID])
                    {
                        var agent = LocalAgents[selectedAgentID];
                        agent.Execute(com);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        internal static void Execute(Command com)
        {
            if (!GameStarted)
            {
                Debug.LogError("BOOM");
                return;
            }
            if (com.ControllerID != byte.MaxValue)
            {
                AgentController cont = AgentController.InstanceManagers [com.ControllerID];
                cont.Execute(com);
            }
            else
            {
                BehaviourHelperManager.Execute(com);
            }

            DefaultMessageRaiser.Execute(com);
        }