private void AttackPlayer() { if (attackDelay.CallDelay()) { player.GetComponent <PlayerManager>().HurtPlayer(playerDamage); } }
/// <summary> /// Shoots Dart /// </summary> private void Shoot() { if (Input.GetAxis("Shoot") == 1 && fireballDelay.CallDelay()) { TowerManager.ShootDart(transform, rotation); } }
private void shoot() { if (shootingDelay.CallDelay()) { pooledShooting.ShootProjectile(pooledShooting.dart, shootingDamage, shootingSpeed, transform.position, gunRotation); } }
// Update is called once per frame void Update() { if (logoDelay.CallDelay()) { spriteRenderer.sprite = logoSprites[spriteIndex++]; } }
/// <summary> /// Called by UPDATE method to have the mana regen /// </summary> private void ManaRegen() { if (currentPlayerManaCap > currentPlayerMana && manaDelay.CallDelay()) { currentPlayerMana += manaRegenAmount; uiController.UpdatePlayerMana(currentPlayerMana); } }
void Update() { targetList.RemoveAll(item => item == null); //Removes GameObject from list if it is destroyed before update is called again if (punchTowerAnimator.GetBool("Punching") && punchRate.CallDelay()) { foreach (GameObject target in targetList.ToArray()) { target.GetComponent <Health>().HurtGameObject(damage); } } if (targetList.Count == 0) { punchTowerAnimator.SetBool("Punching", false); } }
/// <summary> /// Build a tower /// </summary> private void BuildTower() { if (Input.GetAxis("SpellCast") != 0) { if (axisInUse == false) { clickDownMousePosition = mousePosition; clickLocationSpriteTemp = Instantiate(clickLocationSprite, new Vector3(Mathf.RoundToInt(mousePosition.x), Mathf.RoundToInt(mousePosition.y), 0), Quaternion.identity); axisInUse = true; } } if (Input.GetAxis("SpellCast") == 0 && axisInUse == true && spellCastDelay.CallDelay()) { TowerManager.PlaceTower(currentTower, mousePosition, clickDownMousePosition); Destroy(clickLocationSpriteTemp); axisInUse = false; } }
/// <summary> /// Select which tower is toggled /// </summary> void TowerSelect() { if (Input.GetAxis("SpellSelect") == 1 && towerSelectDelay.CallDelay()) { if (currentTower != numberOfTowers - 1) { currentTower++; } else { currentTower = 0; } TowerToggle(currentTower); } else if (Input.GetAxis("SpellSelect") == -1 && towerSelectDelay.CallDelay()) { if (currentTower != 0) { currentTower--; } else { currentTower = numberOfTowers - 1; } TowerToggle(currentTower); } else if (Input.GetAxis("Spell1") == 1 && towerSelectDelay.CallDelay()) { currentTower = 0; TowerToggle(currentTower); } else if (Input.GetAxis("Spell2") == 1 && towerSelectDelay.CallDelay()) { currentTower = 1; TowerToggle(currentTower); } else if (Input.GetAxis("Spell3") == 1 && towerSelectDelay.CallDelay()) { currentTower = 2; TowerToggle(currentTower); } else if (Input.GetAxis("Spell4") == 1 && towerSelectDelay.CallDelay()) { currentTower = 3; TowerToggle(currentTower); } }