i’m having requirement to my game i.e.,enemy wants to attack on a gameobject(character or model) with different actions at different range of distance.
can anyone suggest me the way to write the script and explain the same?
thanks in advance…
i’m having requirement to my game i.e.,enemy wants to attack on a gameobject(character or model) with different actions at different range of distance.
can anyone suggest me the way to write the script and explain the same?
thanks in advance…
Use this distance script to set permitters for how you want your AI to act at certain distances.
var distance;
var target : Transform;
function Update ()
{
distance = Vector3.Distance(target.position, transform.position);
if(distance < whatever you want)
{
Do what you want
{
else if(distance < whatever you want)
{
Do what you want
{