void Start() { m_isActive = true; if (m_mapsButtons.Length != m_sceneNames.Length) { throw new System.Exception("There are different number of buttons and scenes related."); } for (int i = 0; i < m_mapsButtons.Length; ++i) { Button button = m_mapsButtons[i]; m_mapsButtons[i].onClick.AddListener(() => RaceButtonPressed(button)); } if (m_raceModesButtons.Length < 1) { throw new System.Exception("There are no race mode buttons"); } for (int i = 0; i < m_raceModesButtons.Length; ++i) { Button button = m_raceModesButtons[i]; m_raceModesButtons[i].onClick.AddListener(() => RaceModeButtonPressed(button)); } m_closeRaceModeScreen.onClick.AddListener(() => CloseRaceModeScreen()); HideRaceModeScreen(); m_sceneMaster = FindObjectOfType <SceneMaster>(); if (m_sceneMaster == null) { throw new System.Exception("Scene Master not found."); } }
// [[ ----- AWAKE ----- ]] // Logic that should be called once, the first time initialized private void Awake() { Scene scene = SceneManager.GetActiveScene(); levelID = scene.name; pauseGame = false; // if SceneMaster exists from a previous level, delete it if (SceneMaster.active != null) { if (SceneMaster.active.LevelID != scene.name) { Destroy(SceneMaster.active.gameObject); SceneMaster.active = null; Debug.Log("Active SceneMaster not for this level, deleted"); // if SceneMaster exists for this level, delete this instance } else { Debug.Log("SceneMaster already exists for this level, deleting"); Destroy(gameObject); } } // if no SceneMaster is active, make this the active manager if (SceneMaster.active == null) { SceneMaster.active = this; Debug.Log("No active SceneMaster found, making this active"); DontDestroyOnLoad(this); } }
public void Start() { spawnedPanel = false; sceneMaster = GameObject.FindGameObjectWithTag("Scene Master").GetComponent <SceneMaster>(); canvas = GameObject.FindGameObjectWithTag("Canvas"); CannonPicker(rootCannon); }
public VRTK.VRTK_SDKManager SDKManager() { if (!_SDKManager) { var temp = GameObject.FindGameObjectWithTag("SDKManager"); if (temp) { _SDKManager = temp.GetComponent <VRTK.VRTK_SDKManager>(); } if (!_SDKManager) { _SDKManager = Instantiate(sdkManagerPrefab, Vector3.zero, Quaternion.identity); } } else if (!GameMaster.Instance.SceneMaster.IsInCurrentScene(_SDKManager.gameObject)) { SceneMaster.MoveToScene(_SDKManager.gameObject); } else if (_SDKManager.transform.parent == transform) { transform.parent = null; } return(_SDKManager); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); sceneM = GameObject.FindGameObjectWithTag("SceneMaster").GetComponent <SceneMaster>(); losePanel = GameObject.Find("LosePanel").GetComponent <Image>(); winPanel = GameObject.Find("WinPanel").GetComponent <Image>(); }
public void Quit() { FindObjectOfType <AudioManager>().Stop("Game"); FindObjectOfType <AudioManager>().Play("Title"); SceneMaster.OpenMainMenu(); PausePanel.SetActive(false); gameoverpanel.SetActive(false); }
//functionality moved on to the GameStarter // Use this for initialization void OnLevelWasLoaded() { return; if (GoogleAPI.s != GetComponent <GoogleAPI> ()) { return; } if (SceneMaster.GetSceneID() != 3) { return; } print("onlevelwasloaded"); GameObject bg = GameObject.Find("BG"); if (bg != null) { if (GS.a.bgSprite != null) { bg.GetComponentInChildren <Image> ().sprite = GS.a.bgSprite; } if (GS.a.bgAnimation != null) { bg.GetComponentInChildren <AnimatedSpriteController> ().SetAnimation(GS.a.bgAnimation); } } try{ GameObject.Find("Daragon Text").GetComponent <Text> ().text = GS.a.startingText; GameObject.Find("Daragon Image").GetComponent <Image> ().sprite = GS.a.startingImage; }catch { } /*if (GS.a.npcSettings.isNPC) { * GameObject logic = GameObject.Find ("_Logic"); * NPCBehaviour toAdd = logic.AddComponent (GS.a.npcSettings.npcScript.GetType()) as NPCBehaviour; * logic.GetComponent<GameStarter> ().toCall [0] = toAdd; * toAdd.SelectorObject = GS.a.npcSettings.SelectorObject; * toAdd.activatePrefab = GS.a.npcSettings.activatePrefab; * toAdd.normalSelectEffect = GS.a.npcSettings.normalSelectEffect; * }*/ /*if (GS.a.npcSettings.isNPC) { * GameObject mynpc = (GameObject)Instantiate (GS.a.npcSettings.npcObject); * mynpc.GetComponent<_NPCBehaviour> ().enabled = false; * * GameObject.Find ("_Logic").GetComponent<GameStarter> ().toCall [0] = mynpc.GetComponent<_NPCBehaviour> (); * } */ if (GS.a.customObject != null) { Instantiate(GS.a.customObject); } Invoke("LateBegin", 0.1f); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
void Start() { if (!ValidMove()) { // Game over FindObjectOfType <GameUi>().GameOver(); SceneMaster.PauseGame(); } if (firstRun) { FindObjectOfType <BlockSpawnScript>().GetGrid(grid); firstRun = false; } }
private void Update() { if (aniMan.WasHit && timer > 100) { aniMan.WasHit = false; timer = 0; } timer++; if (!IsAlive) { SceneMaster.OpenMainMenu(); } }
private void Start() { Debug.Log(JsonUtility.ToJson(new StuffConfig { stuffFactory = StuffFactory.Instance })); Instance = this; //InitializeStages(); InitializeStuffs(); m_StageImage = GetComponent <RawImage>(); }
void Start() { moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); sceneM = GameObject.FindGameObjectWithTag("SceneMaster").GetComponent <SceneMaster>(); player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <Player>(); spitScript = spitPrefab.GetComponent <BossSpite>(); if (miniRangedBoss) { GetComponentInChildren <SpriteRenderer>().sprite = leftBoss; } else { GetComponentInChildren <SpriteRenderer>().sprite = rightBoss; } }
public void OnHeadClick() { if (this.state == State.WaitingHeadClick) { this.state = State.MoveToMouse; head.OpenTheMouse(); StartCoroutine(ShowMoveToMouseAnimation()); } else if (this.state == State.WaitEyeClick) { this.state = State.Eating; head.StopBlinkEyes(); StartCoroutine(ShowEatAnimation()); } else if (this.state == State.WaitEnd) { SceneMaster.Restart(); } }
void Awake() { if (loadingScreen != null) { loadingScreen.SetActive(false); } if (s != null && s != this) { Destroy(this.gameObject); return; } else { s = this; } curScene = SceneManager.GetActiveScene().buildIndex; }
private void Awake() { m_carCount = 1; m_mainCarId = 0; m_sceneMaster = FindObjectOfType <SceneMaster>(); m_raceCamera = GameObject.FindGameObjectWithTag("RaceCamera").GetComponent <CameraController>(); if (m_raceCamera == null) { Debug.Log("RaceCamera not found"); } m_race = GameObject.FindGameObjectWithTag("Race"); ChangeState(RaceState.Loading); if (m_debugModeOn) { SetUpRaceManager(RaceMode.Solo); } }
public void OnLeftRoom() { DataLogger.LogMessage("Left Room"); showingWaitingRoom = false; canPlay = true; if (SceneMaster.GetSceneID() != SceneMaster.menuId) { if (GameObjectiveMaster.s != null) { GameObjectiveMaster.s.DisconnectedFromGame(); } else { SceneMaster.s.LoadMenu(); } } else { VC_MultiplayerMenuController.SetSearchingPanelState(false); } searchingForGame = false; // display error message and go back to the menu screen gameInProgress = false; if (PlayGamesPlatform.Instance != null) { if (PlayGamesPlatform.Instance.localUser.authenticated) { canPlay = true; } //Login (); //MultiplayerMenuController.s.UpdateMenu (); } // (do NOT call PlayGamesPlatform.Instance.RealTime.LeaveRoom() here -- // you have already left the room!) }
void Start() { m_isActive = true; if (m_buttons.Length != m_sceneNames.Length) { throw new System.Exception("There are different number of buttons and scenes related."); } for (int i = 0; i < m_buttons.Length; ++i) { Button button = m_buttons[i]; m_buttons[i].onClick.AddListener(() => MapButtonPressed(button)); } m_sceneMaster = FindObjectOfType <SceneMaster>(); if (m_sceneMaster == null) { throw new System.Exception("Scene Master not found."); } }
// Update is called once per frame void Update() { if (!SceneMaster.getIsGamePaused())//if game is not paused (if game is running) { elapsedSeconds += Time.deltaTime; if (PlayTime.TotalSeconds > SecondsToAdd && SecondsToAdd > 5)//everytime play time is longer than duration { //increase player speed playerMovement.IncreaseSpeed(.4f); if (obstacleSpawner.SpawnTime > 1.5) { //spawn obstacles faster obstacleSpawner.SpawnTime -= .2f; } //decrease the time of the seconds to add SecondsToAdd -= 2; } } }
private void Awake() { if (!_instance && GameObject.FindGameObjectsWithTag("GameController").Length == 1) { //This gameObject becomes persistent if there are no other gameMasters. DontDestroyOnLoad(this.gameObject); _instance = this; } else { Destroy(this.gameObject); } //Creates an instance of these if not found. SceneBehaviour(); SDKManager(); //Controller references in sdk are usually f****d, this ensures they are right. ControllerSetter.ResetControllers(); //Call awake in scenemaster. SceneMaster.MasterAwake(); }
void Start() { m_isActive = true; if (!m_isDebugModeOn) { m_sceneMaster = FindObjectOfType <SceneMaster>(); if (m_sceneMaster == null) { throw new System.Exception("Scene Master not found."); } } // Spawn Point if (m_spawnPoint == null) { throw new System.Exception("Spawn Point not set."); } // End Point if (m_endPoint == null) { throw new System.Exception("End Point not set."); } if (!m_endPoint.isTrigger) { throw new System.Exception("End Point's BoxCollider2D is not set as trigger."); } // Player if (m_playerPrefab == null) { throw new System.Exception("Player Prefab not set."); } m_playerObject = Instantiate(m_playerPrefab, m_spawnPoint); if (m_playerObject == null) { throw new System.Exception("Player Prefab couldn't be instantiated."); } m_playerController = m_playerObject.GetComponent <PlayerController>(); if (m_playerController == null) { throw new System.Exception("PlayerController not found in Player Prefab instance."); } m_playerController.m_levelManager = this; // Camera if (m_levelCamera == null) { throw new System.Exception("Level Camera not found."); } m_cameraController = m_levelCamera.GetComponent <CameraController>(); if (m_cameraController == null) { throw new System.Exception("Camera Controller not found in Level Camera."); } // Boundaries if (m_cameraBoundaries == null) { throw new System.Exception("Camera Boundaries not set."); } // Set up Level Camera with Player gameObject and Camera Boundaries m_cameraController.m_target = m_playerObject; m_cameraController.m_boundaries = m_cameraBoundaries; m_cameraController.SetUp(); }
private void Awake() { m_sceneMaster = FindObjectOfType <SceneMaster>(); m_raceManager = FindObjectOfType <RaceManager>(); m_mainMenuButton.onClick.AddListener(MainMenuButtonPressed); }
// Update is called once per frame public void Pause() { SceneMaster.PauseGame(); PausePanel.SetActive(true); }
public void Continue() { SceneMaster.ContinueGame(); PausePanel.SetActive(false); }
void Start() { singleton = this; }
void Awake() { singleton = this; }
// Start is called before the first frame update void Start() { gameMaster = DebugUtils.GetGameMaster(); sceneMaster = gameMaster.GetComponent <SceneMaster>(); }
public void PauseGame() { SceneMaster.PauseGame(); PauseScreen.SetActive(true); }
public void ContinueGame() { PauseScreen.SetActive(false); SceneMaster.ContinueGame(); }
public void QuitGame() { SceneMaster.OpenMainMenu(); }
public void PlayGame() { SceneMaster.OpenGameScene(); }