Tested navigation on water and rocks in water.
parent
06b808c10d
commit
c2cce1ae0f
|
@ -20,7 +20,7 @@ public class World : Spatial {
|
||||||
public const int NumChunkRows = 3;
|
public const int NumChunkRows = 3;
|
||||||
public const int NumChunkColumns = NumChunkRows;
|
public const int NumChunkColumns = NumChunkRows;
|
||||||
|
|
||||||
|
|
||||||
private readonly System.Collections.Generic.Dictionary<int, HexTile3D.TileTypeInfo> _tileTypeInfos = new();
|
private readonly System.Collections.Generic.Dictionary<int, HexTile3D.TileTypeInfo> _tileTypeInfos = new();
|
||||||
|
|
||||||
private readonly Godot.Collections.Dictionary<Vector2, WorldChunk> _cachedWorldChunks;
|
private readonly Godot.Collections.Dictionary<Vector2, WorldChunk> _cachedWorldChunks;
|
||||||
|
@ -138,7 +138,8 @@ public class World : Spatial {
|
||||||
GD.Load<ShaderMaterial>("res://materials/WorldTileTypeMaterial.tres");
|
GD.Load<ShaderMaterial>("res://materials/WorldTileTypeMaterial.tres");
|
||||||
|
|
||||||
Color tileTypeColor = (Color)worldTileTypeShaderMaterial.GetShaderParam(tileTypeName + "Color");
|
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() {
|
public void InitNoiseGenerator() {
|
||||||
|
@ -274,6 +275,13 @@ public class World : Spatial {
|
||||||
|
|
||||||
// TODO: MarkCellUnwalkable(cell);
|
// TODO: MarkCellUnwalkable(cell);
|
||||||
// else if (environmentRandom.NextDouble() < 0.01)
|
// 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 chestAsset = (Chest)_chestScene.Instance();
|
||||||
// var assetTransform = Transform.Identity;
|
// var assetTransform = Transform.Identity;
|
||||||
|
@ -488,10 +496,8 @@ public class World : Spatial {
|
||||||
if ((entity.EntityMask ^ tileTypeMask) != 0) {
|
if ((entity.EntityMask ^ tileTypeMask) != 0) {
|
||||||
nextHexCost = 0;
|
nextHexCost = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
GD.Print("Could not find tile type info for color " + tileTypeColor);
|
||||||
{
|
|
||||||
GD.Print("Could not find tile type info for color " + tileTypeColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue