Beispiel #1
0
    public void OnClickPoint(int x, int y)
    {
        if (isEditingMap)
        {
            HexPoint p = currentBoard.GetPoint(x, y);

            if (p.state == HexPoint.State.WIREFRAME)
            {
                p.ForceChangeStateTo(HexPoint.State.NORMAL);
            }
            else
            {
                p.ForceChangeStateTo(HexPoint.State.WIREFRAME);
            }
        }
        else
        {
            BoardEntity ent = currentBoard.FindEntityAtPoint(currentBoard.GetPoint(x, y));
            if (ent != null)
            {
                currentBoard.RemoveEntity(ent);
            }
            else
            {
                ent = Instantiate(selectingEntity.gameObject).GetComponent <BoardEntity>();
                currentBoard.AddEntity(ent, x, y);
            }
        }
    }