public void TargetDirection(ref Vector3D targetDirection)
            {
                if (targetDirection == Vector3D.Zero)
                {
                    currentTargetDir = targetDirection;
                    restMode         = false;
                    restAfterReset   = false;
                    return;
                }

                if (currentTargetDir != Vector3D.Zero && targetDirection != Vector3D.Zero && currentTargetDir.Dot(targetDirection) < 1 - accuracyVal)
                {
                    return;
                }

                bool blockInTheWay = deadzoneProvider.IsBlockInTheWay(rotorControl.azimuth.reference.GetPosition() + targetDirection * 2.5, rotorControl.azimuth.reference.GetPosition() + targetDirection * 800);

                if (blockInTheWay)
                {
                    currentTargetDir = Vector3D.Zero;
                    restAfterReset   = true;
                    return;
                }

                currentTargetDir = targetDirection;
                restMode         = false;
                restAfterReset   = false;
            }
Ejemplo n.º 2
0
            private void OnTarget(bool val, RotorControl.RotorReferencePair pair)
            {
                if (val)
                {
                    if (currentTargetDir != Vector3D.Zero)
                    {
                        bool blockInTheWay = deadzoneProvider.IsBlockInTheWay(rotorControl.azimuth.reference.GetPosition() + currentTargetDir * 15, rotorControl.azimuth.reference.GetPosition() + currentTargetDir * 800);
                        FireCannons(!blockInTheWay);
                        rotorControl.Lock(false);
                        return;
                    }

                    if (rotorControl.currentAccuracy > accuracyVal && restAfterReset)
                    {
                        rotorControl.Lock(true);
                        restMode = true;
                    }
                }
                else if (currentTargetDir != Vector3D.Zero)
                {
                    rotorControl.Lock(false);
                }
            }