示例#1
0
    // 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;
            }
        }
    }
示例#2
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();
    }
示例#3
0
 public void Update()
 {
     if (Time.time - _lastShootTimestamp < shootDelay)
     {
         return;
     }
     _lastShootTimestamp = Time.time;
     shooter.Shoot();
 }
示例#4
0
    public override void Update()
    {
        //TODO: Movimentação quando atacando

        if (Time.time - _lastShootTimestamp < shootDelay)
        {
            return;
        }
        _lastShootTimestamp = Time.time;
        shooter.Shoot();
    }
示例#5
0
 public void Update()
 {
     if (gm.gameState != GameManager.GameState.GAME)
     {
         return;
     }
     if (Time.time - _lastShootTimestamp < shootDelay)
     {
         return;
     }
     _lastShootTimestamp = Time.time;
     shooter.Shoot();
 }
示例#6
0
        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();
 }
示例#8
0
    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();
    }
示例#9
0
    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);
     }
 }
示例#11
0
    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;
        }
    }