UnitMovement.startMoving C# (CSharp) Method

startMoving() public method

public startMoving ( GameObject target, VoidMethod callback = null ) : void
target GameObject
callback VoidMethod
return void
    public void startMoving( GameObject target, VoidMethod callback = null )
    {
        CollectResources collecting = GetComponent<CollectResources>();
        if( collecting != null )
            collecting.CancelInvoke();

        this.callback = callback;

        this.target = target.transform;
        if ( seeker != null ) seeker.StartPath(transform.position, target.transform.position, OnPathComplete);

        targetPos = target.transform.position;
        targetPosAux = targetPos;
        hasTarget = true;

        // Cancel all animations and play walk
        if (animator != null)
        {
            foreach(AnimatorControllerParameter param in animator.parameters)
            {
                animator.SetBool(param.name, false);
            }
            animator.SetBool("walk", true);
        }
        status = Status.running;
    }