94 lines
1.7 KiB
C#
94 lines
1.7 KiB
C#
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER.PlanetCreator
|
|
{
|
|
public class PlanetChunkProperties
|
|
{
|
|
public PlanetChunkProperties Parent;
|
|
|
|
public Vector3 Center;
|
|
|
|
public Bounds Bounds;
|
|
|
|
public Quaternion Rotation;
|
|
|
|
public PlanetChunkProperties[] Children;
|
|
|
|
public PlanetChunkObject ChunkObject;
|
|
|
|
public float Size;
|
|
|
|
public float maxGeoError;
|
|
|
|
public Vector2 min;
|
|
|
|
public int LODLevel;
|
|
|
|
public bool isSpliting;
|
|
|
|
public int SplitCount;
|
|
|
|
public bool isMerged = true;
|
|
|
|
public bool Active;
|
|
|
|
public bool isSplit
|
|
{
|
|
get
|
|
{
|
|
if (Children == null)
|
|
{
|
|
return false;
|
|
}
|
|
PlanetChunkProperties[] children = Children;
|
|
foreach (PlanetChunkProperties planetChunkProperties in children)
|
|
{
|
|
if (planetChunkProperties == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (planetChunkProperties.ChunkObject == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (!planetChunkProperties.Active)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public Vector2 BottomLeft => min;
|
|
|
|
public Vector2 BottomRight => min + Vector2.right * Size;
|
|
|
|
public Vector2 BottomMiddle => min + Vector2.right * (Size / 2f);
|
|
|
|
public Vector2 TopLeft => min + Vector2.up * Size;
|
|
|
|
public Vector2 TopRight => min + Vector2.up * Size + Vector2.right * Size;
|
|
|
|
public Vector2 TopMiddle => min + Vector2.up * Size + Vector2.right * (Size / 2f);
|
|
|
|
public Vector2 Middle => min + Vector2.up * (Size / 2f) + Vector2.right * (Size / 2f);
|
|
|
|
public Vector2 MiddleLeft => min + Vector2.up * (Size / 2f);
|
|
|
|
public Vector2 MiddleRight => min + Vector2.right * Size + Vector2.up * (Size / 2f);
|
|
|
|
public PlanetChunkProperties[] Chunks
|
|
{
|
|
get
|
|
{
|
|
return Children;
|
|
}
|
|
set
|
|
{
|
|
Children = value;
|
|
}
|
|
}
|
|
}
|
|
}
|