Exemple #1
0
        private float pilotToAngle(float targetAngle)
        {
            // delta between current angle to target
            var remainingAngle = Mathf.DeltaAngleRadians(mind.state.me.body.stdAngle, targetAngle);

            if (Math.Abs(remainingAngle) > TargetSource.AT_ANGLE)
            {
                var turnInput = 0;

                if (remainingAngle > 0)
                {
                    turnInput = -1;
                }
                else if (remainingAngle < 0)
                {
                    turnInput = 1;
                }

                controller.moveTurnLogical.LogicValue = turnInput;
            }
            else
            {
                // cheat and snap angle
                mind.state.me.body.stdAngle = targetAngle;
            }

            return(remainingAngle);
        }
Exemple #2
0
        private bool closeEnoughApproach()
        {
            var positionCloseEnough = closeEnoughPosition(); // check position

            if (positionCloseEnough)
            {
                if (!align)
                {
                    return(true);
                }
                // check alignment
                var remainingAngle = Mathf.DeltaAngleRadians(mind.state.me.body.stdAngle, getTargetAngle());
                return(Math.Abs(remainingAngle) < AT_ANGLE);
            }

            return(false);
        }