void Awake() { instance = this; sceneAnimators = transform.root.GetComponentsInChildren <Animator>(); commandDisplay = transform.parent.FindChild("UI").FindChild("Command").GetComponent <CommandDisplay>(); controlDisplay = transform.parent.FindChild("UI").FindChild("Control Display").GetComponent <ControlDisplay>(); }
void Awake() { instance = this; string sceneName = gameObject.scene.name; if (sceneName.Equals("Template")) { sceneName = "_Template1"; } traits = MicrogameTraits.findMicrogameTraits(sceneName.Substring(0, sceneName.Length - 1), int.Parse(sceneName.Substring(sceneName.Length - 1, 1))); if (StageController.instance == null) { //Debug Mode Awake (scene open by itself) if (MicrogameDebugObjects.instance == null) { SceneManager.LoadScene("Microgame Debug", LoadSceneMode.Additive); } else { MicrogameDebugObjects.instance.Reset(); } if (preserveDebugSpeed > -1) { Debug.Log("Debugging at speed " + preserveDebugSpeed); debugSettings.speed = preserveDebugSpeed; preserveDebugSpeed = -1; } StageController.beatLength = 60f / 130f; Time.timeScale = StageController.getSpeedMult(debugSettings.speed); victory = traits.defaultVictory; victoryDetermined = false; traits.onAccessInStage(sceneName.Substring(0, sceneName.Length - 1)); } else if (!isBeingDiscarded()) { //Normal Awake StageController.instance.stageCamera.tag = "Camera"; Camera.main.GetComponent <AudioListener>().enabled = false; StageController.instance.microgameMusicSource.clip = traits.musicClip; if (traits.hideCursor) { Cursor.visible = false; } commandDisplay = StageController.instance.transform.root.FindChild("UI").FindChild("Command").GetComponent <CommandDisplay>(); StageController.instance.resetVictory(); StageController.instance.onMicrogameAwake(); } }
public void AddCommandToStack(Sprite commandIcon, Command command) { CommandDisplay a = Instantiate(commandDisplay, commandStack); a.gameObject.SetActive(true); a.RegisterToCommand(command); }
public void Start() { nodePrefabLookup = new Dictionary <Type, GameObject> { [typeof(ThrustCommand)] = thrustNodePrefab, [typeof(WaitCommand)] = waitNodePrefab, [typeof(ReverseThrustCommand)] = reverseThrustNodePrefab, [typeof(StopCommand)] = stopNodePrefab, [typeof(RotateCommand)] = rotateNodePrefab, }; commandDisplay = FindObjectOfType <CommandDisplay>(); var prevCommands = GameManagerController.Instance.GetPreviousCommands(); Commands = prevCommands ?? new List <Command>(); currentNodeInstance = null; }
void Awake() { instance = this; //Find traits string microgameID = gameObject.scene.name; int difficulty = int.Parse(microgameID.Substring(microgameID.Length - 1, 1)); if (microgameID.Equals("Template")) { microgameID = "_Template1"; } microgameID = microgameID.Substring(0, microgameID.Length - 1); //Get traits from collection if available if (GameController.instance != null) { var collectionMicrogame = MicrogameHelper.getMicrogames(includeBosses: true).FirstOrDefault(a => a.microgameId.Equals(microgameID)); if (collectionMicrogame != null) { traits = collectionMicrogame.difficultyTraits[difficulty - 1]; } } //Get traits from project file if necessary if (traits == null) { traits = MicrogameTraits.findMicrogameTraits(microgameID, difficulty); } debugMode = GameController.instance == null || GameController.instance.getStartScene() == "Microgame Debug"; if (debugMode) { //Debug Mode Awake (scene open by itself) if (MicrogameDebugObjects.instance == null) { SceneManager.LoadScene("Microgame Debug", LoadSceneMode.Additive); } else { MicrogameDebugObjects.instance.Reset(); } if (preserveDebugSpeed > -1) { Debug.Log("Debugging at speed " + preserveDebugSpeed); debugSettings.speed = preserveDebugSpeed; preserveDebugSpeed = -1; } StageController.beatLength = 60f / 130f; Time.timeScale = StageController.getSpeedMult(debugSettings.speed); victory = traits.defaultVictory; victoryDetermined = false; traits.onAccessInStage(microgameID, difficulty); } else if (!isBeingDiscarded()) { //Normal Awake StageController.instance.stageCamera.tag = "Camera"; //Camera.main.GetComponent<AudioListener>().enabled = false; StageController.instance.microgameMusicSource.clip = traits.musicClip; if (traits.hideCursor) { Cursor.visible = false; } commandDisplay = StageController.instance.transform.root.Find("UI").Find("Command").GetComponent <CommandDisplay>(); StageController.instance.resetVictory(); StageController.instance.onMicrogameAwake(); } }
void Start() { if (isBeingDiscarded()) { shutDownMicrogame(); } else { if (debugMode) { //Debug Start MicrogameDebugObjects debugObjects = MicrogameDebugObjects.instance; commandDisplay = debugObjects.commandDisplay; if (debugSettings.localizeText) { LocalizationManager manager = GameController.instance.transform.Find("Localization").GetComponent <LocalizationManager>(); if (!string.IsNullOrEmpty(debugSettings.forceLocalizationLanguage)) { manager.setForcedLanguage(debugSettings.forceLocalizationLanguage); } manager.gameObject.SetActive(true); } MicrogameTimer.instance.beatsLeft = (float)traits.getDurationInBeats() + (debugSettings.simulateStartDelay ? 1f : 0f); if (!debugSettings.showTimer) { MicrogameTimer.instance.disableDisplay = true; } if (debugSettings.timerTick) { MicrogameTimer.instance.invokeTick(); } if (debugSettings.playMusic && traits.musicClip != null) { AudioSource source = debugObjects.musicSource; source.clip = traits.musicClip; source.pitch = StageController.getSpeedMult(debugSettings.speed); if (!debugSettings.simulateStartDelay) { source.Play(); } else { AudioHelper.playScheduled(source, StageController.beatLength); } } if (debugSettings.displayCommand) { debugObjects.commandDisplay.play(traits.localizedCommand); } Cursor.visible = traits.controlScheme == MicrogameTraits.ControlScheme.Mouse && !traits.hideCursor; Cursor.lockState = getTraits().cursorLockState; //Cursor.lockState = CursorLockMode.Confined; debugObjects.voicePlayer.loadClips(debugSettings.voiceSet); } SceneManager.SetActiveScene(gameObject.scene); } }