Minor cleanup in HexTile3D.

WorldChunkRefactoring
Martin Felis 2023-08-28 13:59:39 +02:00
parent 136de4e246
commit 76a7abf22f
2 changed files with 1 additions and 43 deletions

View File

@ -25,10 +25,6 @@ public class HexTile3D : Spatial
delegate void TileHovered(HexTile3D tile3d); delegate void TileHovered(HexTile3D tile3d);
// other member variables // other member variables
private SpatialMaterial _undefinedMaterial;
private SpatialMaterial _sandMaterial;
private SpatialMaterial _grassMaterial;
private SpatialMaterial _deepGrassMaterial;
private SpatialMaterial _previousMaterial; private SpatialMaterial _previousMaterial;
private HexGrid _hexGrid; private HexGrid _hexGrid;
@ -52,36 +48,7 @@ public class HexTile3D : Spatial
} }
} }
private TileType _type; public TileType Type { get; set; }
public TileType Type
{
get { return _type; }
set
{
_type = value;
// switch (_type)
// {
// case TileType.Undefined:
// _mesh.SetSurfaceMaterial(0, _undefinedMaterial);
// break;
// case TileType.Sand:
// _mesh.SetSurfaceMaterial(0, _sandMaterial);
// break;
// case TileType.Grass:
// _mesh.SetSurfaceMaterial(0, _grassMaterial);
// break;
// case TileType.DeepGrass:
// _mesh.SetSurfaceMaterial(0, _deepGrassMaterial);
// break;
// default:
// GD.Print("Invalid tile type: " + value.ToString());
// break;
// }
}
}
HexTile3D() HexTile3D()
{ {
@ -98,11 +65,6 @@ public class HexTile3D : Spatial
_staticBody.Connect("mouse_entered", this, nameof(OnAreaMouseEntered)); _staticBody.Connect("mouse_entered", this, nameof(OnAreaMouseEntered));
_staticBody.Connect("mouse_exited", this, nameof(OnAreaMouseExited)); _staticBody.Connect("mouse_exited", this, nameof(OnAreaMouseExited));
_undefinedMaterial = GD.Load<SpatialMaterial>("res://materials/UndefinedTile.tres");
_sandMaterial = GD.Load<SpatialMaterial>("res://materials/SandTile.tres");
_grassMaterial = GD.Load<SpatialMaterial>("res://materials/GrassTile.tres");
_deepGrassMaterial = GD.Load<SpatialMaterial>("res://materials/DeepGrassTile.tres");
Mesh = GetNode<MeshInstance>("Mesh"); Mesh = GetNode<MeshInstance>("Mesh");
Debug.Assert(Mesh != null); Debug.Assert(Mesh != null);

View File

@ -36,7 +36,3 @@ shape = SubResource( 5 )
visible = false visible = false
mesh = SubResource( 6 ) mesh = SubResource( 6 )
material/0 = SubResource( 7 ) material/0 = SubResource( 7 )
[node name="MultiMeshInstance" type="MultiMeshInstance" parent="."]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, -5, 0 )
visible = false