Esempio n. 1
0
        public void TargetPosition(string args)
        {
            string[] split = args.Split('|');

            if (split.Length < 4)
            {
                Echo("Invalid Argument");
                return;
            }

            Vector3D targetPosition;

            if (!Vector3D.TryParse(split[1], out targetPosition))
            {
                Echo("Invalid Position");
                return;
            }

            Vector3D planetPosition;

            if (!Vector3D.TryParse(split[2], out planetPosition))
            {
                Echo("Invalid Planet Position");
                return;
            }
            cannon.EnterIdle();
            double planetRadius;

            if (!double.TryParse(split[3], out planetRadius))
            {
                Echo("Invalid Radius");
                return;
            }

            double tolerance = 10;

            if (split.Length > 4 && !double.TryParse(split[4], out tolerance))
            {
                Echo("Invalid tolerance");
                return;
            }

            double tweakFactor = 1;

            if (split.Length > 5 && !double.TryParse(split[5], out tweakFactor))
            {
                Echo("Invalid tweakFactor");
                return;
            }

            targeter.tolerance = tolerance;
            targeter.TargetPosition(targetPosition, planetPosition, planetRadius, 9.81 * tweakFactor);
            Echo($"Targeting...\nTarget: {targetPosition}\nplanetCore: {planetPosition}\nplanetRadius: {planetRadius}\ntweakFactor: {tweakFactor}");
        }