Rebrand as Big Ship Tycoon and add crew operations
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Soundings
|
||||
{
|
||||
private readonly List<Vector3> vertices = new List<Vector3>();
|
||||
private readonly List<int> triangles = new List<int>();
|
||||
private List<Vector4> waterCoordinates;
|
||||
|
||||
public Mesh Bake()
|
||||
{
|
||||
@@ -15,10 +16,39 @@ namespace Soundings
|
||||
mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
|
||||
mesh.SetVertices(vertices);
|
||||
mesh.SetTriangles(triangles, 0);
|
||||
if (waterCoordinates != null)
|
||||
{
|
||||
FillWaterCoordinates();
|
||||
mesh.SetUVs(0, waterCoordinates);
|
||||
}
|
||||
mesh.RecalculateNormals();
|
||||
return mesh;
|
||||
}
|
||||
|
||||
public void WaterSurface(Vector2[] outline, Vector2 center, float height, Vector2 halfSize)
|
||||
{
|
||||
waterCoordinates ??= new List<Vector4>();
|
||||
FillWaterCoordinates();
|
||||
int start = vertices.Count;
|
||||
foreach (Vector2 edge in outline)
|
||||
{
|
||||
Vector2 offset = edge - center;
|
||||
vertices.Add(Point(edge, height));
|
||||
waterCoordinates.Add(new Vector4(offset.x, offset.y, halfSize.x, halfSize.y));
|
||||
}
|
||||
int middle = vertices.Count;
|
||||
vertices.Add(Point(center, height));
|
||||
waterCoordinates.Add(new Vector4(0, 0, halfSize.x, halfSize.y));
|
||||
for (int i = 0; i < outline.Length; i++)
|
||||
AddTriangle(start + i, middle, start + (i + 1) % outline.Length);
|
||||
}
|
||||
|
||||
private void FillWaterCoordinates()
|
||||
{
|
||||
while (waterCoordinates.Count < vertices.Count)
|
||||
waterCoordinates.Add(Vector4.zero);
|
||||
}
|
||||
|
||||
public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d)
|
||||
{
|
||||
int start = vertices.Count;
|
||||
|
||||
Reference in New Issue
Block a user