public void Fire() { shot(); fireController.RemoveFireContoller(); fireController = null; TimersManager.SetTimer(this, WeaponReloadTime, () => { SetFireController(); }); }
private void OnRecivedSystemTxtHandler(object value) { txtTips.gameObject.SetActive(true); txtTips.text = value.ToString(); // Invoke("OnDelayTimeHandler", 2); TimersManager.SetTimer(this, 2, OnDelayTimeHandler); }
IEnumerator TimeOver() { yield return(new WaitForSeconds(3)); TimersManager.SetTimer(this, 1f, 60, Timer); TimersManager.SetPaused(Timer, true); }
// Start is called before the first frame update private void Start() { isMenu = SceneManager.GetActiveScene().name == "Menu"; if (!isMenu) { timerEnemySpawn = new Timer(1 / enemyPerSecond, Timer.INFINITE, spawnEnemy); TimersManager.SetTimer(this, timerEnemySpawn); GameObject[] aux = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < aux.Length; i++) { if (i >= players_Ref.Length) { break; } players_Ref[i] = aux[i].GetComponent <Player>(); } if (!twoPlayers) { players_Ref[1].gameObject.SetActive(false); } if (!gameOverText || gameOverText == null) { gameOverText = GameObject.Find("Game Over Text").GetComponent <TextMeshProUGUI>(); gameOverText.enabled = false; } } }
void Start() { m_PointLight = gameObject.GetComponent <Light>(); // set a timer that calls ChangeIntensity() every 0.1 seconds TimersManager.SetLoopableTimer(this, 0.1f, ChangeIntensity); TimersManager.SetTimer(this, 5f, delegate { Destroy(this); }); }
private void Spawn() { GameObject go = GameObject.Instantiate(objectsToSpawn[Random.Range(0, objectsToSpawn.Length)], cachedTransform); go.transform.localPosition = Vector3.zero; npcRuntimeSet.KeyPair[go.GetInstanceID()].navigation.SetTarget(initialDestination); TimersManager.SetTimer(this, Random.Range(minSpawnInterval.value, maxSpawnInterval.value), Spawn); }
private void EndScene() { sceneOngoing = false; for (int i = 0; i < sceneRoles.Length; i++) { sceneRoles[i].ReleaseAllRoles(); } onSceneEnd.Invoke(); TimersManager.SetTimer(this, reactivationTime.value, ReactivateScene); }
public void UpdateEnemyByState() { if (!dieAlready) { switch (enemyState) { case BasicInfo.enemyStates.Walk: { pathMoveTween.Play(); //modelAnim.Play("walk"); if (enemyLastState == BasicInfo.enemyStates.Attack) { transform.DOLookAt(pathList[nextWayPointIndex], 0.3f, AxisConstraint.Y, Vector3.up); } break; } case BasicInfo.enemyStates.Stop: { pathMoveTween.Pause(); //modelAnim.Play("idle"); break; } case BasicInfo.enemyStates.Attack: { pathMoveTween.Pause(); transform.DOLookAt(detectedTowerList[0].transform.position, 0.3f, AxisConstraint.Y, Vector3.up); modelAnim.Play("attack"); //Debug.Log("检测到塔"); //Debug.Log (2 / enemyAttackSpeed); if (TimersManager.GetTimerByName(AttackTimer) == null) { TimersManager.SetTimer(this, 1f, AttackTimer); } break; } default: { break; } } } }
private void StartZone() { for (int i = 0; i < sceneRoles.Length; i++) { sceneRoles[i].StartScene(); } if (!sceneOngoing) { sceneOngoing = true; TimersManager.SetTimer(this, sceneDuration.value, EndScene); } }
void Update() { if (TimersManager.RemainingTime(Timer) == -1) { TimersManager.SetTimer(this, 0f, delegate { Destroy(this); }); TB.GetComponent <Text>().text = "Time Over"; StartCoroutine("TimeOver"); } else { TB.GetComponent <Text>().text = "残り時間:" + (int)TimersManager.RemainingTime(Timer) + "秒"; } }
// Update is called once per frame void Update() { //Debug.Log(healthBarDefineTransform.position); healthBarTransform.position = Camera.main.WorldToScreenPoint(healthBarDefineTransform.position); Detect(); if (detectedEnemyList.Count > 0) { //Debug.Log("侦测到敌人"); if (TimersManager.GetTimerByName(AttackTimer) == null) { TimersManager.SetTimer(this, 1f, AttackTimer); } } }
private void OnTriggerEnter(Collider other) { if (other.transform.CompareTag("Bullet") || other.transform.CompareTag("Inimigo")) { Hp -= 5; Destroy(other.gameObject); } if (other.transform.CompareTag("PowerUp")) { powerUp = new Timer(0.1f, (uint)(powerUpDuration / 0.1), absolutelyNotSuperStar); TimersManager.SetTimer(this, powerUp); Destroy(other.gameObject); } }
void Update() { if (currentSection == null) { if (!win) { TimersManager.SetTimer(this, 0.5f, delegate { SceneManager.LoadScene("GameWin"); }); win = true; } return; } if (audioSource.time > currentSection.endTime) { if (nextSectionId >= level.sectionList.Count) { EndGame(); return; } else { NextSection(); } } if (currentSection.playStartTime <= audioSource.time && audioSource.time <= currentSection.playEndTime) { if (currentSection.GetType() == typeof(RepeatSection)) { CheckInput(currentSection as RepeatSection); } } if ((Input.GetKeyDown(KeyCode.X))) { progressBar.DOKill(); progressBar.value = 0; } }
// Start is called before the first frame update void Start() { menu = GameObject.FindGameObjectWithTag("Menu").GetComponent <Menu>(); menu.gameObject.SetActive(false); players = new Player[PlayerPrefs.GetInt("playerQuantity")]; for (int i = 0; i < PlayerPrefs.GetInt("playerQuantity"); i++) { if (i >= playersPrefabs.Length) { break; } Player p = Instantiate(playersPrefabs[i], new Vector3(2 * i, (float)0.5, 0), Quaternion.identity).GetComponent <Player>(); p.id = i + 1; if (PlayerPrefs.GetInt("peopleInTeamOne") > 0) { p.time = 1; PlayerPrefs.SetInt("peopleInTeamOne", PlayerPrefs.GetInt("peopleInTeamOne") - 1); } else { p.time = 2; } players[i] = p; } TimersManager.SetLoopableTimer(this, enemyTimeRate, spawnInimigo); TimersManager.SetLoopableTimer(this, scoreTimeRate, scoreRate); TimersManager.SetLoopableTimer(this, powerUpTimeRate, spawnPowerUp); //---------- TimersManager.SetTimer(this, scoreTimer); TimersManager.ClearTimer(EmptyTimer); lastDamageTakenTime = Time.time; }
void Preview(RepeatSection section) { foreach (var beat in section.previewBeatList) { if (!string.IsNullOrEmpty(beat.animationState)) { float animAdvancedTime = level.animationStateAdvanceTime[level.animationStateNames.IndexOf(beat.animationState)]; TimersManager.SetTimer(this, beat.time - audioSource.time - animAdvancedTime, delegate { enemyUpperAnimator.Play(beat.animationState); }); } TimersManager.SetTimer(this, beat.time - audioSource.time, delegate { audioSource.PlayOneShot(beat.audioEffect); Destroy(throwable); if (beat.randomThrowable) { throwable = Instantiate(level.throwablePrefabList[Random.Range(0, level.throwablePrefabList.Count)], throwableRoot.transform); } else { throwable = Instantiate(beat.throwable, throwableRoot.transform); } Debug.Log("咳嗽"); }); } section.miss = false; section.currentPlayBeat = section.playBeatList[0]; section.nextHitIndex = 1; foreach (var beat in section.playBeatList) { beat.hasClicked = false; beat.hasHit = false; } }
public void ResetTimer() { TimersManager.SetTimer(this, 1f, 60, Timer); TimersManager.SetPaused(Timer, true); }
public void StartTimer() { TimersManager.SetTimer(this, 1f, 60, Timer); }
void Start() { TimersManager.SetTimer(this, 1f, 60, Timer); TimersManager.SetPaused(Timer, true); }
private void Tick() { addEnemyToList(customizer.EnemySpawn(spawner)); TimersManager.SetTimer(this, Random.Range(minTimeSpawn, maxTimeSpawn), Tick); }
private void AutoTick() { Tick(); TimersManager.SetTimer(this, View.GetDelay(), AutoTick); }