Units, bloom, lighting, rotational

This commit is contained in:
2024-12-15 17:41:03 -06:00
parent b9a1347fae
commit 29fdb6cbf0
15 changed files with 902 additions and 76 deletions

View File

@@ -13,9 +13,11 @@ GameObject:
- component: {fileID: -5258542714815234591}
- component: {fileID: -945589377389130640}
- component: {fileID: 2580485966366843203}
m_Layer: 0
- component: {fileID: -56063342100987482}
- component: {fileID: 1236946940358429026}
m_Layer: 6
m_Name: BasePlanet
m_TagString: Untagged
m_TagString: Planets
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@@ -47,7 +49,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5e5a2958b00708d4bacd5703ef7b2b50, type: 3}
m_Name:
m_EditorClassIdentifier:
Size: 151
Size: 139
Bulbs: 1
edgeColor: {r: 0.4811321, g: 0.4811321, b: 0.4811321, a: 1}
fillColor: {r: 0.1509434, g: 0.1509434, b: 0.1509434, a: 1}
@@ -95,53 +97,115 @@ LineRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 1.51, y: 0, z: 0}
- {x: 1.496527, y: 0.20126332, z: 0}
- {x: 1.4563484, y: 0.39893508, z: 0}
- {x: 1.3901813, y: 0.5894878, z: 0}
- {x: 1.2992064, y: 0.7695212, z: 0}
- {x: 1.185047, y: 0.93582237, z: 0}
- {x: 1.0497406, y: 1.0854237, z: 0}
- {x: 0.89570135, y: 1.2156558, z: 0}
- {x: 0.7256784, y: 1.3241944, z: 0}
- {x: 0.5427058, y: 1.4091028, z: 0}
- {x: 0.3500483, y: 1.4688656, z: 0}
- {x: 0.15114443, y: 1.5024165, z: 0}
- {x: -0.050456624, y: 1.5091567, z: 0}
- {x: -0.25115746, y: 1.488966, z: 0}
- {x: -0.4473762, y: 1.4422047, z: 0}
- {x: -0.6356115, y: 1.3697072, z: 0}
- {x: -0.8125045, y: 1.2727673, z: 0}
- {x: -0.9748982, y: 1.1531147, z: 0}
- {x: -1.1198947, y: 1.0128849, z: 0}
- {x: -1.2449068, y: 0.85458, z: 0}
- {x: -1.3477036, y: 0.681025, z: 0}
- {x: -1.4264503, y: 0.49531755, z: 0}
- {x: -1.4797422, y: 0.3007707, z: 0}
- {x: -1.506628, y: 0.100856625, z: 0}
- {x: -1.5066279, y: -0.10085689, z: 0}
- {x: -1.4797422, y: -0.30077097, z: 0}
- {x: -1.4264503, y: -0.49531776, z: 0}
- {x: -1.3477035, y: -0.6810253, z: 0}
- {x: -1.2449067, y: -0.8545802, z: 0}
- {x: -1.1198945, y: -1.0128851, z: 0}
- {x: -0.97489804, y: -1.1531148, z: 0}
- {x: -0.81250393, y: -1.2727677, z: 0}
- {x: -0.6356113, y: -1.3697073, z: 0}
- {x: -0.44737607, y: -1.4422047, z: 0}
- {x: -0.25115684, y: -1.4889662, z: 0}
- {x: -0.05045636, y: -1.5091567, z: 0}
- {x: 0.15114452, y: -1.5024165, z: 0}
- {x: 0.35004893, y: -1.4688655, z: 0}
- {x: 0.54270595, y: -1.4091027, z: 0}
- {x: 0.72567844, y: -1.3241943, z: 0}
- {x: 0.89570177, y: -1.2156554, z: 0}
- {x: 1.0497408, y: -1.0854236, z: 0}
- {x: 1.185047, y: -0.93582237, z: 0}
- {x: 1.2992066, y: -0.7695207, z: 0}
- {x: 1.3901814, y: -0.58948755, z: 0}
- {x: 1.4563484, y: -0.39893502, z: 0}
- {x: 1.4965271, y: -0.2012628, z: 0}
- {x: 1.39, y: 0, z: 0}
- {x: 1.3876913, y: 0.08008066, z: 0}
- {x: 1.3807727, y: 0.1598953, z: 0}
- {x: 1.3692675, y: 0.23917878, z: 0}
- {x: 1.3532137, y: 0.31766775, z: 0}
- {x: 1.3326646, y: 0.39510143, z: 0}
- {x: 1.3076885, y: 0.47122264, z: 0}
- {x: 1.2783685, y: 0.5457785, z: 0}
- {x: 1.2448018, y: 0.61852133, z: 0}
- {x: 1.2070999, y: 0.6892095, z: 0}
- {x: 1.1653882, y: 0.7576082, z: 0}
- {x: 1.1198053, y: 0.8234901, z: 0}
- {x: 1.0705024, y: 0.88663656, z: 0}
- {x: 1.0176436, y: 0.9468377, z: 0}
- {x: 0.9614041, y: 1.0038935, z: 0}
- {x: 0.9019709, y: 1.0576144, z: 0}
- {x: 0.8395415, y: 1.1078222, z: 0}
- {x: 0.7743233, y: 1.1543498, z: 0}
- {x: 0.7065328, y: 1.1970428, z: 0}
- {x: 0.6363952, y: 1.2357593, z: 0}
- {x: 0.5641437, y: 1.2703707, z: 0}
- {x: 0.4900181, y: 1.3007622, z: 0}
- {x: 0.41426474, y: 1.3268325, z: 0}
- {x: 0.33713508, y: 1.3484954, z: 0}
- {x: 0.25888562, y: 1.3656787, z: 0}
- {x: 0.17977619, y: 1.3783252, z: 0}
- {x: 0.10006955, y: 1.3863932, z: 0}
- {x: 0.020030497, y: 1.3898556, z: 0}
- {x: -0.060075097, y: 1.3887011, z: 0}
- {x: -0.13998112, y: 1.3829336, z: 0}
- {x: -0.21942216, y: 1.372572, z: 0}
- {x: -0.2981343, y: 1.3576509, z: 0}
- {x: -0.37585622, y: 1.3382198, z: 0}
- {x: -0.4523294, y: 1.3143432, z: 0}
- {x: -0.5273, y: 1.2861005, z: 0}
- {x: -0.600519, y: 1.2535856, z: 0}
- {x: -0.6717431, y: 1.2169064, z: 0}
- {x: -0.74073577, y: 1.1761848, z: 0}
- {x: -0.8072677, y: 1.1315559, z: 0}
- {x: -0.8711181, y: 1.0831681, z: 0}
- {x: -0.93207467, y: 1.0311822, z: 0}
- {x: -0.9899349, y: 0.97577083, z: 0}
- {x: -1.0445068, y: 0.917118, z: 0}
- {x: -1.095609, y: 0.8554186, z: 0}
- {x: -1.1430715, y: 0.7908776, z: 0}
- {x: -1.186737, y: 0.7237094, z: 0}
- {x: -1.2264603, y: 0.65413684, z: 0}
- {x: -1.2621094, y: 0.58239156, z: 0}
- {x: -1.2935658, y: 0.50871164, z: 0}
- {x: -1.3207252, y: 0.4333418, z: 0}
- {x: -1.3434972, y: 0.35653248, z: 0}
- {x: -1.3618063, y: 0.27853876, z: 0}
- {x: -1.3755915, y: 0.19961978, z: 0}
- {x: -1.3848071, y: 0.12003768, z: 0}
- {x: -1.3894227, y: 0.040056836, z: 0}
- {x: -1.3894227, y: -0.040057078, z: 0}
- {x: -1.3848071, y: -0.12003792, z: 0}
- {x: -1.3755915, y: -0.19962001, z: 0}
- {x: -1.3618062, y: -0.278539, z: 0}
- {x: -1.3434972, y: -0.3565327, z: 0}
- {x: -1.3207251, y: -0.433342, z: 0}
- {x: -1.2935658, y: -0.5087119, z: 0}
- {x: -1.2621093, y: -0.58239174, z: 0}
- {x: -1.2264602, y: -0.6541371, z: 0}
- {x: -1.1867368, y: -0.72370964, z: 0}
- {x: -1.1430714, y: -0.7908779, z: 0}
- {x: -1.0956088, y: -0.85541886, z: 0}
- {x: -1.0445067, y: -0.9171182, z: 0}
- {x: -0.98993474, y: -0.975771, z: 0}
- {x: -0.9320745, y: -1.0311824, z: 0}
- {x: -0.87111783, y: -1.0831683, z: 0}
- {x: -0.8072676, y: -1.131556, z: 0}
- {x: -0.74073553, y: -1.1761848, z: 0}
- {x: -0.67174286, y: -1.2169065, z: 0}
- {x: -0.60051876, y: -1.2535857, z: 0}
- {x: -0.52729976, y: -1.2861006, z: 0}
- {x: -0.4523292, y: -1.3143432, z: 0}
- {x: -0.37585598, y: -1.3382198, z: 0}
- {x: -0.2981342, y: -1.3576509, z: 0}
- {x: -0.21942207, y: -1.372572, z: 0}
- {x: -0.13998105, y: -1.3829336, z: 0}
- {x: -0.060075022, y: -1.3887011, z: 0}
- {x: 0.020030575, y: -1.3898556, z: 0}
- {x: 0.10006963, y: -1.3863932, z: 0}
- {x: 0.17977627, y: -1.3783252, z: 0}
- {x: 0.2588857, y: -1.3656787, z: 0}
- {x: 0.33713514, y: -1.3484954, z: 0}
- {x: 0.41426465, y: -1.3268325, z: 0}
- {x: 0.490018, y: -1.3007622, z: 0}
- {x: 0.5641436, y: -1.2703708, z: 0}
- {x: 0.63639516, y: -1.2357594, z: 0}
- {x: 0.70653325, y: -1.1970425, z: 0}
- {x: 0.77432376, y: -1.1543496, z: 0}
- {x: 0.839542, y: -1.1078218, z: 0}
- {x: 0.9019713, y: -1.0576142, z: 0}
- {x: 0.9614044, y: -1.0038931, z: 0}
- {x: 1.0176438, y: -0.94683737, z: 0}
- {x: 1.0705028, y: -0.88663626, z: 0}
- {x: 1.1198056, y: -0.8234898, z: 0}
- {x: 1.1653885, y: -0.7576078, z: 0}
- {x: 1.2071002, y: -0.6892091, z: 0}
- {x: 1.2448019, y: -0.618521, z: 0}
- {x: 1.2783685, y: -0.54577816, z: 0}
- {x: 1.3076886, y: -0.4712223, z: 0}
- {x: 1.3326646, y: -0.3951011, z: 0}
- {x: 1.3532137, y: -0.31766742, z: 0}
- {x: 1.3692676, y: -0.2391785, z: 0}
- {x: 1.3807728, y: -0.15989502, z: 0}
- {x: 1.3876913, y: -0.0800804, z: 0}
m_Parameters:
serializedVersion: 3
widthMultiplier: 0.0466
@@ -251,3 +315,88 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!58 &-56063342100987482
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7154824257338098917}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.001685977, y: 0}
serializedVersion: 2
m_Radius: 1.39
--- !u!114 &1236946940358429026
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7154824257338098917}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ComponentVersion: 1
m_LightType: 3
m_BlendStyleIndex: 0
m_FalloffIntensity: 0.159
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1.57
m_LightVolumeIntensity: 1
m_LightVolumeIntensityEnabled: 0
m_ApplyToSortingLayers:
m_LightCookieSprite: {fileID: 0}
m_DeprecatedPointLightCookieSprite: {fileID: 0}
m_LightOrder: 0
m_AlphaBlendOnOverlap: 0
m_OverlapOperation: 0
m_NormalMapDistance: 3
m_NormalMapQuality: 2
m_UseNormalMap: 0
m_ShadowIntensityEnabled: 0
m_ShadowIntensity: 0.75
m_ShadowVolumeIntensityEnabled: 0
m_ShadowVolumeIntensity: 0.75
m_LocalBounds:
m_Center: {x: 0, y: -0.00000011920929, z: 0}
m_Extent: {x: 0.9985302, y: 0.99853027, z: 0}
m_PointLightInnerAngle: 360
m_PointLightOuterAngle: 360
m_PointLightInnerRadius: 0
m_PointLightOuterRadius: 1
m_ShapeLightParametricSides: 5
m_ShapeLightParametricAngleOffset: 0
m_ShapeLightParametricRadius: 1
m_ShapeLightFalloffSize: 0.5
m_ShapeLightFalloffOffset: {x: 0, y: 0}
m_ShapePath:
- {x: -0.5, y: -0.5, z: 0}
- {x: 0.5, y: -0.5, z: 0}
- {x: 0.5, y: 0.5, z: 0}
- {x: -0.5, y: 0.5, z: 0}

View File

@@ -53,7 +53,10 @@ public class Network : MonoBehaviour
{
_planets = new List<Planet>(FindObjectsOfType<Planet>());
AddPlanet();
if (_planets.Count == 0)
{
AddPlanet();
}
}
void Update()

View File

@@ -6,7 +6,9 @@ public class Planet : MonoBehaviour
{
private MeshFilter _meshFilter;
private LineRenderer _lineRenderer;
private CircleCollider2D _circleCollider;
private Network _network;
private HashSet<Unit> _units;
[SerializeField] public HashSet<Planet> neighbors;
@@ -20,12 +22,36 @@ public class Planet : MonoBehaviour
{
_lineRenderer = gameObject.GetComponent<LineRenderer>();
_network = FindObjectOfType<Network>();
_units = new HashSet<Unit>();
}
void OnEnable()
{
}
void OnMouseDown()
{
SpawnUnit();
}
public Vector2 GetSurfacePosition(float angle, float distance = 0)
{
var radius = Size / 100f + distance;
var theta = angle * Mathf.Deg2Rad;
return new Vector2(Mathf.Cos(theta), Mathf.Sin(theta)) * radius;
}
void SpawnUnit()
{
var unitPrefab = Resources.Load<GameObject>("BaseUnit");
var unitObject = Instantiate(unitPrefab);
unitObject.transform.position = transform.position;
unitObject.transform.parent = transform;
_units.Add(unitObject.GetComponent<Unit>());
Debug.Log("Spawned unit " + unitObject.GetComponent<Unit>().GetHashCode());
unitObject.name = "Unit " + _units.Count;
}
bool IsConnected(Planet other)
{
return neighbors.Contains(other);
@@ -36,6 +62,11 @@ public class Planet : MonoBehaviour
_network.Destroyed(this);
}
public void UnitDestroyed(Unit unit)
{
_units.Remove(unit);
}
void Connect(params Planet[] others)
{
foreach (var other in others)
@@ -49,10 +80,12 @@ public class Planet : MonoBehaviour
{
_meshFilter = gameObject.GetComponent<MeshFilter>();
_lineRenderer = gameObject.GetComponent<LineRenderer>();
_circleCollider = gameObject.GetComponent<CircleCollider2D>();
_lineRenderer.widthMultiplier = edgeWidth;
_lineRenderer.positionCount = 0;
_lineRenderer.loop = true;
_lineRenderer.useWorldSpace = false;
_lineRenderer.startColor = edgeColor;
_lineRenderer.endColor = edgeColor;
_lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
@@ -85,12 +118,12 @@ public class Planet : MonoBehaviour
colors = colors
};
Debug.Log($"{triangles.Length} triangles");
mesh.RecalculateNormals();
mesh.RecalculateBounds();
mesh.RecalculateTangents();
_circleCollider.radius = radius;
_meshFilter.mesh = mesh;
_lineRenderer.positionCount = mesh.vertices.Length;
_lineRenderer.SetPositions(mesh.vertices);

8
Assets/Resources.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c739af1801515147a7c13491213bd1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,281 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &456388662108413010
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 888640231884717936}
- component: {fileID: -1081484212293938886}
- component: {fileID: 6421509436193620488}
- component: {fileID: -7622358219861685464}
- component: {fileID: 4847557096520017582}
- component: {fileID: -2959853973706592986}
- component: {fileID: 765297374451092180}
m_Layer: 7
m_Name: BaseUnit
m_TagString: Units
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &888640231884717936
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-1081484212293938886
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3ec3d3b5cd4aed4ca6a7dba126624a4, type: 3}
m_Name:
m_EditorClassIdentifier:
edgeWidth: 0.015
fillColor: {r: 0.509434, g: 0.509434, b: 0.509434, a: 1}
edgeColor: {r: 0.1792453, g: 0.1792453, b: 0.1792453, a: 1}
Size: 16
--- !u!33 &6421509436193620488
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Mesh: {fileID: 0}
--- !u!23 &-7622358219861685464
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!120 &4847557096520017582
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 1
m_Loop: 0
m_ApplyActiveColorSpace: 1
--- !u!64 &-2959853973706592986
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 0}
--- !u!114 &765297374451092180
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 456388662108413010}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ComponentVersion: 1
m_LightType: 3
m_BlendStyleIndex: 0
m_FalloffIntensity: 0.5
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 26.48
m_LightVolumeIntensity: 1
m_LightVolumeIntensityEnabled: 0
m_ApplyToSortingLayers:
m_LightCookieSprite: {fileID: 0}
m_DeprecatedPointLightCookieSprite: {fileID: 0}
m_LightOrder: 0
m_AlphaBlendOnOverlap: 0
m_OverlapOperation: 0
m_NormalMapDistance: 3
m_NormalMapQuality: 2
m_UseNormalMap: 0
m_ShadowIntensityEnabled: 0
m_ShadowIntensity: 0.75
m_ShadowVolumeIntensityEnabled: 0
m_ShadowVolumeIntensity: 0.75
m_LocalBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_PointLightInnerAngle: 360
m_PointLightOuterAngle: 360
m_PointLightInnerRadius: 1
m_PointLightOuterRadius: 1.35
m_ShapeLightParametricSides: 5
m_ShapeLightParametricAngleOffset: 0
m_ShapeLightParametricRadius: 1
m_ShapeLightFalloffSize: 0.5
m_ShapeLightFalloffOffset: {x: 0, y: 0}
m_ShapePath:
- {x: -0.5, y: -0.5, z: 0}
- {x: 0.5, y: -0.5, z: 0}
- {x: 0.5, y: 0.5, z: 0}
- {x: -0.5, y: 0.5, z: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fcd1415bed5d9814189bea2e8f36dbec
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 848ad617ab4bd82499955bfd5c56db22
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -151,7 +151,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9960b3a7a4c8979429961d8fee1619f2, type: 3}
m_Name:
m_EditorClassIdentifier:
planets: []
planetPrefab: {fileID: -2170283451010205844, guid: 65fefe6556140d6479259b34ecece44c, type: 3}
--- !u!4 &148725819
Transform:
m_ObjectHideFlags: 0
@@ -203,8 +203,8 @@ Camera:
m_GameObject: {fileID: 517509222}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_ClearFlags: 2
m_BackGroundColor: {r: 0.1509434, g: 0.1509434, b: 0.1509434, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
@@ -283,8 +283,8 @@ MonoBehaviour:
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_RenderPostProcessing: 1
m_Antialiasing: 2
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
@@ -304,9 +304,59 @@ MonoBehaviour:
m_MipBias: 0
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
--- !u!1 &1194077224
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1194077226}
- component: {fileID: 1194077225}
m_Layer: 0
m_Name: Global Volume
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1194077225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1194077224}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IsGlobal: 1
priority: 0
blendDistance: 0
weight: 1
sharedProfile: {fileID: 11400000, guid: 77c615d3241302e489659d61f1635693, type: 2}
--- !u!4 &1194077226
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1194077224}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.160795, y: 0.53630275, z: 0.074478135}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 517509225}
- {fileID: 148725819}
- {fileID: 1194077226}

View File

@@ -0,0 +1,63 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-315830951645749855
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 0
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.27
intensity:
m_OverrideState: 1
m_Value: 0.35
scatter:
m_OverrideState: 0
m_Value: 0.7
clamp:
m_OverrideState: 0
m_Value: 65472
tint:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 0
m_Value: 0
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 0
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 0
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Global Volume Profile
m_EditorClassIdentifier:
components:
- {fileID: -315830951645749855}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 77c615d3241302e489659d61f1635693
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -25,13 +25,14 @@ MonoBehaviour:
m_SupportsTerrainHoles: 1
m_SupportsHDR: 1
m_HDRColorBufferPrecision: 0
m_MSAA: 1
m_MSAA: 2
m_RenderScale: 1
m_UpscalingFilter: 0
m_FsrOverrideSharpness: 0
m_FsrSharpness: 0.92
m_EnableLODCrossFade: 1
m_LODCrossFadeDitheringType: 1
m_ShEvalMode: 0
m_MainLightRenderingMode: 1
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 2048
@@ -52,9 +53,11 @@ MonoBehaviour:
m_CascadeBorder: 0.1
m_ShadowDepthBias: 1
m_ShadowNormalBias: 1
m_AnyShadowsSupported: 1
m_SoftShadowsSupported: 0
m_ConservativeEnclosingSphere: 0
m_NumIterationsEnclosingSphere: 64
m_SoftShadowQuality: 2
m_AdditionalLightsCookieResolution: 2048
m_AdditionalLightsCookieFormat: 3
m_UseSRPBatcher: 1
@@ -69,6 +72,7 @@ MonoBehaviour:
m_ColorGradingMode: 0
m_ColorGradingLutSize: 32
m_UseFastSRGBLinearConversion: 0
m_SupportDataDrivenLensFlare: 1
m_ShadowType: 1
m_LocalShadowsSupported: 0
m_LocalShadowsAtlasResolution: 256
@@ -78,5 +82,33 @@ MonoBehaviour:
m_Textures:
blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3}
bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3}
m_PrefilteringModeMainLightShadows: 1
m_PrefilteringModeAdditionalLight: 4
m_PrefilteringModeAdditionalLightShadows: 1
m_PrefilterXRKeywords: 0
m_PrefilteringModeForwardPlus: 1
m_PrefilteringModeDeferredRendering: 1
m_PrefilteringModeScreenSpaceOcclusion: 1
m_PrefilterDebugKeywords: 0
m_PrefilterWriteRenderingLayers: 0
m_PrefilterHDROutput: 0
m_PrefilterSSAODepthNormals: 0
m_PrefilterSSAOSourceDepthLow: 0
m_PrefilterSSAOSourceDepthMedium: 0
m_PrefilterSSAOSourceDepthHigh: 0
m_PrefilterSSAOInterleaved: 0
m_PrefilterSSAOBlueNoise: 0
m_PrefilterSSAOSampleCountLow: 0
m_PrefilterSSAOSampleCountMedium: 0
m_PrefilterSSAOSampleCountHigh: 0
m_PrefilterDBufferMRT1: 0
m_PrefilterDBufferMRT2: 0
m_PrefilterDBufferMRT3: 0
m_PrefilterSoftShadowsQualityLow: 0
m_PrefilterSoftShadowsQualityMedium: 0
m_PrefilterSoftShadowsQualityHigh: 0
m_PrefilterSoftShadows: 0
m_PrefilterScreenCoord: 0
m_PrefilterNativeRenderPass: 0
m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0

92
Assets/Unit.cs Normal file
View File

@@ -0,0 +1,92 @@
using System.Linq;
using UnityEngine;
public class Unit : MonoBehaviour
{
private Planet planet;
private Vector2 planetaryVelocity; // X: rotational, Y: altitude
public float edgeWidth;
public Color fillColor = Color.white;
public Color edgeColor = Color.white;
public float Size;
void Start()
{
Render();
planet = GetComponentInParent<Planet>();
planetaryVelocity = new Vector2(0, 0)
{
x = (Random.value > 0.5f ? 1 : -1) * 32 * Random.Range(0.8f, 1.2f),
};
transform.position = planet.GetSurfacePosition(Random.Range(0, 360), 0.4f);
}
void Update()
{
transform.RotateAround(planet.transform.position, Vector3.forward, planetaryVelocity.x * Time.deltaTime);
transform.position = Vector2.MoveTowards(transform.position, planet.transform.position, planetaryVelocity.y * Time.deltaTime);
}
private void OnDestroy()
{
planet.UnitDestroyed(this);
}
public override int GetHashCode()
{
return gameObject.GetHashCode();
}
public void Render()
{
var meshFilter = gameObject.GetComponent<MeshFilter>();
var lineRenderer = gameObject.GetComponent<LineRenderer>();
var meshCollider = gameObject.GetComponent<MeshCollider>();
var meshRenderer = gameObject.GetComponent<MeshRenderer>();
lineRenderer.widthMultiplier = edgeWidth;
lineRenderer.positionCount = 0;
lineRenderer.useWorldSpace = false;
lineRenderer.loop = true;
lineRenderer.startColor = edgeColor;
lineRenderer.endColor = edgeColor;
lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
meshRenderer.material = new Material(Shader.Find("Sprites/Default"));
// Unit is just a simple triangle
var vertices = new[]
{
new Vector2(0, 0),
new Vector2(0.5f, 1),
new Vector2(1, 0)
};
vertices = vertices.Select(v => v * Size / 100f).ToArray();
// Find all the triangles in the shape
var triangles = new Triangulator(vertices).Triangulate();
// Assign each vertex the fill color
var colors = Enumerable.Repeat(fillColor, vertices.Length).ToArray();
var mesh = new Mesh
{
name = "Triangle",
vertices = vertices.ToVector3(),
triangles = triangles,
colors = colors
};
mesh.RecalculateNormals();
mesh.RecalculateBounds();
mesh.RecalculateTangents();
meshCollider.sharedMesh = mesh;
meshFilter.mesh = mesh;
lineRenderer.positionCount = mesh.vertices.Length;
lineRenderer.SetPositions(mesh.vertices);
}
}

11
Assets/Unit.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d3ec3d3b5cd4aed4ca6a7dba126624a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: