示例#1
0
 public TileEvent(string continent, int x, int y, TileEventType type)
 {
     Continent = continent;
     X         = x;
     Y         = y;
     Type      = type;
 }
示例#2
0
    void PositionOnScreen()
    {
        Ray   ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * xPostion, Screen.height * bottomOffset));
        float distance;

        if (plane.Raycast(ray, out distance))
        {
            transform.position = ray.GetPoint(distance);
        }

        ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * (xPostion - width / 2), Screen.height * bottomOffset));
        if (plane.Raycast(ray, out distance))
        {
            xMin = ray.GetPoint(distance);
        }

        ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * (xPostion + width / 2), Screen.height * bottomOffset));
        if (plane.Raycast(ray, out distance))
        {
            xMax = ray.GetPoint(distance);
        }

        for (int i = 0, l = transform.childCount; i < l; i++)
        {
            float         f      = i / (handSize - 1.0f);
            Transform     child  = transform.GetChild(i);
            TileEventType status = child.GetComponent <Tile>().Status;
            if (status == TileEventType.InHand || status == TileEventType.HandHovered)
            {
                child.position = Vector3.Lerp(xMin, xMax, f);
            }
        }
    }
示例#3
0
 private void Report(int x, int y, TileEventType type)
 {
     if (OnTileEvent != null)
     {
         OnTileEvent(this, new TileEvent(Continent, x, y, type));
     }
 }
示例#4
0
 public TileEvent(string continent, int x, int y, TileEventType type)
 {
     Continent = continent;
     X = x;
     Y = y;
     Type = type;
 }
示例#5
0
 private void Tile_OnTileEvent(Tile tile, TileEventType eventType)
 {
     if (eventType == TileEventType.HandHovered && tile.tileType == ruleFor)
     {
         ApplyOn(HexCubMap.current, tile);
     }
 }
示例#6
0
 public void ReActivate()
 {
     mustBePlaced = true;
     _hovered     = this;
     Status       = TileEventType.HandHovered;
     Status       = TileEventType.Dragged;
 }
示例#7
0
 private void Tile_OnTileEvent(Tile tile, TileEventType eventType)
 {
     if (eventType == TileEventType.Placed && tilesInHand.Contains(tile))
     {
         RefillHand(1);
         tilesInHand.Remove(tile);
     }
 }
示例#8
0
 public TileEvent(TileEventType type, Board.Tile tile) :
     base(EventType.TileEvent)
 {
     this.tileEventType = type;
     this.tile          = tile;
     this.largeItem     = null;
     this.smallItem     = null;
 }
示例#9
0
 private void Tile_OnTileEvent(Tile tile, TileEventType eventType)
 {
     if (tile == this && eventType == TileEventType.Placed)
     {
         if (closest)
         {
             closest.occupant = this;
         }
         else
         {
             Status = TileEventType.DragCancel;
         }
     }
 }
示例#10
0
 private void Tile_OnTileEvent(Tile tile, TileEventType eventType)
 {
     if (eventType == TileEventType.DragCancel || eventType == TileEventType.HandHoverCancel)
     {
         placements.Clear();
     }
     else if (eventType == TileEventType.Placed)
     {
         Debug.Log("Placed " + tile);
         if (tile.tileType == TileType.Root)
         {
             HexPos pos = tile.Placement;
             Debug.Log("Looking for " + pos);
             bool fallOut = false;
             foreach (KeyValuePair <HexPos, HexPos[]> kvp in placements)
             {
                 for (int i = 0, l = kvp.Value.Length; i < l; i++)
                 {
                     if (kvp.Value[i] == pos)
                     {
                         Debug.Log("Found it with " + kvp.Key);
                         Tile meristem = kvp.Key.occupant;
                         tile.Place(kvp.Key);
                         meristem.Place(pos);
                         fallOut = true;
                         break;
                     }
                 }
                 if (fallOut)
                 {
                     break;
                 }
             }
         }
         placements.Clear();
     }
 }
示例#11
0
 public TileEvent(string name, TileEventType type)
 {
     this.Name = name;
     this.Type = type;
 }
示例#12
0
 private void Report(int x, int y, TileEventType type)
 {
     if (OnTileEvent != null)
         OnTileEvent(this, new TileEvent(Continent, x, y, type));
 }
示例#13
0
 public void Place(HexPos pos)
 {
     mustBePlaced = true;
     closest      = pos;
     Status       = TileEventType.Placed;
 }
示例#14
0
文件: TileEvent.cs 项目: nadar71/Krea
 public TileEvent(string name, TileEventType type)
 {
     this.Name = name;
     this.Type = type;
 }