// Update is called once per frame void Update() { timeFromLastFile += Time.deltaTime; if (Input.GetButton("Vertical")) { //Debug.Log("Thrusting!!"); mThruster.Thrust(Input.GetAxis("Vertical")); } if (Input.GetButton("Horizontal")) { mTurner.Turn(-1 * Input.GetAxis("Horizontal")); } if (Input.GetButtonDown("Fire1")) { if (timeFromLastFile >= fireRate) { mShooter.Shoot(); if (shootSfx1 && shootSfx2 && shootSfx3 && shootSfx4 && shootSfx5 && shootSfx6 && shootSfx7) { SoundManager.instance.PlayRandomSfx(shootSfx1, shootSfx2, shootSfx3, shootSfx4, shootSfx5, shootSfx6, shootSfx7); } timeFromLastFile = 0; } } }
public override void Update() { if (gm.gameState != GameManager.GameState.GAME) { return; } Vector2 direction = new Vector2(GameObject.FindWithTag("Player").transform.position.x - transform.position.x, GameObject.FindWithTag("Player").transform.position.y - transform.position.y); direction.Normalize(); steerable.Thrust(direction.x, direction.y); if (Vector3.Distance(transform.position, GameObject.FindWithTag("Player").transform.position) > 1f) { RotateTowards(GameObject.FindWithTag("Player").transform.position); } if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public void Update() { if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public override void Update() { //TODO: Movimentação quando atacando if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public void Update() { if (gm.gameState != GameManager.GameState.GAME) { return; } if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public IEnumerator Shoot() { overviewUI.SetActive(false); var shotCmd = shooter.Shoot(currentGolfingPosition, Vector3.up); yield return(shotCmd.Run()); var results = shotCmd.Results(); currentGolfingPosition = results.WhereShotEndedUp; normal = results.Normal; overviewUI.SetActive(true); }
public override void Update() { //TODO: Movimentação quando atacando if (gm.gameState != GameManager.GameState.GAME) { return; } if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public override void Update() { if (gm.gameState != GameManager.GameState.GAME) { return; } //TODO: MOV QUANDO ATACANDO if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public override void Update() { //TODO: Movimentação quando atacando // angle += 0.1f * Time.deltaTime; // Mathf.Clamp(angle, 0.0f, 2.0f * Mathf.PI); // float x = Mathf.Sin(angle) ; // float y = Mathf.Cos(angle); // steerable.Thrust(y, y); if (Time.time - _lastShootTimestamp < shootDelay) { return; } _lastShootTimestamp = Time.time; shooter.Shoot(); }
public void TryShoot() { if (BattleStats.CurrentEnergy < BattleStats.CurrentWeapon.ShootCost) { return; } if (!_weaponSpeedController.CanShoot(BattleStats.CurrentWeapon)) { return; } _shooter.Shoot(BattleStats.CurrentWeapon); BattleStats.CurrentEnergy -= BattleStats.CurrentWeapon.ShootCost; if (OnEnergyChanged != null) { OnEnergyChanged(BattleStats.CurrentWeapon.ShootCost); } if (Math.Abs(BattleStats.CurrentWeapon.Cooldown) > _TOLERANCE) { _weaponSpeedController.BlockWeapon(BattleStats.CurrentWeapon, BattleStats.CurrentWeapon.Cooldown); } }
public override void Update() { if (Time.time - _lastShootTimestamp > shootDelay) { _lastShootTimestamp = Time.time; shooter.Shoot(); } if (Vector3.Distance(transform.position, waypoint.position) > 2.0f) { Vector3 direction = waypoint.position - transform.position; direction.Normalize(); float rot_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0f, 0f, rot_z); steerable.Thrust(direction.x, direction.y); } else { waypoint.position = GameObject.FindWithTag("Player").transform.position; } }