예제 #1
0
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    ///
    private void InitEscapeStuff()
    {
        //Primary escape shuttle lookup
        if (!PrimaryEscapeShuttle)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length != 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene");
            primaryEscapeShuttle = shuttles[0];
        }

        //later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        //Starting up at Centcom coordinates
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(PrimaryEscapeShuttle.CentcomDest.Position);

        bool beenToStation = false;

        PrimaryEscapeShuttle.OnShuttleUpdate?.AddListener(status =>
        {
            //status display ETA tracking
            if (status == ShuttleStatus.OnRouteStation)
            {
                PrimaryEscapeShuttle.OnTimerUpdate.AddListener(TrackETA);
            }
            else
            {
                PrimaryEscapeShuttle.OnTimerUpdate.RemoveListener(TrackETA);
                CentComm.UpdateStatusDisplay(StatusDisplayChannel.EscapeShuttle, string.Empty);
            }

            if (status == ShuttleStatus.DockedCentcom && beenToStation)
            {
                Logger.Log("Shuttle arrived at Centcom", Category.Round);
                Chat.AddSystemMsgToChat("<color=white>Escape shuttle has docked at Centcomm! Round will restart in 1 minute.</color>", MatrixManager.MainStationMatrix);
                StartCoroutine(WaitForRoundEnd());
            }

            IEnumerator WaitForRoundEnd()
            {
                Logger.Log("Shuttle docked to Centcom, Round will end in 1 minute", Category.Round);
                yield return(WaitFor.Seconds(1f));

                EndRound();
            }

            if (status == ShuttleStatus.DockedStation)
            {
                beenToStation = true;
                SoundManager.PlayNetworked("ShuttleDocked");
                Chat.AddSystemMsgToChat("<color=white>Escape shuttle has arrived! Crew has 3 minutes to get on it.</color>", MatrixManager.MainStationMatrix);
                //should be changed to manual send later
                StartCoroutine(SendEscapeShuttle(180));
            }
        });
    }
예제 #2
0
        private bool CheckForPlayersOnShuttle(EscapeShuttle shuttle)
        {
            LayerMask layersToCheck = LayerMask.GetMask("Players", "NPC");

            foreach (Transform trans in shuttle.MatrixInfo.Objects)
            {
                if (((1 << trans.gameObject.layer) & layersToCheck) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    private void InitEscapeStuff()
    {
        //Primary escape shuttle lookup
        if (!PrimaryEscapeShuttle)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length != 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene");
            primaryEscapeShuttle = shuttles[0];
        }

        //later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        //Starting up at Centcom coordinates
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(PrimaryEscapeShuttle.CentcomDest.Position);

        bool beenToStation = false;

        PrimaryEscapeShuttle.OnShuttleUpdate?.AddListener(status =>
        {
            //status display ETA tracking
            if (status == ShuttleStatus.OnRouteStation)
            {
                PrimaryEscapeShuttle.OnTimerUpdate.AddListener(TrackETA);
            }
            else
            {
                PrimaryEscapeShuttle.OnTimerUpdate.RemoveListener(TrackETA);
                CentComm.OnStatusDisplayUpdate.Invoke(StatusDisplayChannel.EscapeShuttle, string.Empty);
            }

            if (status == ShuttleStatus.DockedCentcom && beenToStation)
            {
                RoundEnd();
                Logger.Log("Shuttle arrived to Centcom, Round should end here", Category.Round);
            }

            if (status == ShuttleStatus.DockedStation)
            {
                beenToStation = true;
                SoundManager.PlayNetworked("Disembark");
                PostToChatMessage.Send("Escape shuttle has arrived! Crew has 1 minute to get on it.", ChatChannel.System);
                //should be changed to manual send later
                StartCoroutine(SendEscapeShuttle(60));
            }
        });
    }
예제 #4
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        mm = GetComponent <MatrixMove>();
        mm.SetAccuracy(0);
    }
예제 #5
0
 private void InitEscapeShuttle()
 {
     //Primary escape shuttle lookup
     if (PrimaryEscapeShuttle == false)
     {
         var shuttles = FindObjectsOfType <EscapeShuttle>();
         if (shuttles.Length != 1)
         {
             Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
             return;
         }
         Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene", Category.Round);
         primaryEscapeShuttle = shuttles[0];
     }
 }
예제 #6
0
        private IEnumerator WaitForProvider()
        {
            string FormatTime(int timerSeconds)
            {
                if (shuttle.Status == EscapeShuttleStatus.DockedCentcom ||
                    shuttle.Status == EscapeShuttleStatus.DockedStation)
                {
                    return(string.Empty);
                }

                return("ETA: " + TimeSpan.FromSeconds(timerSeconds).ToString("mm\\:ss"));
            }

            while (Provider == null)
            {
                yield return(WaitFor.EndOfFrame);
            }

            console = Provider.GetComponentInChildren <CommsConsole>();

            //starting up, setting appropriate labels
            ProcessIdChange(console.IdCard);
            console.OnServerIDCardChanged.AddListener(ProcessIdChange);
            shuttle = GameManager.Instance.PrimaryEscapeShuttle;

            shuttleStatusLabel.SetValueServer(shuttle.Status.ToString());
            statusImage.SetSprite((int)shuttle.Status);
            shuttle.OnShuttleUpdate.AddListener(status =>
            {
                statusImage.SetSprite((int)shuttle.Status);
                shuttleStatusLabel.SetValueServer(status.ToString());
            });

            shuttleTimerLabel.SetValueServer(FormatTime(shuttle.CurrentTimerSeconds));
            shuttle.OnTimerUpdate.AddListener(timerSeconds =>
            {
                shuttleTimerLabel.SetValueServer(FormatTime(timerSeconds));
            });

            RefreshCallButtonText();

            Logger.Log(nameof(WaitForProvider), Category.Shuttles);
        }
예제 #7
0
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    private void InitEscapeStuff()
    {
        // Primary escape shuttle lookup
        if (PrimaryEscapeShuttle == null)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length < 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene", Category.Round);
            primaryEscapeShuttle = shuttles[0];
        }

        // later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        if (primaryEscapeShuttle.MatrixInfo == null)
        {
            Logger.LogError("Primary escape shuttle has no associated matrix!", Category.Round);
            return;
        }

        // Starting up at Centcom coordinates
        if (Instance.QuickLoad)
        {
            if (primaryEscapeShuttle.MatrixInfo == null)
            {
                return;
            }
            if (primaryEscapeShuttle.MatrixInfo.MatrixMove == null)
            {
                return;
            }
        }

        var   orientation = primaryEscapeShuttle.MatrixInfo.MatrixMove.InitialFacing;
        float width;

        if (orientation == Orientation.Up || orientation == Orientation.Down)
        {
            width = PrimaryEscapeShuttle.MatrixInfo.LocalBounds.size.x;
        }
        else
        {
            width = PrimaryEscapeShuttle.MatrixInfo.LocalBounds.size.y;
        }

        Vector3 newPos;

        switch (LandingZoneManager.Instance.centcomDocking.orientation)
        {
        case OrientationEnum.Right:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x + Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        case OrientationEnum.Up:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y + Mathf.Ceil(width / 2f), 0);
            break;

        case OrientationEnum.Left:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x - Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        default:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y - Mathf.Ceil(width / 2f), 0);
            break;
        }

        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.ChangeFacingDirection(Orientation.FromEnum(PrimaryEscapeShuttle.orientationForDockingAtCentcom));
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(newPos);
        primaryEscapeShuttle.InitDestination(newPos);

        beenToStation = false;
    }
예제 #8
0
    /// <summary>
    /// Called after MatrixManager is initialized
    /// </summary>
    ///
    private void InitEscapeStuff()
    {
        //Primary escape shuttle lookup
        if (PrimaryEscapeShuttle == null)
        {
            var shuttles = FindObjectsOfType <EscapeShuttle>();
            if (shuttles.Length < 1)
            {
                Logger.LogError("Primary escape shuttle is missing from GameManager!", Category.Round);
                return;
            }
            Logger.LogWarning("Primary escape shuttle is missing from GameManager, but one was found on scene", Category.Round);
            primaryEscapeShuttle = shuttles[0];
        }

        //later, maybe: keep a list of all computers and call the shuttle automatically with a 25 min timer if they are deleted

        if (primaryEscapeShuttle.MatrixInfo == null)
        {
            Logger.LogError("Primary escape shuttle has no associated matrix!", Category.Round);
            return;
        }

        //Starting up at Centcom coordinates
        if (GameManager.Instance.QuickLoad)
        {
            if (primaryEscapeShuttle.MatrixInfo == null)
            {
                return;
            }
            if (primaryEscapeShuttle.MatrixInfo.MatrixMove == null)
            {
                return;
            }
        }

        var   orientation = primaryEscapeShuttle.MatrixInfo.MatrixMove.InitialFacing;
        float width;

        if (orientation == Orientation.Up || orientation == Orientation.Down)
        {
            width = PrimaryEscapeShuttle.MatrixInfo.Bounds.size.x;
        }
        else
        {
            width = PrimaryEscapeShuttle.MatrixInfo.Bounds.size.y;
        }

        Vector3 newPos;

        switch (LandingZoneManager.Instance.centcomDocking.orientation)
        {
        case OrientationEnum.Right:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x + Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        case OrientationEnum.Up:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y + Mathf.Ceil(width / 2f), 0);
            break;

        case OrientationEnum.Left:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x - Mathf.Ceil(width / 2f), LandingZoneManager.Instance.centcomDockingPos.y, 0);
            break;

        default:
            newPos = new Vector3(LandingZoneManager.Instance.centcomDockingPos.x, LandingZoneManager.Instance.centcomDockingPos.y - Mathf.Ceil(width / 2f), 0);
            break;
        }

        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.ChangeFacingDirection(Orientation.FromEnum(PrimaryEscapeShuttle.orientationForDockingAtCentcom));
        PrimaryEscapeShuttle.MatrixInfo.MatrixMove.SetPosition(newPos);
        primaryEscapeShuttle.InitDestination(newPos);

        bool beenToStation = false;

        PrimaryEscapeShuttle.OnShuttleUpdate?.AddListener(status =>
        {
            //status display ETA tracking
            if (status == EscapeShuttleStatus.OnRouteStation)
            {
                PrimaryEscapeShuttle.OnTimerUpdate.AddListener(TrackETA);
            }
            else
            {
                PrimaryEscapeShuttle.OnTimerUpdate.RemoveListener(TrackETA);
                CentComm.UpdateStatusDisplay(StatusDisplayChannel.EscapeShuttle, string.Empty);
            }

            if (status == EscapeShuttleStatus.DockedCentcom && beenToStation)
            {
                Logger.Log("Shuttle arrived at Centcom", Category.Round);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has docked at Centcomm! Round will restart in {TimeSpan.FromSeconds(RoundEndTime).Minutes} minute.</color>"), MatrixManager.MainStationMatrix);
                StartCoroutine(WaitForRoundEnd());
            }

            IEnumerator WaitForRoundEnd()
            {
                Logger.Log($"Shuttle docked to Centcom, Round will end in {TimeSpan.FromSeconds(RoundEndTime).Minutes} minute", Category.Round);
                yield return(WaitFor.Seconds(1f));

                EndRound();
            }

            if (status == EscapeShuttleStatus.DockedStation && !primaryEscapeShuttle.hostileEnvironment)
            {
                beenToStation = true;
                SoundManager.PlayNetworked(SingletonSOSounds.Instance.ShuttleDocked);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! Crew has {TimeSpan.FromSeconds(ShuttleDepartTime).Minutes} minutes to get on it.</color>"), MatrixManager.MainStationMatrix);
                //should be changed to manual send later
                departCoroutine = StartCoroutine(SendEscapeShuttle(ShuttleDepartTime));
            }
            else if (status == EscapeShuttleStatus.DockedStation && primaryEscapeShuttle.hostileEnvironment)
            {
                beenToStation = true;
                SoundManager.PlayNetworked(SingletonSOSounds.Instance.ShuttleDocked);
                Chat.AddSystemMsgToChat(string.Format(ChatTemplates.PriorityAnnouncement, $"<color=white>Escape shuttle has arrived! The shuttle <color=#FF151F>cannot</color> leave the station due to the hostile environment!</color>"), MatrixManager.MainStationMatrix);
            }
        });
    }
예제 #9
0
 private void EnsureInit(MatrixInfo matrixInfo)
 {
     bound            = MatrixManager.MainStationMatrix.Bounds;
     escapeShuttle    = FindObjectOfType <EscapeShuttle>();
     boundsConfigured = true;
 }
예제 #10
0
 public void OnSpawnServer(SpawnInfo info)
 {
     bound            = MatrixManager.MainStationMatrix.LocalBounds;
     escapeShuttle    = FindObjectOfType <EscapeShuttle>();
     boundsConfigured = true;
 }
예제 #11
0
 // Start is called before the first frame update
 private void Start()
 {
     bound         = MatrixManager.MainStationMatrix.Bounds;
     escapeShuttle = FindObjectOfType <EscapeShuttle>();
 }