Example #1
0
    protected void CheckTargetReach()
    {
        switch (legsState)
        {
        case LegsState.Idle:
            break;

        case LegsState.MovingToPosition:

            if ((targetPosition - myPosition.position).sqrMagnitude < dtrmSqTargetPositionReach)
            {
                legsState = LegsState.Idle;
                SendTargetReachMessage();
                StopMovement();
            }
            break;

        case LegsState.PursuingTarget:

            if ((targetActor.position - myPosition.position).sqrMagnitude < dtrmSqTargetPositionReach)
            {
                legsState = LegsState.Idle;
                SendTargetReachMessage();
                StopMovement();
            }
            break;

        case LegsState.FollowingTarget:
            Debug.LogWarning("Shouldn't be checking target reach in this state!");
            break;

        default:
            Debug.LogError("Unknown state!");
            break;
        }
    }
Example #2
0
    void Update()
    {
        if (legsState == LegsState.Idle)
            return;

        if ( ReachedTarget() ) {
            legsState = LegsState.Idle;
            return;
        }

        if (legsState == LegsState.MovingToPosition )
            MoveTowards(targetPosition);
        else
            MoveTowards(targetTransform.position);
    }
Example #3
0
 public void Stop()
 {
     legsState = LegsState.Idle;
 }
Example #4
0
 public void Pursue(Transform actor)
 {
     legsState = LegsState.PursuingTransform;
     targetTransform = actor;
 }
Example #5
0
 public void Move(Vector3 position)
 {
     legsState = LegsState.MovingToPosition;
     targetPosition = position;
 }
Example #6
0
 public void Follow(Transform actor)
 {
     legsState = LegsState.FollowingTransform;
     targetTransform = actor;
 }
Example #7
0
 public void FollowTarget(DTRMPosition target)
 {
     legsState = LegsState.FollowingTarget;
     targetActor = target;
 }
Example #8
0
 public override void DTRMStart()
 {
     legsListeners = GetComponents(typeof(ILegsListener));
     legsState = LegsState.Idle;
 }
Example #9
0
    protected void CheckTargetReach()
    {
        switch(legsState) {

            case LegsState.Idle:
                break;

            case LegsState.MovingToPosition:

                if ( (targetPosition - myPosition.position).sqrMagnitude < dtrmSqTargetPositionReach ) {

                    legsState = LegsState.Idle;
                    SendTargetReachMessage();
                    StopMovement();

                }
                break;

            case LegsState.PursuingTarget:

                if ( ( targetActor.position - myPosition.position ).sqrMagnitude < dtrmSqTargetPositionReach ) {

                    legsState = LegsState.Idle;
                    SendTargetReachMessage();
                    StopMovement();

                }
                break;

            case LegsState.FollowingTarget:
                Debug.LogWarning("Shouldn't be checking target reach in this state!");
                break;

            default:
                Debug.LogError("Unknown state!");
                break;

        }
    }
Example #10
0
 public void Stop()
 {
     legsState = LegsState.Idle;
     StopMovement();
 }
Example #11
0
 public void PursueTarget(DTRMPosition target)
 {
     legsState = LegsState.PursuingTarget;
     targetActor = target;
 }
Example #12
0
 public void Stop()
 {
     legsState = LegsState.Idle;
     StopMovement();
 }
Example #13
0
 public void FollowTarget(DTRMPosition target)
 {
     legsState   = LegsState.FollowingTarget;
     targetActor = target;
 }
Example #14
0
 public void PursueTarget(DTRMPosition target)
 {
     legsState   = LegsState.PursuingTarget;
     targetActor = target;
 }
Example #15
0
 public override void DTRMStart()
 {
     legsListeners = GetComponents(typeof(ILegsListener));
     legsState     = LegsState.Idle;
 }