예제 #1
0
            public override void DoOnDirectMasterMsg(MyIGCMessage msg)
            {
                p.Echo("Getting msg from master");
                if (msg.Tag == ShipFormationMaster.TAG_FORMATION)
                {
                    GPS center = new GPS(msg.Data.ToString());
                    p.Echo("Getting formation msg from master : ");

                    IMyRemoteControl r = GetRemote();

                    r.ClearWaypoints();

                    int    nbWP     = 18;
                    double angleTmp = 0;
                    double angleDeg = 360 / nbWP;
                    for (int i = 0; i < nbWP; ++i)
                    {
                        GPS            wp   = center.ComputeCoordinate(ShipFormationMaster.DISTANCE, DegreeToRadian(angleTmp));
                        MyWaypointInfo dest = new MyWaypointInfo("WP_" + i, wp.x, wp.y, wp.z);
                        r.AddWaypoint(dest);
                        angleTmp += angleDeg;
                    }

                    GetLight().SetValue("Color", new Color(0, 255, 0));

                    r.FlightMode = FlightMode.Circle;
                    r.SetCollisionAvoidance(false);
                    r.SetAutoPilotEnabled(true);
                }
            }