コード例 #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
ファイル: StateAtaque.cs プロジェクト: vitorcm2/JogosDigitais
    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
ファイル: GameManager.cs プロジェクト: Speedwagon13/Moonshot
        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);
        }
コード例 #7
0
 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();
    }
コード例 #10
0
 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
ファイル: ChaseState.cs プロジェクト: HenryRocha/harbs-shmup
    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;
        }
    }