Tested navigation on water and rocks in water.

main
Martin Felis 2023-12-29 17:55:43 +01:00
parent 06b808c10d
commit c2cce1ae0f
1 changed files with 12 additions and 6 deletions

View File

@ -20,7 +20,7 @@ public class World : Spatial {
public const int NumChunkRows = 3;
public const int NumChunkColumns = NumChunkRows;
private readonly System.Collections.Generic.Dictionary<int, HexTile3D.TileTypeInfo> _tileTypeInfos = new();
private readonly Godot.Collections.Dictionary<Vector2, WorldChunk> _cachedWorldChunks;
@ -138,7 +138,8 @@ public class World : Spatial {
GD.Load<ShaderMaterial>("res://materials/WorldTileTypeMaterial.tres");
Color tileTypeColor = (Color)worldTileTypeShaderMaterial.GetShaderParam(tileTypeName + "Color");
_tileTypeInfos[tileTypeColor.ToRgba32()] = new HexTile3D.TileTypeInfo(tileTypeName, tileTypeColor, tileTypeMask);
_tileTypeInfos[tileTypeColor.ToRgba32()] =
new HexTile3D.TileTypeInfo(tileTypeName, tileTypeColor, tileTypeMask);
}
public void InitNoiseGenerator() {
@ -274,6 +275,13 @@ public class World : Spatial {
// TODO: MarkCellUnwalkable(cell);
// else if (environmentRandom.NextDouble() < 0.01)
} else if (tileTypeInfo.Name == "Water" || tileTypeInfo.Name == "LightWater" ||
tileTypeInfo.Name == "DeepWater") {
Spatial rockAsset = SelectAsset(textureCoord, _rockAssets, environmentRandom, 0.01);
if (rockAsset != null) {
chunk.Entities.AddChild(rockAsset);
MarkCellUnwalkable(HexGrid.GetHexAtOffset(offsetCoord));
}
// {
// var chestAsset = (Chest)_chestScene.Instance();
// var assetTransform = Transform.Identity;
@ -488,10 +496,8 @@ public class World : Spatial {
if ((entity.EntityMask ^ tileTypeMask) != 0) {
nextHexCost = 0;
}
}
else
{
GD.Print("Could not find tile type info for color " + tileTypeColor);
} else {
GD.Print("Could not find tile type info for color " + tileTypeColor);
}
}