示例#1
0
        private void follow()
        {
            if (targetDirect == null)
            {
                calc.recalcClosestObject(this.transform, ref objectToFollow, RecalculationFPS, targetFromTag);
            }

            bool lockedOn = calc.isWithinRadius(this.transform, objectToFollow, EngageRadius);

            if (objectToFollow != null && lockedOn)
            {
                lastKnownPos = new Vector2(objectToFollow.position.x, objectToFollow.position.y);
                assigned     = true;

                if (resetSwitch)
                {
                    resetSwitch = false;
                }
            }

            if (objectToFollow == null || !lockedOn)
            {
                resetLinearAngle(); linear();
            }
            else
            {
                moveTowards();
            }

            setRotation(lockedOn);
        }
示例#2
0
        private void follow()
        {
            if (targetDirect == null)
            {
                calc.recalcClosestObject(this.transform, ref objectToFollow, RecalculationFPS, targetFromTag);
            }

            bool lockedOn = calc.isWithinRadius(this.transform, objectToFollow, EngageRadius);

            setRotation(objectToFollow, lockedOn);
        }