mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-26 01:50:57 +00:00
fix nullPointer in autotarget when a child dies
This commit is contained in:
parent
05ef9a9108
commit
324cd76946
@ -56,6 +56,8 @@ public class AutoTarget : MonoBehaviour
|
|||||||
|
|
||||||
foreach (Transform t in targets)
|
foreach (Transform t in targets)
|
||||||
{
|
{
|
||||||
|
if (t == null) continue;
|
||||||
|
|
||||||
Vector3 targetDirection = t.transform.position - transform.position;
|
Vector3 targetDirection = t.transform.position - transform.position;
|
||||||
|
|
||||||
float realAngle = Mathf.Atan2(targetDirection.z, targetDirection.x) * Mathf.Rad2Deg;
|
float realAngle = Mathf.Atan2(targetDirection.z, targetDirection.x) * Mathf.Rad2Deg;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user