Exemplo n.º 1
0
    public void Move(GridCoord start, GridCoord end)
    {
        if (start.Equals(end))
            return;

        var occupying = gridGOs[end.x, end.y, end.z];
        if (occupying != null)
            Destroy(occupying);

        gridGOs[start.x, start.y, start.z].transform.position = end.WorldPosition;
        gridGOs[end.x, end.y, end.z] = gridGOs[start.x, start.y, start.z];
        gridGOs[start.x, start.y, start.z] = null;

        grid[end.x, end.y, end.z] = grid[start.x, start.y, start.z];
        grid[start.x, start.y, start.z] = VoxelType.Empty;
    }