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);
            }
        }
Ejemplo n.º 2
0
        static void InitializeHelpers()
        {
            FastList <BehaviourHelper> helpers = new FastList <BehaviourHelper>();

            MainGameManager.GetBehaviourHelpers(helpers);
            BehaviourHelperManager.Initialize(helpers.ToArray());
        }
Ejemplo n.º 3
0
 private static void LateSimulate()
 {
     BehaviourHelperManager.LateSimulate();
     AgentController.LateSimulate();
     PhysicsManager.LateSimulate();
     DefaultMessageRaiser.LateSimulate();
 }
Ejemplo n.º 4
0
 internal static void LateVisualize()
 {
     DefaultMessageRaiser.LateVisualize();
     AgentController.LateVisualize();
     PhysicsManager.LateVisualize();
     BehaviourHelperManager.LateVisualize();
 }
        internal static void Deactivate()
        {
            DefaultMessageRaiser.EarlyDeactivate();

            if (GameStarted == false)
            {
                return;
            }
            Selector.Clear();
            AgentController.Deactivate();
            BehaviourHelperManager.Deactivate();
            ProjectileManager.Deactivate();
            EffectManager.Deactivate();
            ClientManager.Deactivate();

            ClientManager.Quit();
            PhysicsManager.Deactivate();
            GameStarted = false;
            LSServer.Deactivate();
            DefaultMessageRaiser.LateDeactivate();
            CoroutineManager.Deactivate();

            if (MainGameManager.gameObject != null)
            {
                GameObject.Destroy(MainGameManager.gameObject);
            }
        }
Ejemplo n.º 6
0
        internal static void Initialize(GameManager gameManager)
        {
            MainGameManager = gameManager;

            if (!Loaded)
            {
                Setup();
                Loaded = true;
            }

            InitializeHelpers();


            DefaultMessageRaiser.EarlyInitialize();
            SimulationTimer.Stop();
            SimulationTimer.Reset();
            SimulationTimer.Start();
            LSDatabaseManager.Initialize();
            LSUtility.Initialize(1);
            InfluenceCount = 0;
            Time.timeScale = 1f;
            Stalled        = true;

            FrameCount          = 0;
            InfluenceFrameCount = 0;

            ClientManager.Initialize(MainGameManager.MainNetworkHelper);

            TriggerManager.Initialize();

            GridManager.Initialize();

            TeamManager.Initialize();

            CoroutineManager.Initialize();
            FrameManager.Initialize();

            CommandManager.Initialize();

            AgentController.Initialize();
            TeamManager.LateInitialize();

            PhysicsManager.Initialize();
            PlayerManager.Initialize();
            SelectionManager.Initialize();
            InfluenceManager.Initialize();
            ProjectileManager.Initialize();

            DefaultMessageRaiser.LateInitialize();

            BehaviourHelperManager.LateInitialize();
            if (onInitialize != null)
            {
                onInitialize();
            }
        }
Ejemplo n.º 7
0
        internal static void Initialize(ILockstepEventsHandler[] helpers, NetworkHelper networkHelper)
        {
            PlayRate = FixedMath.One;
            //PauseCount = 0;

            if (!Loaded)
            {
                Setup();
                Loaded = true;
            }



            DefaultMessageRaiser.EarlyInitialize();

            LSDatabaseManager.Initialize();
            LSUtility.Initialize(1);
            InfluenceCount = 0;
            Time.timeScale = 1f;

            Stalled = true;

            FrameCount          = 0;
            InfluenceFrameCount = 0;
            MainNetworkHelper   = networkHelper;
            AgentController.Initialize();
            ClientManager.Initialize(MainNetworkHelper);

            BehaviourHelperManager.Initialize(helpers);

            GridManager.Initialize();


            CoroutineManager.Initialize();
            FrameManager.Initialize();

            CommandManager.Initialize();


            PhysicsManager.Initialize();
            PlayerManager.Initialize();
            SelectionManager.Initialize();
            InfluenceManager.Initialize();
            ProjectileManager.Initialize();

            DefaultMessageRaiser.LateInitialize();
            BehaviourHelperManager.LateInitialize();
            if (onInitialize != null)
            {
                onInitialize();
            }
        }
Ejemplo n.º 8
0
        internal static void Visualize()
        {
            DefaultMessageRaiser.EarlyVisualize();
            PlayerManager.Visualize();
            MainGameManager.MainInterfacingHelper.Visualize();
            BehaviourHelperManager.Visualize();
            PhysicsManager.Visualize();
            AgentController.Visualize();
            ProjectileManager.Visualize();
            EffectManager.Visualize();

            TeamManager.Visualize();
        }
Ejemplo n.º 9
0
 internal static void Visualize()
 {
     if (!GameStarted)
     {
         return;
     }
     DefaultMessageRaiser.EarlyVisualize();
     PlayerManager.Visualize();
     BehaviourHelperManager.Visualize();
     AgentController.Visualize();
     ProjectileManager.Visualize();
     EffectManager.Visualize();
     CommandManager.Visualize();
 }
Ejemplo n.º 10
0
        internal static void Simulate()
        {
            MainGameManager.MainNetworkHelper.Simulate();
            DefaultMessageRaiser.EarlySimulate();
            if (InfluenceCount == 0)
            {
                InfluenceSimulate();
                InfluenceCount = InfluenceResolution - 1;
                if (FrameManager.CanAdvanceFrame == false)
                {
                    Stalled = true;
                    return;
                }
                Stalled = false;
                if (InfluenceFrameCount == 0)
                {
                    GameStart();
                }
                FrameManager.Simulate();
                InfluenceFrameCount++;
            }
            else
            {
                InfluenceCount--;
            }
            if (Stalled)
            {
                return;
            }

            MainGameManager.MainInterfacingHelper.Simulate();


            BehaviourHelperManager.Simulate();
            AgentController.Simulate();
            PhysicsManager.Simulate();
            CoroutineManager.Simulate();
            InfluenceManager.Simulate();
            ProjectileManager.Simulate();
            TeamManager.Simulate();

            TriggerManager.Simulate();

            LateSimulate();
            FrameCount++;
        }
Ejemplo n.º 11
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])
                {
                    LocalAgents [selectedAgentID].Execute(com);
                }
            }
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
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);
                }
            }
        }
Ejemplo n.º 14
0
        internal static void Deactivate()
        {
            DefaultMessageRaiser.EarlyDeactivate();

            if (GameStarted == false)
            {
                return;
            }
            Selector.Clear();
            AgentController.Deactivate();
            BehaviourHelperManager.Deactivate();
            ProjectileManager.Deactivate();
            EffectManager.Deactivate();
            ClientManager.Deactivate();

            TeamManager.Deactivate();
            ClientManager.Quit();
            PhysicsManager.Deactivate();
            GameStarted = false;
            LSServer.Deactivate();
            DefaultMessageRaiser.LateDeactivate();
        }
Ejemplo n.º 15
0
        internal static void Deactivate()
        {
            DefaultMessageRaiser.EarlyDeactivate();

            if (Started == false)
            {
                return;
            }
            Selector.Clear();
            AgentController.Deactivate();
            MainGameManager.MainInterfacingHelper.Deactivate();
            BehaviourHelperManager.Deactivate();
            ProjectileManager.Deactivate();
            ClientManager.Deactivate();
            LockstepManager.Deactivate();

            TeamManager.Deactivate();
            ClientManager.NetworkHelper.Disconnect();
            Started = false;

            DefaultMessageRaiser.LateDeactivate();
        }
Ejemplo n.º 16
0
 private static void GameStart()
 {
     GameManager.GameStart();
     BehaviourHelperManager.GameStart();
 }
Ejemplo n.º 17
0
 //Called on the first frame of the game
 private static void GameStart()
 {
     BehaviourHelperManager.GameStart();
     GameStarted = true;
 }