Nextrek
Diff Revisions
141
vs
144
for /3DSpace/Assets/Custum/Scripts/EnemyShip.cs
|
@@ -13,6 +13,7 @@ |
13 |
13 |
|
public float fireRate = 0.5f; |
14 |
14 |
|
public float reloadTime = 5.0f; |
15 |
15 |
|
public float shootRange = 2000.0f; |
|
16 |
+ |
public float fireTemp = 5f; |
16 |
17 |
|
|
17 |
18 |
|
public Vector3[] weaponMountPoints; |
18 |
19 |
|
public Transform laserShotPrefab; |
|
@@ -91,6 +92,7 @@ |
91 |
92 |
|
|
92 |
93 |
|
void Update() |
93 |
94 |
|
{ |
|
95 |
+ |
fireTemp -= Time.deltaTime; |
94 |
96 |
|
//Transform spaceShip = GameManager.Instance.spaceShip; |
95 |
97 |
|
//if (spaceShip==null) return; |
96 |
98 |
|
_timer += Time.deltaTime; |
|
@@ -130,7 +132,9 @@ |
130 |
132 |
|
|
131 |
133 |
|
if (availableShoots > 0) { |
132 |
134 |
|
availableShoots--; |
|
135 |
+ |
|
133 |
136 |
|
Fire(); |
|
137 |
+ |
|
134 |
138 |
|
timeToShot += fireRate; |
135 |
139 |
|
} else { |
136 |
140 |
|
timeToShot = reloadTime; |
|
@@ -145,23 +149,18 @@ |
145 |
149 |
|
|
146 |
150 |
|
void Fire() |
147 |
151 |
|
{ |
148 |
|
- |
foreach (Vector3 _wmp in weaponMountPoints) |
149 |
|
- |
{ |
150 |
|
- |
Vector3 _pos = transform.position + transform.right * _wmp.x + transform.up * _wmp.y + transform.forward * _wmp.z; |
151 |
|
- |
if(shipType==ShipType.SMALL_SHIP) |
152 |
|
- |
{ |
153 |
|
- |
WeaponFireUtils.FireLaser(laserShotPrefab, _pos, this.transform.rotation, this.gameObject, GameManager.ALLY_TAG); |
154 |
|
- |
} |
155 |
|
- |
else |
156 |
|
- |
{ |
157 |
|
- |
WeaponFireUtils.FireLaserTurret(laserShotPrefab, _pos, this.transform.rotation, this.gameObject, GameManager.ALLY_TAG); |
|
152 |
+ |
foreach (Vector3 _wmp in weaponMountPoints) { |
|
153 |
+ |
Vector3 _pos = transform.position + transform.right * _wmp.x + transform.up * _wmp.y + transform.forward * _wmp.z; |
|
154 |
+ |
if (shipType == ShipType.SMALL_SHIP) { |
|
155 |
+ |
WeaponFireUtils.FireLaser (laserShotPrefab, _pos, this.transform.rotation, this.gameObject, GameManager.ALLY_TAG); |
|
156 |
+ |
} else { |
|
157 |
+ |
WeaponFireUtils.FireLaserTurret (laserShotPrefab, _pos, this.transform.rotation, this.gameObject, GameManager.ALLY_TAG); |
158 |
158 |
|
} |
159 |
159 |
|
} |
160 |
160 |
|
|
161 |
|
- |
if (soundEffectFire != null) |
162 |
|
- |
{ |
163 |
|
- |
audio.PlayOneShot(soundEffectFire); |
164 |
|
- |
} |
|
161 |
+ |
if (soundEffectFire != null) { |
|
162 |
+ |
audio.PlayOneShot (soundEffectFire); |
|
163 |
+ |
} |
165 |
164 |
|
} |
166 |
165 |
|
|
167 |
166 |
|
void DoSmallShip(Transform spaceShip) |