Esempio n. 1
0
 void OnRoundRestart(Scene scene, LoadSceneMode mode)
 {
     Supplies.Clear();
     CurrentOrders.Clear();
     CurrentCart.Clear();
     ShuttleStatus  = ShuttleStatus.DockedStation;
     Credits        = 1000;
     CurrentFlyTime = 0f;
     CentcomMessage = "";
 }
Esempio n. 2
0
        /// <summary>
        /// Calls the shuttle.
        /// Server only.
        /// </summary>
        public void CallShuttle()
        {
            if (!CustomNetworkManager.Instance._isServer)
            {
                return;
            }

            if (CurrentFlyTime > 0f || ShuttleStatus == ShuttleStatus.OnRouteCentcom ||
                ShuttleStatus == ShuttleStatus.OnRouteStation)
            {
                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 == ShuttleStatus.DockedCentcom)
                {
                    SpawnOrder();
                    ShuttleStatus   = ShuttleStatus.OnRouteStation;
                    CentcomMessage += "Shuttle is sent back with goods." + "\n";
                    StartCoroutine(Timer(true));
                }

                //If we are at station - First checks for any people or animals aboard
                //If any, refuses to depart until the lifeform is removed.
                //If none, 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 == ShuttleStatus.DockedStation)
                {
                    string warningMessageEnd = "organisms aboard." + "\n";
                    if (CheckLifeforms())
                    {
                        CurrentFlyTime = 0;
                        if (CentcomMessage.EndsWith(warningMessageEnd) == false)
                        {
                            CentcomMessage += "Due to safety and security reasons, the automatic cargo shuttle is unable to depart with any human, alien or animal organisms aboard." + "\n";
                        }
                    }
                    else
                    {
                        CargoShuttle.Instance.MoveToCentcom();
                        ShuttleStatus  = ShuttleStatus.OnRouteCentcom;
                        CentcomMessage = "";
                        exportedItems.Clear();
                        StartCoroutine(Timer(false));
                    }
                }
            }

            OnShuttleUpdate.Invoke();
        }
Esempio n. 3
0
 void OnRoundRestart(Scene oldScene, Scene newScene)
 {
     Supplies.Clear();
     ActiveBounties.Clear();
     CurrentOrders.Clear();
     CurrentCart.Clear();
     ShuttleStatus  = ShuttleStatus.DockedStation;
     Credits        = 1000;
     CurrentFlyTime = 0f;
     CentcomMessage = "";
     Supplies       = new List <CargoCategory>(cargoData.Categories);
     ActiveBounties = new List <CargoBounty>(cargoData.CargoBounties);
 }
Esempio n. 4
0
    /// <summary>
    /// Method is called once shuttle arrives to its destination.
    /// Server only.
    /// </summary>
    public void OnShuttleArrival()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (ShuttleStatus == ShuttleStatus.OnRouteCentcom)
        {
            ShuttleStatus = ShuttleStatus.DockedCentcom;
        }
        else if (ShuttleStatus == ShuttleStatus.OnRouteStation)
        {
            ShuttleStatus = ShuttleStatus.DockedStation;
        }
        OnShuttleUpdate?.Invoke();
    }
Esempio n. 5
0
    /// <summary>
    /// Method is called once shuttle arrives to its destination.
    /// Server only.
    /// </summary>
    public void OnShuttleArrival()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (ShuttleStatus == ShuttleStatus.OnRouteCentcom)
        {
            foreach (var entry in exportedItems)
            {
                if (entry.Value.TotalValue <= 0)
                {
                    continue;
                }

                CentcomMessage += $"+{ entry.Value.TotalValue } credits: " +
                                  $"{ entry.Value.Count }";

                if (!string.IsNullOrEmpty(entry.Value.ExportMessage) && string.IsNullOrEmpty(entry.Value.ExportName))
                {                 // Special handling for items that don't want pluralisation after
                    CentcomMessage += $" { entry.Value.ExportMessage }\n";
                }
                else
                {
                    CentcomMessage += $" { entry.Key }";

                    if (entry.Value.Count > 1)
                    {
                        CentcomMessage += "s";
                    }

                    CentcomMessage += $" { entry.Value.ExportMessage }\n";
                }
            }

            ShuttleStatus = ShuttleStatus.DockedCentcom;
        }
        else if (ShuttleStatus == ShuttleStatus.OnRouteStation)
        {
            ShuttleStatus = ShuttleStatus.DockedStation;
        }

        OnShuttleUpdate?.Invoke();
    }
    /// <summary>
    /// Calls the shuttle.
    /// Server only.
    /// </summary>
    public void CallShuttle()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (CurrentFlyTime > 0f || ShuttleStatus == ShuttleStatus.OnRouteCentcom ||
            ShuttleStatus == ShuttleStatus.OnRouteStation)
        {
            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 == ShuttleStatus.DockedCentcom)
            {
                SpawnOrder();
                ShuttleStatus   = ShuttleStatus.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 == ShuttleStatus.DockedStation)
            {
                CargoShuttle.Instance.MoveToCentcom();
                ShuttleStatus  = ShuttleStatus.OnRouteCentcom;
                CentcomMessage = "";
                exportedItems.Clear();
                StartCoroutine(Timer(false));
            }
        }

        OnShuttleUpdate?.Invoke();
    }