예제 #1
0
    /// <summary>
    /// Method is called once shuttle arrives to its destination.
    /// Server only.
    /// </summary>
    public void OnShuttleArrival()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (ShuttleStatus == CargoShuttleStatus.OnRouteCentcom)
        {
            ShuttleStatus = CargoShuttleStatus.DockedCentcom;
        }
        else if (ShuttleStatus == CargoShuttleStatus.OnRouteStation)
        {
            ShuttleStatus = CargoShuttleStatus.DockedStation;
        }
        OnShuttleUpdate?.Invoke();
    }
예제 #2
0
    /// <summary>
    /// Calls the shuttle.
    /// Server only.
    /// </summary>
    public void CallShuttle()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (CurrentFlyTime > 0f)
        {
            return;
        }
        if (CustomNetworkManager.Instance._isServer)
        {
            CurrentFlyTime = shuttleFlyDuration;
            //It works so - shuttle stays in centcomDest until timer is done,
            //then it starts moving to station
            if (ShuttleStatus == CargoShuttleStatus.DockedCentcom)
            {
                SpawnOrder();
                ShuttleStatus   = CargoShuttleStatus.OnRouteStation;
                CentcomMessage += "Shuttle is sent back with goods." + "\n";
                StartCoroutine(Timer(true));
            }
            //If we are at station - we start timer and launch shuttle at the same time.
            //Once shuttle arrives centcomDest - CargoShuttle will wait till timer is done
            //and will call OnShuttleArrival()
            else if (ShuttleStatus == CargoShuttleStatus.DockedStation)
            {
                CargoShuttle.Instance.MoveToCentcom();
                ShuttleStatus  = CargoShuttleStatus.OnRouteCentcom;
                CentcomMessage = "";
                StartCoroutine(Timer(false));
            }
        }
        OnShuttleUpdate?.Invoke();
    }