Beispiel #1
0
    public void SetHGoal(Vector3 newHGoal, bool group)
    {
        if (suspended)
        {
            return;
        }

        if (abilityGoal != null)         // Can't move while an ability is rotating us
        {
            return;
        }

        float selCircleRadius = parentUnit.GetSelCircleSize() * 1.85f;         // Approximation of visual area inside selection circle graphic

        if (Vector3.SqrMagnitude(new Vector3(newHGoal.x - transform.position.x, newHGoal.z - transform.position.z)) > selCircleRadius * selCircleRadius)
        {
            PathRequestHandler.RequestPath(new PathRequest(transform.position, newHGoal, OnPathFound));

            manualRotationGoal = null; // Clear any current rotation goal
        }
        else                           // Not grouped or clicked outside of selection circle
        {
            if (!reachedHGoal)         // Only able to rotate while stationary
            {
                Stop();
            }
            if (!group)
            {
                manualRotationGoal = new AbilityTarget(newHGoal);
            }
        }
        // else to do if rotation order but grouped
    }
Beispiel #2
0
 void Start()
 {
     PathRequestHandler.RequestPath(transform.position, target.position, OnPathFound);
 }