Exemplo n.º 1
0
    private void TransferResources()
    {
        if (cargoHold.GetCargo().Count <= 0)
        {
            return;
        }

        if (nearbyBase != null)
        {
            float distance = Vector3.Distance(nearbyBase.transform.position, transform.position);
            if (distance <= cargoDropRange)
            {
                cargoHold.Transfer(nearbyBase.cargoHold);
                EventLog.singleton.AddEvent(String.Format("Player {0}'s Trade Ship has delivered resources to their Base", EventLog.singleton.CreateColoredText(owner.seat.ToString(), owner.color)));
            }
        }

        foreach (Depot depot in nearbyDepots)
        {
            float distance = Vector3.Distance(depot.transform.position, transform.position);
            if (distance <= cargoDropRange)
            {
                cargoHold.Transfer(depot.cargoHold);
                EventLog.singleton.AddEvent(String.Format("Player {0}'s Trade Ship has delivered resources to their Depot", EventLog.singleton.CreateColoredText(owner.seat.ToString(), owner.color)));
            }
        }
    }
Exemplo n.º 2
0
 private void TransferResources()
 {
     if (cargoHold.GetCargo().Count > 0)
     {
         cargoHold.Transfer(NetworkServer.FindLocalObject(owner.playerBase).GetComponent <Base>().cargoHold);
     }
 }