예제 #1
0
 public Cargo GetCargo()
 {
     if(cargo != null) {
         Cargo tmp = cargo;
         cargo = null;
         return tmp;
     } else {
         return null;
     }
 }
예제 #2
0
 private void TryDropoff(City city)
 {
     if(cargo == null  || cargo.city != city.city) {
         return;
     }
     GameDriver.Instance.CargoDelivered(cargo);
     Destroy(cargo.gameObject);
     cargo = null;
     AudioSource.PlayClipAtPoint(dropoffSound, Camera.main.transform.position);
 }
예제 #3
0
        public void SpawnCargo()
        {
            isSpawning = false;
            CityName randCity;
            do {
                randCity = (CityName)City.CityNames.GetValue(Random.Range(0, numCities));
            } while(randCity == city.city);

            cargo = (Instantiate(cargoPrefab.gameObject,
                SpawnPoint.position, Quaternion.identity) as GameObject)
                    .GetComponent<Cargo>();
            cargo.city = randCity;
        }
예제 #4
0
 public void PickupCargo(CargoPickup pickup)
 {
     if(cargo != null) {
         return; // we already have cargo, don't pickup
     }
     cargo = pickup.GetCargo();
     if(cargo == null) {
         return; // no cargo to pickup
     }
     cargo.transform.parent = cargoPoint;
     cargo.transform.localPosition = Vector3.zero;
     GameDriver.Instance.CargoPicked(cargo);
     AudioSource.PlayClipAtPoint(pickupSound, Camera.main.transform.position);
 }
예제 #5
0
 public void CargoPicked(Cargo cargo)
 {
     SpawnRandomCargo(false);
 }
예제 #6
0
 public void CargoDelivered(Cargo cargo)
 {
     score += cargoValue;
 }