public CommandContainer(Command cmd, float executeDelay) { TimeCalled = Time.timeSinceLevelLoad; ExecuteDelayTime = executeDelay; DelayType = DelayTypes.Time; Cmd = cmd; }
public CommandContainer(Command cmd, int executeDelay) { FrameCalled = Time.frameCount; ExecuteDelayFrame = executeDelay; DelayType = DelayTypes.Frame; Cmd = cmd; }
static void OnSceneLoaded(Command c) { var cmd = c as SceneLoadedCmd; _cachedSceneView = cmd.View; cmd.View.StartCoroutine("ValidateSceneObjects"); cmd.View.Initialize(); cmd.View.SceneObjects.InitializeSceneObjects(); }
static void OnChangeScene(Command c) { var cmd = c as ChangeSceneCmd; GC.Collect(); // enter transition scene Framework.PushCommand(new LoadNextSceneCmd(cmd.SceneName), 1); Application.LoadLevel(Framework.TransitionScene); }
static void OnLoadNextScene(Command c) { var cmd = c as LoadNextSceneCmd; // load the new scene if (Application.HasProLicense()) Application.LoadLevelAsync(cmd.SceneName); else { Application.LoadLevel(cmd.SceneName); } }
static void OnChangeScene(Command cmd) { var cCmd = (ChangeSceneCmd)cmd; GC.Collect(); IsSceneInitialized = false; // enter transition scene // UnityEngine.Application.LoadLevel(Framework.TransitionScene); // load the new scene if(UnityEngine.Application.HasProLicense()) UnityEngine.Application.LoadLevelAsync(cCmd.SceneName); else UnityEngine.Application.LoadLevel(cCmd.SceneName); }
/// <summary> /// Enqueue a command with a delayed execution in seconds /// </summary> /// <param name="cmd"></param> /// <param name="timeDelay"></param> public void Push(Command cmd, float timeDelay) { _q.Enqueue(new CommandContainer(cmd, timeDelay)); }
/// <summary> /// Enqueue a command with a delayed execution in frames /// </summary> /// <param name="cmd"></param> /// <param name="frameDelay"></param> public void Push(Command cmd, int frameDelay) { _q.Enqueue(new CommandContainer(cmd, frameDelay)); }
/// <summary> /// Accessor function for putting commands into the game queue /// </summary> /// <param name="cmd"></param> public void Push(Command cmd) { _q.Enqueue(new CommandContainer(cmd, 0)); }
protected virtual void OnApplyOptions(Command cmd) { Screen.SetResolution(Options.Width, Options.Height, Options.FullScreen); // TODO: apply options as necessary }
static void OnSceneLoaded(Command cmd) { var cCmd = (SceneLoadedCmd) cmd; cCmd.View.Initialize(); IsSceneInitialized = true; }
void OnApplyOptions(Command cmd) { Screen.SetResolution(Options.Width, Options.Height, Options.FullScreen); QualitySettings.vSyncCount = Options.Vsync ? 1 : 0; // TODO: apply options as necessary }
/// <summary> /// push a command with a timed execution delay /// </summary> /// <param name="cmd">the command</param> /// <param name="timeDelay"># of seconds to wait until command will be executed</param> public static void PushCommand(Command cmd, float timeDelay) { _commands.Push(cmd, timeDelay); }
/// <summary> /// push a command with a frame count execution delay /// </summary> /// <param name="cmd">the command</param> /// <param name="frameDelay"># of frames to wait until command will be executed</param> public static void PushCommand(Command cmd, int frameDelay) { _commands.Push(cmd, frameDelay); }
/// <summary> /// push a command with no delay into the command queue /// </summary> /// <param name="cmd">the command</param> public static void PushCommand(Command cmd) { _commands.Push(cmd); }
void OnApplyOptions(Command cmd) { WriteConfig(); }