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);
            }
        }
Exemple #2
0
 protected override void OnExecute(Command com)
 {
     LastCommand = com;
     if (com.ContainsData <Vector2d>())
     {
         StartFormalMove(com.GetData <Vector2d>());
     }
 }
 public Selection GetSelection(Command com)
 {
     if (com.ContainsData <Selection>() == false)
     {
         return(previousSelection);
     }
     return(com.GetData <Selection>());
 }
        public void Initialize(Command com)
        {
            Destination         = com.GetData <Vector2d>();;
            calculatedBehaviors = false;
            Selection selection = AgentController.InstanceManagers[com.ControllerID].GetSelection(com);

            movers = new FastList <Move>(selection.selectedAgentLocalIDs.Count);
        }
        protected override void OnExecute(Command com)
        {
            Vector3d forward = com.GetData <Vector3d>();

            Forward = forward;

            this.CalculateRotationValues();
        }
Exemple #6
0
        public void Execute(Command com)
        {
            {
                if (com.ContainsData <Selection>() == false)
                {
                    com.Add <Selection>(previousSelection);
                }
                previousSelection = com.GetData <Selection>();
            }


            BehaviourHelperManager.Execute(com);
            for (int i = 0; i < com.GetData <Selection>().selectedAgentLocalIDs.Count; i++)
            {
                ushort selectedAgentID = com.GetData <Selection>().selectedAgentLocalIDs [i];
                if (LocalAgentActive [selectedAgentID])
                {
                    LocalAgents [selectedAgentID].Execute(com);
                }
            }
        }
        protected override void OnRawExecute(Command com)
        {
            if (com.InputCode == StartShootCode || com.InputCode == EndShootCode)
            {
                if (com.InputCode == StartShootCode)
                {
                    int comFrame = (int)com.GetData <DefaultData>().Value;
                    PassedFrames = LockstepManager.FrameCount - comFrame;
                    uint currentShot = (uint)com.GetData <DefaultData>(1).Value;
                    if (this.LatencyProjectiles.ContainsKey(currentShot))
                    {
                        ProjectileManager.EndProjectile(this.LatencyProjectiles[currentShot]);
                    }

                    this.IsFiring = true;
                    this.CheckFire();
                }
                else if (com.InputCode == EndShootCode)
                {
                    this.IsFiring = false;
                }
            }
        }
        protected override void OnRawExecute(Command com)
        {
            if (com.InputCode == StartShootCode || com.InputCode == EndShootCode)
            {
                
                if (com.InputCode == StartShootCode)
                {

                    int comFrame = (int)com.GetData<DefaultData>().Value;
                    PassedFrames = LockstepManager.FrameCount - comFrame;
                    uint currentShot = (uint)com.GetData<DefaultData>(1).Value;
                    if (this.LatencyProjectiles.ContainsKey(currentShot)) {
                        ProjectileManager.EndProjectile(this.LatencyProjectiles[currentShot]);
                    }

                    this.IsFiring = true;
                    this.CheckFire();

                }
                else if (com.InputCode == EndShootCode)
                    this.IsFiring = false;
            }
        }
        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])
                {
                    LocalAgents [selectedAgentID].Execute(com);
                }
            }
        }
        protected override void OnExecute(Command com)
        {
            Vector3d forward = com.GetData<Vector3d>();
            Forward = forward;

            this.CalculateRotationValues();
        }
 public void Initialize(Command com)
 {
     Destination         = com.GetData <Vector2d> ();;
     calculatedBehaviors = false;
     movers = new FastList <Move>(com.GetData <Selection>().selectedAgentLocalIDs.Count);
 }