Exemplo n.º 1
0
    private void OnChunkClicked(IsoChunkSelected e)
    {
        EventHandler <IsoChunkSelected> handler = ChunkClickEvent;

        if (handler != null)
        {
            handler(this, e);
        }
    }
Exemplo n.º 2
0
    private void OnChunkEntered(IsoChunkSelected e)
    {
        EventHandler <IsoChunkSelected> handler = ChunkOnMouseEnterEvent;

        if (handler != null)
        {
            handler(this, e);
        }
    }
Exemplo n.º 3
0
    //This wasn't ever called and I don't think it would really work anyways so whatever. Keeping it in comment containment hell in case it ends up being useful.

/*
 *  /// <param name="objTransform">mesh bearing object centered on the tile</param>
 *  public void ObjectOnChunkClicked(GameObject obj)
 *  {
 *      Vector3 position = obj.GetComponent<MeshCollider>().bounds.extents;
 *      //Some hex math trickery, dont remember source.
 *      double q = (Math.Sqrt(3) / 3 * position.x - 1.0 / 3 * position.z);
 *      double r = (2.0 / 3 * position.z);
 *      HexCoordinates tileLocation = (HexCoordinates.RoundedCubes(q, -q - r, r, position.y / HexMetrics.elevationStep));
 *      IsoChunkSelected e = new IsoChunkSelected();
 *      e.Array = BaseTiles;
 *      e.Chunk = this;
 *      e.TileCoords = tileLocation;
 *      OnChunkClicked(e);
 *  }
 */

    public void ClickedAtCoords(HexCoordinates coords)
    {
        IsoChunkSelected e = new IsoChunkSelected();

        e.Array      = BaseTiles;
        e.Chunk      = this;
        e.TileCoords = coords;
        OnChunkClicked(e);
    }
Exemplo n.º 4
0
    void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }
        HexCoordinates?tileCoords = CursorToCoords();

        if (!tileCoords.HasValue)
        {
            Debug.Log("F**k you Unity"); return;
        }
        IsoChunkSelected e = new IsoChunkSelected();

        e.Array      = BaseTiles;
        e.Chunk      = this;
        e.TileCoords = tileCoords.Value;
        OnChunkClicked(e);
    }
Exemplo n.º 5
0
    void OnMouseOver()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }
        HexCoordinates?tileCoords = CursorToCoords();

        if (!tileCoords.HasValue)
        {
            return;
        }
        IsoChunkSelected e = new IsoChunkSelected();

        e.Array      = BaseTiles;
        e.Chunk      = this;
        e.TileCoords = tileCoords.Value;
        OnChunkEntered(e);
    }