void AttackTimer() { if (detectedTowerList.Count > 0) { //Debug.Log("攻击一次"); Tower detectedTowerComp = detectedTowerList[0].GetComponent <Tower>(); float enemyAttackPower_final = BasicInfo.calcuteAttackPower(enemyAttackPower, this.enemyAttr, detectedTowerComp.towerAttr); detectedTowerComp.GetAttacked(enemyAttackPower_final); } else { TimersManager.ClearTimer(AttackTimer); } }
// MARK: - Timer public void timeCount() { if (timerCount == 0) { Debug.Log("Count finish"); timerText.text = GameManager.Instance.timerCount.ToString(); TimersManager.ClearTimer(timeCount); GameManager.Instance.gameTrigger = false; GameManager.Instance.turn++; turnText.text = GameManager.Instance.turn.ToString(); airyUIAnimationManager.ShowMenu(); return; } timerCount--; timerText.text = timerCount.ToString(); }
// Update is called once per frame void Update() { textoHp.text = "HP T" + time + ": " + Hp; walk(); if (powerUp.RemainingLoopsCount() <= 0) { TimersManager.ClearTimer(absolutelyNotSuperStar); GetComponent <Renderer>().material.color = corInicial; speed = speedInicial; } switch (id) { case 1: if (Input.GetKeyDown(KeyCode.KeypadEnter)) { shootAt(); } break; case 2: if (Input.GetKeyDown(KeyCode.F)) { shootAt(); } break; case 3: if (Input.GetKeyDown(KeyCode.Return)) { shootAt(); } break; case 4: if (Input.GetKeyDown(KeyCode.F)) { shootAt(); } break; } }
// Update is called once per frame void Update() { textoScore.text = "SCORE: " + pontuação; if (Input.GetKeyDown(KeyCode.R)) { TimersManager.ClearTimer(spawnInimigo); TimersManager.ClearTimer(scoreRate); TimersManager.ClearTimer(spawnPowerUp); Destroy(timeManager); SceneManager.LoadScene(0); } if (isGameOver) { panelGameOver.SetActive(true); } }
// 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 AttackTimer() { if (detectedEnemyList.Count > 0) { //Debug.Log("攻击一次"); if (towerAttackScope > 0)//攻击范围大于0 { List <Vector2> offList = new List <Vector2>(); for (int i = 1; i <= towerAttackScope; ++i) { for (int j = 0; j <= i; ++j) { int k = i - j; if (j > 0 && k == 0) { offList.Add(new Vector2(j, k)); offList.Add(new Vector2(-j, k)); } else if (j == 0 && k > 0) { offList.Add(new Vector2(j, k)); offList.Add(new Vector2(j, -k)); } else if (j > 0 && k > 0) { offList.Add(new Vector2(j, k)); offList.Add(new Vector2(-j, k)); offList.Add(new Vector2(j, -k)); offList.Add(new Vector2(-j, -k)); } } } List <Vector2> gridPosList = new List <Vector2>(); foreach (Vector2 off in offList) { Vector2 pos = new Vector2((float)Mathf.Floor(detectedEnemyList[0].transform.position.x) + 0.5f, (float)Mathf.Floor(transform.position.z) + 0.5f); pos += off; gridPosList.Add(pos); } List <Vector2> enemyPosList = new List <Vector2>(); List <GameObject> enemyList = GeneralPool.get_enemyList(); foreach (GameObject enemy in enemyList) { Vector2 pos = new Vector2((float)Mathf.Floor(enemy.transform.position.x) + 0.5f, (float)Mathf.Floor(enemy.transform.position.z) + 0.5f); enemyPosList.Add(pos); } List <GameObject> detectedEnemyList_inAttackScope = new List <GameObject>(); detectedEnemyList_inAttackScope.Add(detectedEnemyList[0]); for (int i = 0; i < enemyPosList.Count; i++) { for (int j = 0; j < gridPosList.Count; j++) { if (enemyPosList[i] == gridPosList[j]) { detectedEnemyList_inAttackScope.Add(enemyList[i]); } } } foreach (GameObject detectedEnemy_inAttackScope in detectedEnemyList_inAttackScope) { Enemy detectedEnemyComp_inAttackScope = detectedEnemy_inAttackScope.GetComponent <Enemy>(); float towerAttackPower_final = BasicInfo.calcuteAttackPower(towerAttackPower, this.towerAttr, detectedEnemyComp_inAttackScope.enemyAttr); detectedEnemy_inAttackScope.GetComponent <Enemy>().GetAttacked(towerAttackPower_final); } } else { Enemy detectedEnemyComp = detectedEnemyList[0].GetComponent <Enemy>(); float towerAttackPower_final = BasicInfo.calcuteAttackPower(towerAttackPower, this.towerAttr, detectedEnemyComp.enemyAttr); detectedEnemyComp.GetAttacked(towerAttackPower_final); } } else { TimersManager.ClearTimer(AttackTimer); } }
public void StopSpawn() { TimersManager.ClearTimer(Tick); }
private void StopAutoTick() { View.autoTickClick -= StopAutoTick; View.autoTickClick += StartAutoTick; TimersManager.ClearTimer(AutoTick); }