Exemplo n.º 1
0
 public HarbourKind getHarbour()
 {
     if (harborPool.Count > 0)
     {
         HarbourKind harbourType = (HarbourKind)harborPool[roller.Next(0, harborPool.Count)];
         harborPool.Remove(harbourType);
         return(harbourType);
     }
     else
     {
         return(HarbourKind.None);
     }
 }
Exemplo n.º 2
0
 void OnHarbor(HarbourKind value)
 {
     if (value != HarbourKind.None)
     {
         harbor = value;
         bool  flip = false;
         float x = 0; float y = 0;
         if (inBetween.Length == 1)
         {
             x = transform.localPosition.x - inBetween[0].transform.localPosition.x;
             y = transform.localPosition.y - inBetween[0].transform.localPosition.y;
         }
         else
         {
             foreach (TerrainHex tile in inBetween)
             {
                 if (tile.myTerrain != TerrainKind.Sea)
                 {
                     y = transform.localPosition.y - tile.transform.localPosition.y;
                     x = transform.localPosition.x - tile.transform.localPosition.x;
                 }
             }
         }
         Debug.Log(x + "," + y);
         //flip checks according to position of the sea tile or the outside of the land
         if (x > 0 && (y > -0.2 && y < 0.2))
         {
             flip = true;
         }
         else if (x < 0 && y < -0.25)
         {
             flip = true;
         }
         else if (x > 0 && y < -0.25)
         {
             flip = true;
         }
         //spawn it
         transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = harborSprites[(int)value];
         //checked to see if its on the right side if not flip it over to the other side of the edge
         if (flip)
         {
             transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = harborSprites[(int)value];
             transform.GetChild(0).localPosition = new Vector3(-transform.GetChild(0).localPosition.x, -transform.GetChild(0).localPosition.y, 0);
             transform.GetChild(0).localScale    = new Vector3(-1, -1, 1);
         }
     }
 }
Exemplo n.º 3
0
 public void Load(IntersectionData data, IntersectionUnit u)
 {
     this.harbor         = data.harbourKind;
     this.isFishingInter = data.isFishing;
     this.owned          = data.owned;
     if (u != null)
     {
         if (u is Village)
         {
             var village = (Village)u;
             LoadVillage(village, data);
         }
         else if (u is Knight)
         {
             var knight = (Knight)u;
             LoadKnight(knight);
         }
     }
 }
Exemplo n.º 4
0
 public void OnHarbour(HarbourKind value)
 {
     harbor = value;
 }
Exemplo n.º 5
0
 public void setHarborKind(HarbourKind kind)
 {
     harbor = kind;
 }