public void Fire() { if (Time.time > fireCooldown) { fireCooldown = Time.time + 1f / MaxProjectilePerSec; ShipCannon.Fire(gameObject); } }
void Fire() { if (playerShip) { var fireDirection = playerShip.transform.position - transform.position; UfoCannon.transform.rotation = Quaternion.LookRotation(Vector3.forward, fireDirection); UfoCannon.Fire(gameObject); } ScheduleNextFire(); }
private IEnumerator MakeFireRoutine() { var delay = new WaitForSeconds(shotDelay); while (active) { cannon.Fire(); yield return(delay); } }
// ---- event handlers ---- protected void mouseClickHandler(int buttonID) { if (buttonID == MouseButton.LEFT) { if (cannon) { cannon.Fire(); } } }
void Update() { if (lastMsg != null) { var tokens = lastMsg.Split('|'); float x = float.Parse(tokens[0]); float y = -float.Parse(tokens[1]); float time = int.Parse(tokens[2]); cannon.Fire(x, y, time); lastMsg = null; } }
private IEnumerator procFire() { while (!isHittable()) { yield return(null); } yield return(null); cannon.Fire(); yield return(null); StartCoroutine(procFire()); }
// Update is called once per frame void Update() { switch (GameManager.state) { case GameManager.GameState.running: if (life <= 0) { GameManager.state = GameManager.GameState.gameOver; } if (Input.GetMouseButtonDown(0)) //press left click { Vector3 clickPos = Camera.main.ScreenToWorldPoint( new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); cannon.Fire(clickPos); } break; } }
void Update() { // movement moveUp = Input.GetKey(KeyCode.UpArrow); moveDown = Input.GetKey(KeyCode.DownArrow); moveLeft = Input.GetKey(KeyCode.LeftArrow); moveRight = Input.GetKey(KeyCode.RightArrow); if (moveUp || moveDown || moveLeft || moveRight) { updateMove(); } // fire fire = Input.GetKeyDown(KeyCode.Space); if (fire) { cannon.Fire(); } }
void Rndnum() { randomNumber = Random.Range(1, 5); if (randomNumber == 1) { Cannon1.Fire(); } if (randomNumber == 2) { Cannon2.Fire(); } if (randomNumber == 3) { Cannon3.Fire(); } if (randomNumber == 4) { Cannon4.Fire(); } }
private void CannonFire() { cannon.Fire(); }
private void Fire(Vector3 currentPosition) { Cannon.Fire(currentPosition); }