0906
This commit is contained in:
1 parent
5cd7a93c4a
commit
1476a089cb
108 files changed
+32073
-117261
No files matched your search
@@ -28,6 +28,13 @@ public class Projectile : MonoBehaviour
|
||||
initialized = true;
|
||||
hasHit = false;
|
||||
|
||||
// The projectile uses its own raycast hit check. Disable the collider so
|
||||
// it cannot be destroyed or disturbed by the owner's launch socket.
|
||||
foreach (var collider in GetComponentsInChildren<Collider>(true))
|
||||
{
|
||||
collider.enabled = false;
|
||||
}
|
||||
|
||||
if (lifetime > 0f)
|
||||
{
|
||||
Destroy(gameObject, lifetime);
|
||||
@@ -107,14 +114,14 @@ public class Projectile : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
WorldHealthBar healthBar = hitObject.GetComponentInParent<WorldHealthBar>();
|
||||
if (healthBar == null)
|
||||
UnitBase targetUnit = hitObject.GetComponentInParent<UnitBase>();
|
||||
if (targetUnit == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hasHit = true;
|
||||
healthBar.TakeDamage(damage);
|
||||
targetUnit.ReceiveDamage(damage, owner);
|
||||
if (registerEnergyOnHit && owner != null)
|
||||
{
|
||||
UnitBase unit = owner.GetComponent<UnitBase>();
|
||||
|
||||
Reference in new issue
Block a user