コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     //Debug Shoot code, can't test on pc using the thumbstick and buttons so we need keyboard controls
     if (Input.GetKey(KeyCode.Space) && Time.time > nextShot)
     {
         nextShot = Time.time + shotInterval;
         attachTurretSystem.ShootingRoutine();
     }
     if (allowShot && Time.time > nextShot)
     {
         nextShot = Time.time + shotInterval;
         attachTurretSystem.ShootingRoutine();
     }
 }
コード例 #2
0
 private void Update()
 {
     //follow the movement behaviour based on path length and looping
     ActivateBehaviour();
     //enemies with turret system should only be allowed to shot when the enemy is in the same screen area
     //as the play, a.k.a. the player area
     if (IsEnemyInView() || shipTurrets.test == true)
     {
         //get the current speed of the enemy as it is used by the turret system to fire bullets
         shipTurrets.GetShipSpeed(thisShip.GetCurrentSpeed());
         //start the shooting routine, that follows rules set in the editor
         shipTurrets.ShootingRoutine();
     }
 }