// Use this for initialization void Start() { currentHealthPoints = maxHealthPoints; terrainControl = FindObjectOfType <TerrainControl>(); EnviromentTile[] Tiles = FindObjectsOfType <EnviromentTile>(); foreach (EnviromentTile tile in Tiles) { if (tile.ObjectHeld == this.gameObject) { TileOn = tile; } } loseScreen = FindObjectOfType <LoseScreen>(); winScreen = FindObjectOfType <WinScreen>(); if (loseScreen != null) { loseScreen.gameObject.SetActive(false); } if (winScreen != null) { winScreen.gameObject.SetActive(false); } }
// Use this for initialization void Start() { sp = FindObjectOfType <Spawn>(); losing = FindObjectOfType <LoseScreen>(); HomeBase = FindObjectOfType <Base>(); winlose = losing.GetComponent <Text>(); }
public void AddHealth(float amount) { healthPoints += amount; if (gameObject.name.Contains("Enemy")) { healthBar.fillAmount = healthPoints / startHealth; } if (gameObject.name.Contains("Player")) { PlayerHealthOverlay.SetActive(true); } // Die if (healthPoints <= 0) { if (gameObject.name.Contains("Enemy")) { Destroy(gameObject); WinScreen.SetActive(true); Time.timeScale = 0.0f; } if (gameObject.name.Contains("Player")) { Destroy(gameObject); LoseScreen.SetActive(true); Time.timeScale = 0.0f; } } }
void Configure_Environment() { Lightening.SetActive(true); StartCoroutine(doLight()); float darkpercentage = (float)((float)wrongeOnes / (float)TotalDecisions); Darker.vignette.intensity = 1.5f * darkpercentage; float lightpercentage = (float)((float)correctOnes / (float)TotalDecisions); Lighter.settings.intensity = 0.25f * lightpercentage; if (DecisionCounter >= TotalDecisions) { character.Interacting = true; if (correctOnes >= 10) { winScreen.SetActive(true); // Win.. print("win.."); } else { LoseScreen.SetActive(true); print("lose.."); // Lose.. } StartCoroutine(LoadDelayedScene()); } }
void StartState(GameState pGameState) { switch (pGameState) { case GameState.STARTSCREEN: _startScreen = new StartScreen(this); AddChild(_startScreen); break; case GameState.OPENINGSCREEN: _openingScreen = new OpeningScreen(this); AddChild(_openingScreen); break; case GameState.LEVEL: _level = new Level(this); _player = _level.GetPlayer(); AddChild(_level); break; case GameState.LOSESCREEN: _loseScreen = new LoseScreen(this, _player); AddChild(_loseScreen); break; case GameState.WINSCREEN: _winScreen = new WinScreen(this, _player); AddChild(_winScreen); break; default: break; } }
void StartGame() { GameIsStarted = true; WinScreen.SetActive(false); LoseScreen.SetActive(false); StartCoroutine(SpawnBottles()); }
public static void GameOver() { GameObject r = Resources.Load("Prefabs/GameOverScreen") as GameObject; GameObject g = Instantiate(r); Time.timeScale = 0; LoseScreen l = g.GetComponent <LoseScreen>(); l.StartCoroutine(l.ShowGameOver()); }
public void GameOver() { foreach (BalloonController balloon in AIBalloons) { balloon.active = false; } FinalProfit.text = score.ToString(); GameUI.SetActive(false); LoseScreen.SetActive(true); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
void Start() { playerCM = GameObject.FindGameObjectWithTag(Constants.TAG_PLAYER_CARD_MANAGER).GetComponent <PlayerCardManager>(); // eventCM = GameObject.FindGameObjectWithTag(Constants.TAG_EVENT_CARD_MANAGER).GetComponent<EventCardManager>(); supplyCM = GameObject.FindGameObjectWithTag(Constants.TAG_SUPPLY_CARD_MANAGER).GetComponent <SupplyCardManager>(); winScreen = GetComponent <WinScreen>(); loseScreen = GetComponent <LoseScreen>(); InitializeGame(); }
/// <summary> /// Shows the lose screen /// </summary> public void Lose() { Sounds.Play("lose.mp3"); Reset(); Loop.Stop(); _screenLose = new LoseScreen(); Canvas.SetLeft(_screenLose, 0); Canvas.SetTop(_screenLose, 0); DrawingPanel.Children.Add(_screenLose); }
void Update() { if (isLose) { LoseScreen.SetActive(true); playertouch.enabled = false; generator.enabled = false; timer += 0.02f; loseScoreText.text = Mathf.RoundToInt(Mathf.Lerp(0, PlayerTouch.score, timer)).ToString(); } }
public void OnEnd() { // Goes to the game over screen Form form = this.FindForm(); LoseScreen ls = new LoseScreen(); ls.Location = new Point((form.Width - ls.Width) / 2, (form.Height - ls.Height) / 2); form.Controls.Add(ls); form.Controls.Remove(this); }
public override void GetHurt(float rawatk) { if (invincibleTime <= 0) { invincibleTime = 1.5f; hp -= 1; if (hp <= 0) { LoseScreen.GameOver(); } } }
public void Lose() { Debug.Log("Lose"); Save_Prefs(); Time.timeScale = 0f; finalScore.text = coinCount.ToString(); Menu.enabled = false; LoseScreen.SetActive(true); if (i == 1) { soundEffector.PlayLoseSound(); } i = 0; }
// Use this for initialization void Start() { //currentHealthPoints = maxHealthPoints; cardObject = GetComponent <CardObject>(); terrainControl = FindObjectOfType <TerrainControl>(); loseScreen = FindObjectOfType <LoseScreen>(); winScreen = FindObjectOfType <WinScreen>(); if (loseScreen != null) { loseScreen.gameObject.SetActive(false); } if (winScreen != null) { winScreen.gameObject.SetActive(false); } }
// Update is called once per frame void Update() { if (target == null) // if their is no target { for (int i = 0; i < AIList.Count; i++) // find all AI { countDown = AIList[i].pawn.DoIdle(AIList[i].speed, countDown); // change look direction after count down if (countDown < 0) // if countdown is less than 0 { countDown = startPoint; // reset countdown } } } if (target != null) // if their is a target { if (target.GetComponent <AIController>() != null) // make sure the target has an AI component { FSM(); // run Finite State Mahcine } } if (playerHealth.value <= 0 && gameIsRuning) // if the player's health reaches 0 and game is running { lose = true; // Game is over and player lost } if (win || lose) // if lose or win condition is meet { Time.timeScale = 0; // freeze motion gameIsRuning = false; // game is not runnign if (win) // if win { winScreen.SetActive(true); // show win screen win = false; // Reset win to false } else // otherwise if lose { LoseScreen.SetActive(true); // show lose screen lose = false; // Reset lose to false } } }
public void LevelLose() { StopEnemiesMovement(); LoseScreen.Open(); }
public void StopState(GameState pGameState) { switch (pGameState) { case GameState.STARTSCREEN: if (_startScreen != null) { _startScreen.Destroy(); _startScreen = null; } break; case GameState.OPENINGSCREEN: if (_openingScreen != null) { _openingScreen.Destroy(); _openingScreen = null; } break; case GameState.LEVEL: if (_level != null) { if (_level.GetHud() != null) { _level.GetHud().Destroy(); } if (_level.GetBackground() != null) { _level.GetBackground().Destroy(); if (_level.GetBackground().GetBackDrop() != null) { _level.GetBackground().GetBackDrop().Destroy(); } if (_level.GetBackground().GetMidGround() != null) { _level.GetBackground().GetMidGround().Destroy(); } } if (_level.GetForeGround() != null) { _level.GetForeGround().Destroy(); } _level.Destroy(); _level = null; } break; case GameState.LOSESCREEN: if (_loseScreen != null) { _loseScreen.Destroy(); _loseScreen = null; } break; case GameState.WINSCREEN: if (_winScreen != null) { _winScreen.Destroy(); _winScreen = null; } break; default: break; } }
public void LevelLose() { StopEnemiesMovement(); Cursor.visible = true; LoseScreen.Open(); }