public void UpdateDisplay(bool flicker = true) { text.SetText("x" + RunState.coal.ToString()); text.color = default; CustomCoroutine.WaitThenExecute(0.1f, () => text.color = textColor); }
private void Attack() { Anim.Play("attack", 0, 0f); releasedAttack = true; CustomCoroutine.WaitThenExecute(0.05f, () => AttackConnect()); attackCooldownCoroutine = StartCoroutine(AttackCooldown()); }
protected virtual void Attack() { target.TakeDamage(damage); Rigidbody enRigidbody = target.GetComponent <Rigidbody>(); if (enRigidbody != null) { enRigidbody.AddForce((target.transform.position - transform.position).normalized * attackPushback, ForceMode.Impulse); } lastAttack = Time.time; following = false; if (slashPref != null) { slash.SetActive(true); slash.transform.position = target.transform.position; CustomCoroutine.WaitThenExecute(1.0f, () => { if (slash != null) { slash.SetActive(false); } } ); } CustomCoroutine.WaitThenExecute(attackCooldown, () => following = true); }
public void NewGame() { Progress.Reset(); ScreenEffects.FadeOut(1.2f); CustomCoroutine.WaitThenExecute(1.2f, () => { SceneManager.LoadScene("Treehouse"); }); }
public void StartStage() { Progress.Save(); GameObject player1 = Instantiate(kid1Pref, kidSpawns[0].position, Quaternion.identity); kids.Add(player1.GetComponent <Kid>()); GameObject player2 = Instantiate(kid2Pref, kidSpawns[1].position, Quaternion.identity); kids.Add(player2.GetComponent <Kid>()); dayText.gameObject.SetActive(true); dayText.transform.SetAsLastSibling(); dayText.text = "Day " + (Progress.Day + 1); dayText.GetComponent <LerpAlpha>().SetAlpha(0.0f); dayText.GetComponent <LerpAlpha>().IntendedAlpha = 1.0f; CustomCoroutine.WaitThenExecute(3.0f, () => { dayText.GetComponent <LerpAlpha>().IntendedAlpha = 0.0f; dayText.transform.SetAsLastSibling(); }); sequencer.StartCoroutine(sequencer.OnStageStarted( () => { state = GameState.Playing; EventManager.QueueEvent(new StageStartedEvent()); } )); }
private IEnumerator SpawnNextWave() { AudioController.Instance.FadeOutLoop(0.6f); yield return(new WaitForSeconds(breakTimes / 4)); string loopToPlay = string.IsNullOrEmpty(CurrentWave.songLoop) ? defaultWaveLoop : CurrentWave.songLoop; AudioController.Instance.SetLoop(loopToPlay); AudioController.Instance.SetLoopVolume(0.0f); AudioController.Instance.FadeInLoop(0.6f, 0.8f); yield return(new WaitForSeconds(breakTimes - breakTimes / 4)); stage.WaveStarted(waveIndex); LerpAlpha textAplha = notifyText.GetComponent <LerpAlpha>(); notifyText.text = "Wave " + (waveIndex + 1); notifyText.transform.SetAsLastSibling(); textAplha.SetAlpha(0.0f); textAplha.IntendedAlpha = 0.8f; CustomCoroutine.WaitThenExecute(1.54f, () => { textAplha.IntendedAlpha = 0.0f; }); foreach (var spawnGroup in CurrentWave.spawnGroups) { StartCoroutine(SpawnGroup(spawnGroup)); } }
private void ShootGun() { gunflare.SetActive(true); CustomCoroutine.WaitThenExecute(0.05f, () => gunflare.SetActive(false)); AudioController.Instance.PlaySound2D("gunshot_2"); RaiderSpawner.Instance.OnRaiderShot(); RunState.bullets--; BulletsDisplay.Instance.UpdateDisplay(); }
public void OnStartButtonClick() { GameMaster.Find().StartGame(); BackgroundAlpha.IntendedAlpha = 0.0f; CustomCoroutine.WaitThenExecute(0.1f, () => { gameObject.SetActive(false); }); }
public void TriggerTransition() { if (fadeObject != null) { fadeObject.SetActive(true); CustomCoroutine.WaitThenExecute(0.25f, LoadScene); } else { LoadScene(); } }
public void GainWeapon(Weapon weapon, bool immediate = true) { weapons.ForEach(x => x.SetActive(false)); CurrentWeaponId = weapon; if (weapon != Weapon.None) { CurrentWeapon.SetActive(true); if (!immediate) { AudioController.Instance.PlaySound2D("misc_crunch_1"); CurrentWeapon.GetComponent <SpriteRenderer>().material = flashWeaponMat; CustomCoroutine.WaitThenExecute(0.1f, () => CurrentWeapon.GetComponent <SpriteRenderer>().material = defaultWeaponMat); } } }
private IEnumerator AttackCoroutine() { LastAttack = Time.time; Following = false; animator.SetTrigger("Attack"); if (waitForAnim) { yield return(new WaitForSeconds(0.65f)); } LaunchProjectile(); CustomCoroutine.WaitThenExecute(attackCooldown, () => Following = true); }
protected override IEnumerator EventSequence() { if (campAudio != null) { CustomCoroutine.WaitThenExecute(2f, () => { campAudio.SetActive(true); AudioController.Instance.FadeOutLoop(2f); }); } if (skipHint != null && returned) { skipHint.SetActive(true); } PlayerController.Instance.enabled = false; yield return(new WaitForSeconds(0.2f)); foreach (DialogueBubble b in dialogueBubbles) { b.gameObject.SetActive(true); yield return(b.PlayDialogue()); yield return(new WaitForSeconds(0.1f)); b.gameObject.SetActive(false); } if (liveComrade != null) { liveComrade.GetComponentInChildren <Animator>().SetTrigger("slide"); Tween.Position(liveComrade, liveComrade.transform.position + (Vector3.right * 12f), 0.5f, 0f, Tween.EaseInOut); yield return(new WaitForSeconds(0.5f)); liveComrade.gameObject.SetActive(false); } if (finale) { yield return(Finale()); } else { PlayerController.Instance.enabled = true; } returned = true; }
private void ProcessInput() { if (submitting) { PlayerManager.ActivePlayers[m_PlayerNum] = true; } if (cancelling) { PlayerManager.ActivePlayers[m_PlayerNum] = false; } if (starting && PlayerManager.ActivePlayers[m_PlayerNum] && PlayerManager.HasEnoughPlayers()) { CustomCoroutine.WaitThenExecute(0.25f, () => SceneManager.LoadScene(2)); fadeOut.SetActive(true); } }
public void StageLost() { if (!Playing) { return; } state = GameState.Lost; Treehouse house = GameObject.FindGameObjectWithTag("Treehouse").GetComponent <Treehouse>(); cameraControl.Focus(house.transform.position); CustomCoroutine.WaitThenExecute(END_GAME_DELAY, () => { gameOverScreen.transform.SetAsLastSibling(); gameOverScreen.SetActive(true); }); }
public void Quit() { ScreenEffects.FadeOut(0.7f); CustomCoroutine.WaitThenExecute(0.7f, () => { Application.Quit(); }); }
public void OnPlayerKilled() { fullScreenBlock.SetActive(true); CustomCoroutine.WaitThenExecute(0f, () => SceneManager.LoadScene("GameOver")); }