Ejemplo n.º 1
0
    private BoatNpc SpawnBoat()
    {
        // TODO in the future type of boat is dependent on city wealth and faction
        GameObject boat    = GameObject.Instantiate(npcBoatPrefab, spawnPoint, Quaternion.identity);
        BoatNpc    boatNpc = boat.GetComponent <BoatNpc>();

        currentSpawnedBoats.Add(boatNpc);
        return(boatNpc);
    }
Ejemplo n.º 2
0
 private void NewTradeBoat()
 {
     // New trade boat! Choose the destination city, using nearest first
     foreach (City c in citiesByNearest)
     {
         if (currentSpawnedBoats.Find(tb => tb.purpose.cityTarget == c))
         {
             // already one going there
             continue;
         }
         // find a resource in the needs of this city and the production of here
         Common.Resource res = c.needs.Find(r => productions.Find(p => p.produces == r) != null);
         if (res != Common.Resource.NONE)
         {
             // A resource to deliver!!
             // need to create one boat!
             BoatNpc b = SpawnBoat();
             // set its purpose
             b.purpose = new Purpose(Common.Purpose.TRADE, this, c, res);
             // DONE
             return;
         }
     }
 }
Ejemplo n.º 3
0
 public void UnSpawnBoat(BoatNpc boat)
 {
     currentSpawnedBoats.Remove(boat);
     GameObject.Destroy(boat.gameObject);
 }
Ejemplo n.º 4
0
 private void NewPatrolBoat()
 {
     BoatNpc b = SpawnBoat();
     // TODO
 }