Example #1
0
 //constructor
 public static Village CreateComponent( Player p, List<Tile> regions, Tile locatedAt, GameObject villagePrefab )
 {
     Debug.Log ("-----Village.CreateComponent() CALLED--------");
     Village myVillage = villagePrefab.AddComponent<Village>();
     myVillage.controlledRegion = regions;//todo
     myVillage.controlledBy = p;//TODO: Currently set in Mapgenerator
     myVillage.myType = VillageType.Hovel;
     myVillage.supportedUnits = new List<Unit> ();
     locatedAt.replace (villagePrefab);//to check : Set in Mapgenerator
     myVillage.locatedAt = locatedAt;//done
     locatedAt.setVillage (myVillage);//done
     myVillage.myAction = VillageActionType.ReadyForOrders;
     myVillage.gold = 0;
     myVillage.wood = 0;
     //TODO: set controlledRegions in tiles : Call updateControlledRegionNet()
     foreach (Tile t in myVillage.controlledRegion)
     {
         t.setVillage(myVillage);
     }
     return myVillage;
 }
Example #2
0
 /*
  * Function adds t to village region and colors.
  * this function does NOT remove the tile from the old village.
  */
 public void addTile(Tile t)
 {
     controlledRegion.Add(t);
     t.setVillage(this);
     int color = this.getPlayer ().getColor ();
     t.setColor( color );
     t.colorTile ();
 }