This commit is contained in:
MrTorex committed 2026-02-10 12:35:10 +03:00
1 parent a70076ebe9
commit 854835878c
20 files changed
+2542

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
using Code.Base;
using UnityEngine;
namespace Code.Lab3
{
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()
{
var direction = TargetAux.transform.position - transform.position;
if (direction.magnitude <= 0) return base.GetSteering();
var targetOrientation = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
target.GetComponent<Agent>().orientation = targetOrientation;
return base.GetSteering();
}
}
}