22 lines
749 B
C#
22 lines
749 B
C#
using UnityEngine;
|
|
|
|
public class OffensiveBehaviour : AbstractBehaviour
|
|
{
|
|
protected override void MoveAction()
|
|
{
|
|
if (CurrentMinecraftUnit.IsTeamA)
|
|
{
|
|
if (GlobalsVariable.QueenB == null) return;
|
|
}
|
|
else
|
|
{
|
|
if (GlobalsVariable.QueenA == null) return;
|
|
}
|
|
|
|
CurrentMinecraftUnit.MovementHandler.TargetUnit = CurrentMinecraftUnit.IsTeamA ? GlobalsVariable.QueenB : GlobalsVariable.QueenA;
|
|
Vector3 targetPos = CurrentMinecraftUnit.MovementHandler.TargetUnit.transform.position;
|
|
Vector3 goalPos = targetPos + (transform.position - targetPos).normalized * distanceGoal;
|
|
CurrentMinecraftUnit.MovementHandler.MoveTowards(goalPos);
|
|
}
|
|
|
|
}
|