Пример #1
0
        public void SetWaypoint(string position)
        {
            if (!Autopilot)
            {
                return;
            }
            Vector3 proposedPos = position.Vectorized();

            if (proposedPos == TransformState.HiddenPos)
            {
                return;
            }

            //Ignoring requests to set waypoint outside intended radar window
            if (RadarList.ProjectionMagnitude(proposedPos) > EntryList.Range)
            {
                return;
            }
            //Mind the ship's actual position
            Waypoint.transform.position = (Vector2)proposedPos + Vector2Int.RoundToInt(MatrixMove.ServerState.Position);

            EntryList.UpdateExclusive(Waypoint);

            //		Logger.Log( $"Ordering travel to {Waypoint.transform.position}" );
            MatrixMove.AutopilotTo(Waypoint.transform.position);
        }
        private IEnumerator WaitForProvider()
        {
            while (Provider == null)
            {
                yield return(WaitFor.EndOfFrame);
            }

            shuttleConsole = Provider.GetComponent <ShuttleConsole>();
            matrixMove     = shuttleConsole.ShuttleMatrixMove;
            matrixMove.RegisterCoordReadoutScript(CoordReadout);
            matrixMove.RegisterShuttleGuiScript(this);
            shuttleFuelSystem = matrixMove.ShuttleFuelSystem;
            radarList         = this["EntryList"] as RadarList;

            //Not doing this for clients
            if (IsServer)
            {
                shuttleConsole.GUItab = this;

                radarList.Origin = matrixMove;
                StartButton.SetValueServer("1");

                //Init listeners
                matrixMove.MatrixMoveEvents.OnStartMovementServer.AddListener(OnStartMovementServer);
                matrixMove.MatrixMoveEvents.OnStopMovementServer.AddListener(OnStopMovementServer);

                if (!Waypoint)
                {
                    Waypoint = new GameObject($"{matrixMove.gameObject.name}Waypoint");
                }
                HideWaypoint(false);

                rulersColor    = Rulers.Value;
                rayColor       = RadarScanRay.Value;
                crosshairColor = Crosshair.Value;

                OnStateChange(shuttleConsole.shuttleConsoleState);
            }
        }