Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/Entity/AIBase.cs

35 lines
750 B
C#

using System.Collections.Generic;
using UnityEngine;
namespace Entity
{
public abstract class AIBase
{
public virtual bool Run(Entity target)
{
foreach (var aiBase in children)
{
if (aiBase.Run(target))
return true;
}
return false;
}
public List<AIBase> children=new();
}
public class ContinuousMove : AIBase
{
override public bool Run(Entity target)
{
target.gameObject.transform.position +=
Time.deltaTime * target.runtimeAttributes.moveSpeed * target.direction;
return true;
}
}
public class TrackPlayer : AIBase
{
}
}