scripts 1 var

This commit is contained in:
lapich committed 2026-03-19 02:02:28 +03:00
1 parent 6df424ea8e
commit 1798ac3fc5
10 files changed
+364

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
using UnityEngine;
using System.Collections;
public class Face : Align
{
protected GameObject targetAux;
public override void Awake()
{
base.Awake();
targetAux = target;
target = new GameObject();
target.AddComponent<Agent>();
}
void OnDestroy()
{
Destroy(target);
}
public override Steering GetSteering()
{
Vector3 direction = targetAux.transform.position - transform.position;
if (direction.magnitude > 0.0f)
{
float targetOrientation = Mathf.Atan2(direction.x, direction.z);
targetOrientation *= Mathf.Rad2Deg;
target.GetComponent<Agent>().orientation = targetOrientation;
}
return base.GetSteering();
}
}