Beispiel #1
0
        public static void Load(string filepath)
        {
            string data = Deobfuscate(filepath);

            SimManager.LoadSimulation(JsonUtility.FromJson <SSimulation>(data));
            ConsoleLog.Clear();
        }
Beispiel #2
0
        public static void OpenLoadWindow()
        {
            SimManager.SetStatus(SimulationStatus.Paused);
            var win = UnityEngine.Object.Instantiate(
                Resources.Load("Prefabs/UI/Windows/SaveLoad/SaveLoad Window") as GameObject, UIManager.Transform, false);

            win.GetComponent <SaveLoadWindow>().SetLoadMode();
        }
 private void EditMode()
 {
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         Selectable.ShortcutDelete();
         return;
     }
     if (Input.GetKeyDown(KeyCode.Backslash))
     {
         SimManager.SetStatus(SimulationStatus.Paused);
         return;
     }
 }
Beispiel #4
0
        private static IEnumerator Operate()
        {
            MovementJob _movementJob = new MovementJob();
            EnergyJob   _energyJob   = new EnergyJob();

            while (true)
            {
                if (_Transforms.length == 0)
                {
                    yield return(null);
                }
                int j = 0;

                foreach (Drone drone in Drones.Values)
                {
                    var dE = _EnergyInfoArray[j].energy;
                    drone.UpdateEnergy(dE);
                    drone.GetHub().UpdateEnergy(dE);
                    drone.GetBattery().DischargeBattery(dE);
                    SimManager.UpdateEnergy(dE);

                    _PreviousPositions[j]  = drone.PreviousPosition;
                    drone.PreviousPosition = drone.transform.position;

                    _JobInfoArray[j]    = drone.GetMovementInfo(_JobInfoArray[j]);
                    _EnergyInfoArray[j] = drone.GetEnergyInfo(_EnergyInfoArray[j]);
                    j++;
                }

                _movementJob.nextMove  = _JobInfoArray;
                _movementJob.rt_dt     = _PreviousPositions;
                _movementJob.deltaTime = _time.Timer();

                _energyJob.energies  = _EnergyInfoArray;
                _energyJob.deltaTime = _time.Timer();
                _time.Now();

                movementJobHandle = _movementJob.Schedule(_Transforms);
                energyJobHandle   = _energyJob.Schedule(_Transforms.length, 1);

                yield return(null);

                energyJobHandle.Complete();
                movementJobHandle.Complete();
            }
        }
 private void PlayMode()
 {
     if (Input.GetKeyDown(KeyCode.BackQuote))
     {
         SimManager.SetStatus(SimulationStatus.Paused);
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         SimManager.SetStatus(SimulationStatus.Running);
         TimeKeeper.TimeSpeed = TimeSpeed.Slow;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         SimManager.SetStatus(SimulationStatus.Running);
         TimeKeeper.TimeSpeed = TimeSpeed.Normal;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         SimManager.SetStatus(SimulationStatus.Running);
         TimeKeeper.TimeSpeed = TimeSpeed.Fast;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha4))
     {
         SimManager.SetStatus(SimulationStatus.Running);
         TimeKeeper.TimeSpeed = TimeSpeed.Ultra;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Alpha5))
     {
         SimManager.SetStatus(SimulationStatus.Running);
         TimeKeeper.TimeSpeed = TimeSpeed.WTF;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Backslash))
     {
         SimManager.SetStatus(SimulationStatus.EditMode);
         return;
     }
 }
Beispiel #6
0
 public static void Save(string filepath)
 {
     Obfuscate(filepath, JsonUtility.ToJson(SimManager.SerializeSimulation()));
 }