Example #1
0
        public static void Setup()
        {
            LSDatabaseManager.Setup();

            UnityInstance = GameObject.CreatePrimitive(PrimitiveType.Sphere).AddComponent <MonoBehaviour> ();
            UnityInstance.GetComponent <Renderer>().enabled = false;
            GameObject.DontDestroyOnLoad(UnityInstance.gameObject);

            AbilityInterfacer.Setup();

            AgentController.Setup();
            TeamManager.Setup();

            ProjectileManager.Setup();
            EffectManager.Setup();
            BehaviourHelper.GlobalSetup();
            PhysicsManager.Setup();
            ClientManager.Setup(MainGameManager.MainNetworkHelper);
            InterfaceManager.Setup();

            Application.targetFrameRate = 30;
            Time.fixedDeltaTime         = BaseDeltaTime;
            Time.maximumDeltaTime       = Time.fixedDeltaTime * 2;

            InputManager.Setup();

            foreach (LSManager manager in Managers)
            {
                manager.Setup();
            }
        }
Example #2
0
        public static void Initialize(GameManager gameManager)
        {
            MainGameManager = gameManager;
            Managers        = gameManager.Managers;

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


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

            FrameCount          = 0;
            InfluenceFrameCount = 0;

            GridManager.Generate();
            GridManager.Initialize();

            TeamManager.Initialize();

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

            CommandManager.Initialize();
            BehaviourHelper.GlobalInitialize();

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

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

            foreach (LSManager manager in Managers)
            {
                manager.Initialize();
            }

            LoadSceneObjects();

            Started = true;
            ClientManager.Initialize();
        }
        public static void Visualize()
        {
            PlayerManager.Visualize();

            BehaviourHelper.GlobalVisualize();
            PhysicsManager.Visualize();
            AgentController.Visualize();
            ProjectileManager.Visualize();
            EffectManager.Visualize();

            TeamManager.Visualize();

            //LateVisualize ();
        }
        public static void Deactivate()
        {
            if (Started == false)
            {
                return;
            }
            Selector.Clear();
            AgentController.Deactivate();
            BehaviourHelper.GlobalDeactivate();
            ProjectileManager.Deactivate();
            ClientManager.Deactivate();

            TeamManager.Deactivate();
            ClientManager.NetworkHelper.Disconnect();
            Started = false;
        }
Example #5
0
        public static void Simulate()
        {
            if (InfluenceCount == 0)
            {
                InfluenceSimulate();
                InfluenceCount = InfluenceResolution - 1;
                if (FrameManager.CanAdvanceFrame == false)
                {
                    Stalled = true;
                    return;
                }
                Stalled = false;
                FrameManager.Simulate();
                InfluenceFrameCount++;
            }
            else
            {
                InfluenceCount--;
            }
            if (Stalled)
            {
                return;
            }
            if (FrameCount == 0)
            {
                StartGame();
            }
            BehaviourHelper.GlobalSimulate();
            AgentController.Simulate();
            PhysicsManager.Simulate();
            CoroutineManager.Simulate();
            InfluenceManager.Simulate();
            ProjectileManager.Simulate();
            TestManager.Simulate();

            TeamManager.Simulate();

            foreach (LSManager manager in Managers)
            {
                manager.Simulate();
            }

            LateSimulate();
            FrameCount++;
        }
        public void Execute(Command com)
        {
            if (com.LeInput == InputCode.Spawn)
            {
                for (int i = 0; i < com.Count; i++)
                {
                    LSAgent agent = CreateAgent(GetAgentCode((int)com.Target), com.Position);
                }
                return;
            }


            if (com.HasGroupID)
            {
                /*var group = AgentGroupController.GetGroup(com.GroupID);
                 * if (group .IsNotNull ()) {
                 *  for (i = 0; i < group.Agents.Count; i++) {
                 *      group.Agents[i].Execute(com);
                 *  }
                 * }*/
            }
            else
            {
                if (com.HasSelect == false)
                {
                    com.Select = previousSelection;
                }
                previousSelection = com.Select;
            }

            BehaviourHelper.GlobalExecute(com);
            for (int i = 0; i < com.Select.selectedAgentLocalIDs.Count; i++)
            {
                ushort selectedAgentID = com.Select.selectedAgentLocalIDs[i];
                if (LocalAgentActive[selectedAgentID])
                {
                    LocalAgents[selectedAgentID].Execute(com);
                }
            }
        }
Example #7
0
 private static void LateSimulate()
 {
     BehaviourHelper.GlobalLateSimulate();
     AgentController.LateSimulate();
     PhysicsManager.LateSimulate();
 }