private void Awake() { if (Instance == null) { Instance = this; } }
public IEnumerator SetUpGameState(LevelSpawner lSpawner, int levelTime, string levelName, BallMovement playerB) { playerBall = playerB; gamePaused = true; playerBall.gamePaused = true; pauseButton.Pause(); playerStarted = false; timeText.color = new Color(0.749f, 0.749f, 0.749f); levelSpawner = lSpawner; currentLevelTime = levelTime; currentLevel = levelName; timeText.text = levelTime.ToString("0000"); livesText.text = currentLives.ToString("00"); //Play Teleport In Animation + Sound playerAnim = playerBall.GetComponent <Animator>(); audioSource.PlayOneShot(teleportIn); playerAnim.Play("teleportIn"); yield return(new WaitForSeconds(teleportIn.length)); playerStarted = true; gamePaused = false; playerBall.gamePaused = false; pauseButton.UnPause(); }
// Start is called before the first frame update void Start() { GetComponent <Renderer>().enabled = false; foodEaten = 0; foodLeftToSpawn = new List <GameObject>(); //Set children in list for (int i = 0; i < transform.childCount; i++) { GameObject child = transform.GetChild(i).gameObject; //Only add food into the list (Not markers!) if (child.name[0] == 'F') { foodLeftToSpawn.Add(child); } } //Disable all children so they can wait for their turn for (int i = 0; i < foodLeftToSpawn.Count; i++) { //Also set them to trigger ActivateFood() upon them being collected. foodLeftToSpawn[i].GetComponent <SnakeFood>().ExtraCollectEvent = new SnakeFood.OnCollect(ActivateFood); foodLeftToSpawn[i].SetActive(false); } pointer = GameObject.Find("CubeArrow").GetComponent <LookAtCube>(); levelSpawner = GameObject.Find("LevelSpawner").GetComponent <LevelSpawner>(); ActivateFood(); }
void Start() { if (LevelSpawner.GetCurrentLevel() == null) { LevelSpawner.SpawnNewLevel(); } Upgrades.SetupUpgrades(); }
public static void StartNewStream(string streamName) { instance.streamNumber++; instance.currentStreamString.text = streamName; instance.gold = 0; Upgrades.PurgeUpgradesForStream(); Upgrades.SetupUpgrades(); LevelSpawner.ResetLevel(); }
// Update is called once per frame void FixedUpdate() { if (willDealDamage && currentTarget != null) { //If dealing damage completes level if (currentTarget.DealDamage(damageToDealPerUpdate)) { LevelSpawner.SpawnNewLevel(); } } }
public LevelGraphMessageReceiver( NetworkRelay relay, LevelGraphState graphState, GenericMessageWithResponseClient sender, LevelSpawner levelSpawner) { _relay = relay; _sender = sender; _levelSpawner = levelSpawner; _graphState = graphState; }
void Start() { current_game_condition = GameCondition.running; archer = GameObject.FindObjectOfType <Archer>(); status_text = GameObject.FindObjectOfType <StatusText>(); level_spawner = GetComponentInChildren <LevelSpawner>(); typing_controller = GetComponentInChildren <TypingController>(); var my_text_source = GetComponent <TextSource>(); }
void Awake() { if (instance != null) { DestroyImmediate(this); } else { instance = this; } }
void Start() { Time.timeScale = 1; ai = AI.instance; //Spawn Level levelSpawner = this.GetComponent <LevelSpawner>(); tileList = levelSpawner.SpawnLevel(Data.currentData.ChosenLevel); playerController.ApplyUpgrades(); playerController.OnTurnStart(); playersTurn = true; }
protected void Start() { powerups = GameObject.FindObjectOfType <Powerups> (); if (LevelManager.instance.gameState == LevelManager.GameState.InLevel) { lvlSpawner = (LevelSpawner)Powerups.spawner; } else if (LevelManager.instance.gameState == LevelManager.GameState.InTutorial) { tutSpawner = (BaseTutorialSpawner)Powerups.spawner; } }
// Use this for initialization void Awake() { instance = this; // Populating the map with tubes, so it is not empty at start for (int i = 0; i < 15; i++) { GameObject go = (GameObject)Instantiate(tubePrefab); LevelModule l = go.GetComponent<LevelModule>(); l.position = i*tubeLength-offset; l.transform.position = new Vector3(0, -4.5f, l.position-distance+offset); tubes.Add(l); } }
public static bool CheckForFarthestLevel() { //Lot of level spawners here... LevelSpawner levelSpawner = GameObject.Find("LevelSpawner").GetComponent <LevelSpawner>(); if (levelSpawner.GetLevel() > farthestLevel) { farthestLevel = levelSpawner.GetLevel(); return(true); } return(false); }
protected override void Awake() { base.Awake(); lerpManager = GetComponent <PointLerp>(); _gameManager = GetComponent <GameStart>(); arrowManager = GetComponent <DirectionArrows>(); // Different classes containing functionality made for better overview levelLerpManager = new LevelLerp(this, lerpManager, pointManager, meshManager, playerManager, arqdutManager, _gameManager); // TODO warning about using new keyword. Seems like it thinks I'm trying to add classes as components circleLerpManager = new LevelLerpCircle(this, lerpManager, pointManager, meshManager, playerManager, arqdutManager, _gameManager, arrowManager); levelSpawner = new LevelSpawner(this, circleLerpManager, pointManager, playerManager, meshManager, arqdutManager, _gameManager); }
void Start() { platformSpawner = FindObjectOfType <LevelSpawner>(); startPosition = transform.position; GameLogic gameLogic = FindObjectOfType <GameLogic>(); gameLogic.OnReadyToPlay += PrepareForGame; gameLogic.OnStartPlaying += MoveToNextPlatform; gameLogic.OnGameOver += OnGameFailed; timeBetweenPlatforms = FindObjectOfType <BallBouncer>().GetJumpTime(); }
private void Start() { main = this; // make the starting section GameObject newSection = Instantiate(forwardTilePrefab, new Vector3(0, -1, 0), Quaternion.identity, this.transform); nextSpawnLocation = newSection.transform.Find("EndPoint").transform; // make other sections for (int i = 0; i < 10; i++) { SpawnNextTile(); } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "PlayerOne" && !hasTriggered || other.gameObject.tag == "PlayerTwo" && !hasTriggered) //If a collision with the player happened and we haven't transitioned to a new level { LevelSpawner lvlSpawner = GameObject.FindGameObjectWithTag("LevelSpawner").GetComponent <LevelSpawner>(); LevelManager.requiredScore += 8000; //Set a new required score for the next stage LevelManager.currentPlayerScore = PlayerController.points; //Update the current player score LevelManager.playerMoney = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <PlayerController>().money; //Update the current player money LevelManager.playerLives = GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <PlayerController>().lives; //Update the current player lives if (GameObject.FindGameObjectWithTag("PlayerTwo")) { LevelManager.playerTwoMoney = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <PlayerController>().money; //Update the current player money LevelManager.playerTwoLives = GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <PlayerController>().lives; //Update the current player lives } LevelManager.level++; //Tell the LevelManager we have progressed one level lvlSpawner.moneyHasSpawned = false; //Set it so that money hasn't spawned lvlSpawner.obstaclesHasSpawned = false; //Set it so that obstacles hasn't spawned lvlSpawner.moneySpawns.Clear(); //Empty the moneySpawns list so we can have a fresh list in the next level LevelManager.tempCashCounter = lvlSpawner.cashCounter; //Reset the cash counter GameObject.FindGameObjectWithTag("PlayerOne").GetComponent <PlayerController>().gameObject.transform.position = new Vector3(-450.4f, 245.9f, 0); //Set the player's position to the spawn if (GameObject.FindGameObjectWithTag("PlayerTwo")) { GameObject.FindGameObjectWithTag("PlayerTwo").GetComponent <PlayerController>().gameObject.transform.position = new Vector3(-450.4f, 245.9f, 0); } hasTriggered = true; //Set it so the transition has been triggered to prevent an eternal loop LevelManager.bankDestroyed = false; //string nextLevel = LevelManager.levelList[Random.Range(0, LevelManager.levelList.Length)]; //SceneFadingManager.BeginFade (); GameObject.Find("Bank").GetComponent <BankWhiteFade>().faded = false; GameObject.Find("Bank").GetComponent <BankWhiteFade>().doOnce = false; GameObject.Find("Bank").GetComponent <BankWhiteFade>().whiteTexture.enabled = false; BankWhiteFade.duration = 2.5f; SceneManager.LoadScene("StageComplete"); //Load the next level //SceneFadingManager.OnLevelWasLoaded (); } }
public void InstantiatePlayer() { if(Application.loadedLevel == 1 && instantiateCounter == 0){ print("Check"); levelManager = GameObject.Find("LevelSpawnManager"); levelSpawner = levelManager.GetComponent<LevelSpawner>(); Instantiate(player, levelSpawner.spawnPosition, Quaternion.identity); //GameObject.Find("ExplodingBarrel").GetComponent<Exploding_Barrels>().player = GameObject.Find("PlayerTest(Clone)"); instantiateCounter += 1; } if(Application.loadedLevel == 0 && instantiateCounter == 1){ instantiateCounter = 0; Time.timeScale = 1f; } }
void Init() { Application.targetFrameRate = 120; _pool = new ObjectsPool(new GameObject("_ObjectsPool").transform, _objectsConfig); _soundController.Init(_soundsConfig); _spawner = new PatternSpawner(_pool); _levelSpawner = new LevelSpawner(_spawner); _menusFactory = new ShowableFactory(_menuConfig); _navigationController = new MenuNavigationController(_menusFactory, _menusParent, _popUpsParent, _canvasGroup); _soundController.PlayMusic(AudioClipType.MainMusic); _startPos = _player.transform.position; AddResetable(_camera); UpdateState(); }
// Use this for initialization void Start() { // Start timer a little bit along obstacleSpawnTimer = OBSTACLE_SPAWN_INTERVAL / 2; rampSpawnTimer = RAMP_SPAWN_INTERVAL / 2 - 10; cashSpawnTimer = 0; levelEndSpawnTimer = 0; slalomTimer = 0; bonusTimer = 0; currentSlalomCheckpointCount = 0; currentBonusCashCount = 0; slalomEvent = false; bonusEvent = false; stopSpawning = false; spawner = SpawnerObj.GetComponent <LevelSpawner>(); levelObj = GameObject.FindGameObjectWithTag("World"); // QualitySettings.vSyncCount = 0; // VSync must be disabled // Application.targetFrameRate = 15; OGYeti.SetActive(false); LankyYeti.SetActive(false); FemaleYeti.SetActive(false); switch (YetiGameData.SelectedYeti) { case YetiGameData.YetiType.NormalYeti: OGYeti.SetActive(true); break; case YetiGameData.YetiType.LankyYeti: LankyYeti.SetActive(true); break; case YetiGameData.YetiType.FemaleYeti: FemaleYeti.SetActive(true); break; default: OGYeti.SetActive(true); break; } }
private void Start() { if (main != null) { Destroy(this); } else { main = this; } MakeStartingSection(); // make the first 10 for (int i = 0; i < (numberOfTilesAtATime - 1); i++) { SpawnNextTile(); } }
// Use this for initialization void Start() { //Spawn Level levelSpawner = this.GetComponent <LevelSpawner>(); tileList = levelSpawner.SpawnTiles(5, 5); //Spawn Units //Test: Spawn on Tile(3)(1) if (GameObject.Find("Tile(3)(1)") != null) { GameObject spawnOnTile = GameObject.Find("Tile(3)(1)"); Vector3 position = new Vector3(spawnOnTile.transform.position.x, unitHeight, spawnOnTile.transform.position.z); GameObject tmpUnit = Instantiate(testUnit, position, Quaternion.identity); tmpUnit.GetComponent <Unit> ().Setup(spawnOnTile); tmpUnit.GetComponent <Unit> ().OwnedByPlayer = true; spawnOnTile.GetComponent <Tile> ().SetUnit(tmpUnit); } //Disable UI (Cleanup) unitControl.SetActive(false); }
//Start is called before first frame void Start() { GameObject manager = GameObject.Find("Manager"); currency = manager.GetComponent <Currency>(); health = manager.GetComponent <Lives>(); highScore = manager.GetComponent <HighScore>(); waveSpawner = manager.GetComponent <LevelSpawner>(); //get reference to the currency UGUI GameObject currencyObj = GameObject.FindGameObjectWithTag("Currency"); currencyText = currencyObj.GetComponent <TextMeshProUGUI>(); //get reference to the currency UGUI GameObject livesObj = GameObject.FindGameObjectWithTag("Lives"); currencyText = livesObj.GetComponent <TextMeshProUGUI>(); waypoints = Waypoints.waypoints; //set initial waypoint currentWaypoint = waypoints[waypointIndex]; }
private void Start() { levelSpawner = GetComponentInParent <LevelSpawner>(); }
public LevelManager(LevelSpawner levelSpawner) { this.levelSpawner = levelSpawner; }
public void OnEnable() { if (DebugSlowMo) { Time.timeScale = 0.4f; AudioSource.pitch = 0.4f; } else { Time.timeScale = 1f; AudioSource.pitch = 1f; } Spawning = false; Updating = true; GameOver = false; _started = false; if (PlayerData.Instance.Scores[CurrentLevel] != "0") { BT.gameObject.SetActive(true); BestTimeText.gameObject.SetActive(true); BestTimeText.text = PlayerData.Instance.Scores[CurrentLevel]; } else { BT.gameObject.SetActive(false); BestTimeText.gameObject.SetActive(false); } Enemies.Clear(); TickAction = () => { }; GameOverAction += () => { if (KillerUnit != null) { UnitHint.CreateUnitText("^\nAVENGE", KillerUnit); } }; _levelSpawner = new LevelSpawner(CurrentLevel); _grid = new Grid(30); if (!NextLevelStart) { Player.Prefab.Instantiate(); StartedLevel = CurrentLevel; } else { InitPos(Player.Instance); } var offset = LevelSpawner.Distance; Action a = () => { }; Action ad = () => Player.Instance.TakeDmg(Player.Instance, 999); if (CurrentLevel == 0 && !Tutorial) { GridMarks.Instance.Set("", "", -1, 1, -offset, offset, a, a, true, true); GridMarks.Instance.DisplayBorders(true, false); GridMarks.Instance.RemoveTint(-1); GridMarks.Instance.RemoveTint(1); } else { GridMarks.Instance.Set("", "", -1, 1, -offset, offset, ad, ad, true, true); GridMarks.Instance.RemoveTint(-1); GridMarks.Instance.RemoveTint(1); GridMarks.Instance.LeftSolid = false; GridMarks.Instance.RightSolid = false; GridMarks.Instance.DisplayBorders(false); } if (Tutorial) { GridMarks.Instance.HandlerLeft = a; GridMarks.Instance.HandlerRight = a; GridMarks.Instance.LeftSolid = true; GridMarks.Instance.RightSolid = true; GridMarks.Instance.DisplayBorders(true, false); } GridMarks.Instance.RemoveTint(0); if (!IsFirstStart && Tutorial) { MusicDelay = 0.88f; MusicStart = 2f; } IsFirstStart = false; if (Tutorial && ControlsText.isActiveAndEnabled) { var c = ControlsText.color; c.a = 1; ControlsText.color = c; var ut = ControlsText.GetComponent <UnitedTint>(); c = ut.Color; c.a = 1; ut.Color = c; } else { StartLevel(); } }
private void Awake() { Instance = this; }
/***********************************/ /* INIT */ /***********************************/ public void Init() { manager = GameObject.Find("Manager"); spawner = manager.GetComponent <LevelSpawner>(); }
public MenuState(MainMenu mainMenu, LevelSpawner levelSpawner) { this.mainMenu = mainMenu; this.levelSpawner = levelSpawner; }
void Start() { _levelSpawner = FindObjectOfType <LevelSpawner>(); _raycastManager = FindObjectOfType <ARRaycastManager>(); _arPlaneManager = FindObjectOfType <ARPlaneManager>(); }
void Awake() { lSpawner = this; }
private void Awake() { levelSpawner = FindObjectOfType <LevelSpawner>(); }