void SpawnBetterCube() { int selectValue = Mathf.RoundToInt(Mathf.Lerp(1, Simulation.Instance.highestCubeLevel - 1, Random.value)); Debug.Log("SelectValue: " + selectValue); CubeSpawner spawnerThatCanSpawn = null; CubeSpawner testedSpawner = this; while (spawnerThatCanSpawn == null && testedSpawner.nextSpawner != null) { if (selectValue <= testedSpawner.maxLevel) { spawnerThatCanSpawn = testedSpawner; } else { testedSpawner = testedSpawner.nextSpawner; } } if (spawnerThatCanSpawn == null) { Debug.LogWarning("No spawner for cube level: " + selectValue + " could be found. Spawning a basic block instead."); SpawnCube(); } else { luckyLabel.gameObject.SetActive(true); luckyLabel.SetLevel(selectValue); spawnerThatCanSpawn.SpawnCube(selectValue); } }
public void FakePlacement() { if (someScriptHolder.gameIsPaused == false) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } if (missCount >= 3) { //LastCube = null; //CurrentCube = null; //SceneManager.LoadScene(0); loseScreen.SetActive(true); } else { spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); if (cubeSpeed <= finalCubeSpeed) { cubeSpeed += speedIncrement; } } } }
public void BuyButtonClicked() { if (SpawnPrice <= Simulation.Instance.Gold) { Simulation.Instance.Gold -= SpawnPrice; spawner.SpawnCube(spawner.baseSpawnLevel); buyCount += 1; } }
/// <summary> /// Старт игры / рождение платформы /// </summary> private void StartGame() { Debug.Log(GameStatus.ToString()); if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } currentSpawner = spawners[UnityEngine.Random.Range(0, spawners.Length)]; currentSpawner.SpawnCube(); OnCubeSpawned(); camera.Next_Position(currentSpawner.transform.localScale.y); }
void Update() { if (Input.GetButtonDown("Fire1")) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { if (MovingCube.currentCube != null) { MovingCube.currentCube.StopCube(); } spawner_index = spawner_index == 0 ? 1 : 0; currentSpawner = spawners[spawner_index]; currentSpawner.SpawnCube(); _score.IncreaseScore(); } }
void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); } }
private void Update() { if (Input.GetButtonDown("Fire1")) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.StopCube(); } _spawnerIndex = _spawnerIndex == 0 ? 1 : 0; _currentSpawner = _spawners[_spawnerIndex]; _currentSpawner.SpawnCube(); onCubeSpawned(); } }
void Update() { switch (gameState) { case GameState.StartGame: scoreText.SetMenuText(); break; case GameState.SpawnCube: if (!MovingCube.StopSpawnCube) { spawnerIndex = UnityEngine.Random.Range(0, cubeSpawners.Length); currentSpawner = cubeSpawners[spawnerIndex]; currentSpawner.SpawnCube(); CameraMove(); gameState = GameState.CropCube; } break; case GameState.CropCube: break; } if (Input.GetMouseButtonDown(0) && gameState == GameState.StartGame) { gameState = GameState.SpawnCube; } if (Input.GetMouseButtonDown(0) && gameState == GameState.CropCube) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); OnCubeSpawned?.Invoke(); gameState = GameState.SpawnCube; } } }
private void Update() { if (Input.GetButtonDown("Fire1")) { if (someScriptHolder.gameIsPaused == false) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } if (missCount >= 3) { //LastCube = null; //CurrentCube = null; //SceneManager.LoadScene(0); loseScreen.SetActive(true); } else { spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); if (cubeSpeed <= finalCubeSpeed) { cubeSpeed += speedIncrement; } //MovingCube.moveSpeed = cubeSpeed; } //Test For Placement Zones /* * * get ingredient object * reference PlacementZoneCheck.difference * if (difference <= perf) * { * * run snap function * * } * else if (difference >= miss) * { * missCount++; * } * else * { * * } * * * */ } } }