//		public static void Reset ()
//		{
//			LockstepManager.Deactivate ();
//			GameObject.Instantiate (MainGameManager.gameObject);
//		}

        internal static void Setup()
        {
            DefaultMessageRaiser.EarlySetup();

            LSDatabaseManager.Setup();
            Command.Setup();

            GridManager.Setup();
            InputCodeManager.Setup();
            AbilityDataItem.Setup();

            ResourceManager.Setup();
            //AgentController.Setup ();

            ProjectileManager.Setup();
            EffectManager.Setup();

            PhysicsManager.Setup();
            ClientManager.Setup();

            Time.fixedDeltaTime   = DeltaTimeF;
            Time.maximumDeltaTime = Time.fixedDeltaTime * 2;


            DefaultMessageRaiser.LateSetup();
            if (onSetup != null)
            {
                onSetup();
            }
        }
 private static void LateSimulate()
 {
     BehaviourHelperManager.LateSimulate();
     AgentController.LateSimulate();
     PhysicsManager.LateSimulate();
     DefaultMessageRaiser.LateSimulate();
 }
 internal static void LateVisualize()
 {
     DefaultMessageRaiser.LateVisualize();
     AgentController.LateVisualize();
     PhysicsManager.LateVisualize();
     BehaviourHelperManager.LateVisualize();
 }
Esempio n. 4
0
        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();

            DefaultMessageRaiser.Reset();
        }
Esempio n. 5
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();

            //   GridBuilder.Initialize();

            //Initialized in UserInputHelper
            //	SelectionManager.Initialize ();
            InfluenceManager.Initialize();
            ProjectileManager.Initialize();

            DefaultMessageRaiser.LateInitialize();
            BehaviourHelperManager.LateInitialize();
            if (onInitialize != null)
            {
                onInitialize();
            }
        }
 internal static void Visualize()
 {
     if (!GameStarted)
     {
         return;
     }
     DefaultMessageRaiser.EarlyVisualize();
     PlayerManager.Visualize();
     BehaviourHelperManager.Visualize();
     AgentController.Visualize();
     ProjectileManager.Visualize();
     EffectManager.Visualize();
     CommandManager.Visualize();
     PhysicsManager.Visualize();
 }
        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);
        }
        internal static void Simulate()
        {
            MainNetworkHelper.Simulate();
            DefaultMessageRaiser.EarlySimulate();
            if (InfluenceCount == 0)
            {
                InfluenceSimulate();
                InfluenceCount = InfluenceResolution - 1;
                if (FrameManager.CanAdvanceFrame == false)
                {
                    Stalled = true;
                    return;
                }
                Stalled = false;

                FrameManager.Simulate();
                InfluenceFrameCount++;
            }
            else
            {
                InfluenceCount--;
            }
            if (Stalled || IsPaused)
            {
                return;
            }

            if (FrameCount == 0)
            {
                GameStart();
            }
            BehaviourHelperManager.Simulate();
            AgentController.Simulate();
            PhysicsManager.Simulate();
            CoroutineManager.Simulate();
            InfluenceManager.Simulate();
            ProjectileManager.Simulate();

            LateSimulate();
            FrameCount++;
        }