From 8e65f4f948539fddc112ae8c63b8d6ac019d286d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 5 Oct 2019 20:41:07 +0200 Subject: [PATCH] Everything seems to be working! --- Assets/Components/BlackHole.cs | 45 +++++++ .../{MergedInfo.cs.meta => BlackHole.cs.meta} | 2 +- .../{PanWithMMB.cs => CameraPan.cs} | 11 +- .../{PanWithMMB.cs.meta => CameraPan.cs.meta} | 0 Assets/Components/GameController.cs | 5 +- Assets/Components/Gravitation.cs | 26 ++-- Assets/Components/Merge.cs | 65 ---------- Assets/Components/MergedInfo.cs | 9 -- Assets/Components/Merger.cs | 57 +++++++++ .../{Merge.cs.meta => Merger.cs.meta} | 0 Assets/Components/Particle.cs | 52 ++++++++ Assets/Components/Particle.cs.meta | 11 ++ Assets/Components/ZoomWithScrollWheel.cs | 4 +- .../Prefabs/{Sun.prefab => BlackHole.prefab} | 72 ++++++++--- ...hing.prefab.meta => BlackHole.prefab.meta} | 2 +- Assets/Prefabs/MainCamera.prefab | 7 +- Assets/Prefabs/Nothing.prefab | 32 ----- ...vitation Object.prefab => Particle.prefab} | 71 ++++------- ...bject.prefab.meta => Particle.prefab.meta} | 0 Assets/Prefabs/Sun.prefab.meta | 7 -- Assets/Scenes/Game.unity | 115 +++++++++++++++++- Assets/XR.meta | 8 -- Assets/XR/XRGeneralSettings.asset | 47 ------- Assets/XR/XRGeneralSettings.asset.meta | 8 -- ProjectSettings/InputManager.asset | 2 +- 25 files changed, 382 insertions(+), 276 deletions(-) create mode 100644 Assets/Components/BlackHole.cs rename Assets/Components/{MergedInfo.cs.meta => BlackHole.cs.meta} (83%) rename Assets/Components/{PanWithMMB.cs => CameraPan.cs} (82%) rename Assets/Components/{PanWithMMB.cs.meta => CameraPan.cs.meta} (100%) delete mode 100644 Assets/Components/Merge.cs delete mode 100644 Assets/Components/MergedInfo.cs create mode 100644 Assets/Components/Merger.cs rename Assets/Components/{Merge.cs.meta => Merger.cs.meta} (100%) create mode 100644 Assets/Components/Particle.cs create mode 100644 Assets/Components/Particle.cs.meta rename Assets/Prefabs/{Sun.prefab => BlackHole.prefab} (60%) rename Assets/Prefabs/{Nothing.prefab.meta => BlackHole.prefab.meta} (74%) delete mode 100644 Assets/Prefabs/Nothing.prefab rename Assets/Prefabs/{Gravitation Object.prefab => Particle.prefab} (84%) rename Assets/Prefabs/{Gravitation Object.prefab.meta => Particle.prefab.meta} (100%) delete mode 100644 Assets/Prefabs/Sun.prefab.meta delete mode 100644 Assets/XR.meta delete mode 100644 Assets/XR/XRGeneralSettings.asset delete mode 100644 Assets/XR/XRGeneralSettings.asset.meta diff --git a/Assets/Components/BlackHole.cs b/Assets/Components/BlackHole.cs new file mode 100644 index 0000000..2df6991 --- /dev/null +++ b/Assets/Components/BlackHole.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[RequireComponent(typeof(Rigidbody2D))] +[RequireComponent(typeof(Collider2D))] +public class BlackHole : MonoBehaviour +{ + public float Mass { + get { + return rigidbody.mass; + } + set { + rigidbody.mass = value; + Scale = Mass / Mathf.Pow(Mathf.PI, 2); + } + } + + public float Scale { + get { + return transform.localScale.x; + } + set { + transform.localScale = new Vector3(value, value, 1); + } + } + + protected new Rigidbody2D rigidbody; + + protected void Awake() { + rigidbody = GetComponent(); + } + + protected void Start() { + Mass = 50; + } + + protected void OnTriggerEnter2D(Collider2D other) { + Particle otherParticle = other.GetComponent(); + if(otherParticle != null) { + Mass += otherParticle.Mass; + Destroy(otherParticle.gameObject); + } + } +} diff --git a/Assets/Components/MergedInfo.cs.meta b/Assets/Components/BlackHole.cs.meta similarity index 83% rename from Assets/Components/MergedInfo.cs.meta rename to Assets/Components/BlackHole.cs.meta index 0e700ad..0b20ca6 100644 --- a/Assets/Components/MergedInfo.cs.meta +++ b/Assets/Components/BlackHole.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c9b169f8058046d4fb7374586f318ae6 +guid: 2f86d0ffd697a6046a85ea2885566da9 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Components/PanWithMMB.cs b/Assets/Components/CameraPan.cs similarity index 82% rename from Assets/Components/PanWithMMB.cs rename to Assets/Components/CameraPan.cs index 5f266a3..fdae4fb 100644 --- a/Assets/Components/PanWithMMB.cs +++ b/Assets/Components/CameraPan.cs @@ -3,12 +3,11 @@ using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(Camera))] -public class PanWithMMB : MonoBehaviour +public class CameraPan : MonoBehaviour { - [Header("References")] - protected new Camera camera; + public string axisName; - [Header("Internals")] + protected new Camera camera; protected Vector3? lastMousePosition; private void Start() { @@ -17,9 +16,9 @@ public class PanWithMMB : MonoBehaviour } private void Update() { - bool mmbIsPressed = Input.GetMouseButton(2); + bool panIsPressed = Input.GetAxisRaw(axisName) != 0f; Vector3? currentMousePosition = null; - if(mmbIsPressed) { + if(panIsPressed) { currentMousePosition = camera.ScreenToWorldPoint(Input.mousePosition); if(lastMousePosition.HasValue) { Vector3 positionDelta = lastMousePosition.Value - currentMousePosition.Value; diff --git a/Assets/Components/PanWithMMB.cs.meta b/Assets/Components/CameraPan.cs.meta similarity index 100% rename from Assets/Components/PanWithMMB.cs.meta rename to Assets/Components/CameraPan.cs.meta diff --git a/Assets/Components/GameController.cs b/Assets/Components/GameController.cs index 6a284eb..fb8f6a9 100644 --- a/Assets/Components/GameController.cs +++ b/Assets/Components/GameController.cs @@ -4,6 +4,7 @@ using UnityEngine; public class GameController : MonoBehaviour { - [Header("Global Variables")] - public float gravitationConstant; + public float gravitationConstant = 2; + public int particlesToMerge = 5; + public int scaleMultiplier = 3; } diff --git a/Assets/Components/Gravitation.cs b/Assets/Components/Gravitation.cs index 5b123ea..a33230e 100644 --- a/Assets/Components/Gravitation.cs +++ b/Assets/Components/Gravitation.cs @@ -5,6 +5,9 @@ using UnityEngine; [RequireComponent(typeof(Rigidbody2D))] public class Gravitation : MonoBehaviour { + [Header("Config")] + public bool isStatic; + [Header("Forces")] protected Vector3 appliedForce; @@ -16,17 +19,23 @@ public class Gravitation : MonoBehaviour protected new Rigidbody2D rigidbody; protected GameController gameController; - - protected float mass { + public float Mass { get { return rigidbody.mass; } + } - set { - rigidbody.mass = value; + public float GravitationConstant { + get { + return gameController.gravitationConstant; } } + private void Awake() { + rigidbody = GetComponent(); + gameController = GameObject.Find("GameController").GetComponent(); + } + private void OnEnable() { if(simulatedObjects == null) { simulatedObjects = new List(); @@ -41,8 +50,6 @@ public class Gravitation : MonoBehaviour private void Start() { - rigidbody = GetComponent(); - gameController = GameObject.Find("GameController").GetComponent(); appliedForce = new Vector3(0f, 0f, 0f); } @@ -52,12 +59,11 @@ public class Gravitation : MonoBehaviour foreach(Gravitation other in simulatedObjects) { if(other.positionInList <= this.positionInList) continue; float distance = Vector3.Distance(this.transform.position, other.transform.position); - float force = gameController.gravitationConstant * this.mass * other.mass / Mathf.Pow(distance, 2); + float force = GravitationConstant * this.Mass * other.Mass / Mathf.Pow(distance, 2); Vector3 direction = (other.transform.position - this.transform.position).normalized; - this.appliedForce += direction * force; - other.appliedForce -= direction * force; + if(!this.isStatic) rigidbody.AddForce(direction * force); + if(!other.isStatic) other.rigidbody.AddForce(-direction * force); } - rigidbody.AddForce(appliedForce); appliedForce = new Vector3(0, 0, 0); } } diff --git a/Assets/Components/Merge.cs b/Assets/Components/Merge.cs deleted file mode 100644 index 2a451d1..0000000 --- a/Assets/Components/Merge.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[RequireComponent(typeof(CircleCollider2D))] -public class Merge : MonoBehaviour -{ - [Header("Config")] - public GameObject mergeIntoPrefab; - public bool setMergedMassFromTotal; - - [Header("References")] - protected new CircleCollider2D collider; - - [Header("Internals")] - protected List mergeables; - - private void Start() - { - collider = GetComponent(); - mergeables = new List(); - mergeables.Add(this); - } - - private void OnTriggerEnter2D(Collider2D other) { - Merge otherMerge = other.GetComponent(); - if(otherMerge != null) { - mergeables.Add(otherMerge); - if(CanMerge()) DoMerge(); - } - } - - private void OnTriggerExit2D(Collider2D other) { - Merge otherMerge = other.GetComponent(); - if(otherMerge != null) { - mergeables.Remove(otherMerge); - } - } - - protected bool CanMerge() { - return mergeables.Count >= 5; - } - - protected void DoMerge() { - GameObject mergeResult = Instantiate(mergeIntoPrefab, transform.position, Quaternion.identity); - MergedInfo mergedInfo = mergeResult.AddComponent(); - mergedInfo.mergedCount = mergeables.Count; - - foreach(Merge merged in mergeables.ToArray()) { - Rigidbody2D mergedBody = merged.GetComponentInParent(); - if(mergedBody != null) { - mergedInfo.mergedMass += mergedBody.mass; - } - Destroy(merged.transform.parent.gameObject); - } - - if(setMergedMassFromTotal) { - Rigidbody2D mergeRigidbody = mergeResult.GetComponent(); - if(mergeRigidbody != null) { - mergeRigidbody.useAutoMass = false; - mergeRigidbody.mass = mergedInfo.mergedMass; - } - } - } -} diff --git a/Assets/Components/MergedInfo.cs b/Assets/Components/MergedInfo.cs deleted file mode 100644 index 3d0e39a..0000000 --- a/Assets/Components/MergedInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MergedInfo : MonoBehaviour -{ - public int mergedCount; - public float mergedMass; -} diff --git a/Assets/Components/Merger.cs b/Assets/Components/Merger.cs new file mode 100644 index 0000000..278a9a0 --- /dev/null +++ b/Assets/Components/Merger.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[RequireComponent(typeof(CircleCollider2D))] +public class Merger : MonoBehaviour +{ + public Particle particle; + protected List mergeCandidates; + + protected Collider2D Collider { + get { + return particle.mergeCollider; + } + } + + protected int ParticlesToMerge { + get { + return particle.gameController.particlesToMerge; + } + } + + + protected void Awake() { + particle = GetComponentInParent(); + } + + protected void Start() { + mergeCandidates = new List(); + } + + private void OnTriggerEnter2D(Collider2D other) { + Merger otherMerger = other.GetComponent(); + if(otherMerger == null) return; + Particle otherParticle = otherMerger.particle; + if(this.particle.Tier != otherParticle.Tier) return; + mergeCandidates.Add(otherMerger); + if(CanMerge()) DoMerge(); + } + + private void OnTriggerExit2D(Collider2D other) { + Merger otherMerger = other.GetComponent(); + if(otherMerger == null) return; + mergeCandidates.Remove(otherMerger); + } + + protected bool CanMerge() { + return mergeCandidates.Count >= ParticlesToMerge; + } + + protected void DoMerge() { + particle.Tier += 1; + foreach(Merger merged in mergeCandidates.ToArray()) { + Destroy(merged.particle.gameObject); + } + } +} diff --git a/Assets/Components/Merge.cs.meta b/Assets/Components/Merger.cs.meta similarity index 100% rename from Assets/Components/Merge.cs.meta rename to Assets/Components/Merger.cs.meta diff --git a/Assets/Components/Particle.cs b/Assets/Components/Particle.cs new file mode 100644 index 0000000..517b07e --- /dev/null +++ b/Assets/Components/Particle.cs @@ -0,0 +1,52 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +[RequireComponent(typeof(Rigidbody2D))] +[RequireComponent(typeof(Collider2D))] +[RequireComponent(typeof(Gravitation))] +public class Particle : MonoBehaviour { + protected int _tier = 0; + + public new Rigidbody2D rigidbody; + public Gravitation gravitation; + public GameController gameController; + public Merger merger; + public Collider2D particleCollider; + public Collider2D mergeCollider; + + public int Tier { + get { + return _tier; + } + set { + _tier += 1; + Scale *= gameController.scaleMultiplier; + } + } + + public float Scale { + get { + return transform.localScale.x; + } + set { + transform.localScale = new Vector3(value, value, 1); + } + } + + public float Mass { + get { + return Mathf.Pow(gameController.particlesToMerge, Tier); + } + } + + protected void Awake() { + rigidbody = GetComponent(); + gravitation = GetComponent(); + gameController = GameObject.Find("GameController").GetComponent(); + merger = GetComponentInChildren(); + particleCollider = GetComponent(); + mergeCollider = merger.GetComponent(); + } +} \ No newline at end of file diff --git a/Assets/Components/Particle.cs.meta b/Assets/Components/Particle.cs.meta new file mode 100644 index 0000000..b9abb17 --- /dev/null +++ b/Assets/Components/Particle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 14169e6aef16b684f869320425c986ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Components/ZoomWithScrollWheel.cs b/Assets/Components/ZoomWithScrollWheel.cs index 9aaf1e8..d323581 100644 --- a/Assets/Components/ZoomWithScrollWheel.cs +++ b/Assets/Components/ZoomWithScrollWheel.cs @@ -5,11 +5,9 @@ using UnityEngine; [RequireComponent(typeof(Camera))] public class ZoomWithScrollWheel : MonoBehaviour { - [Header("Config")] public float zoomMultiplier; public string zoomAxisName; - [Header("References")] protected new Camera camera; void Start() @@ -19,7 +17,7 @@ public class ZoomWithScrollWheel : MonoBehaviour void Update() { - float mouseWheel = Input.GetAxis(zoomAxisName); + float mouseWheel = Input.GetAxisRaw(zoomAxisName); if(mouseWheel != 0) { camera.orthographicSize = Mathf.Clamp(camera.orthographicSize - mouseWheel * zoomMultiplier, 0, float.PositiveInfinity); } diff --git a/Assets/Prefabs/Sun.prefab b/Assets/Prefabs/BlackHole.prefab similarity index 60% rename from Assets/Prefabs/Sun.prefab rename to Assets/Prefabs/BlackHole.prefab index faa72b3..3717b1c 100644 --- a/Assets/Prefabs/Sun.prefab +++ b/Assets/Prefabs/BlackHole.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &5508245818244581766 +--- !u!1 &2084275844800580026 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,38 +8,40 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6572685539244401289} - - component: {fileID: 7383058586621682203} - - component: {fileID: 3951280190561447455} - - component: {fileID: 5758426961102176851} + - component: {fileID: 2084275844800580021} + - component: {fileID: 2084275844800580022} + - component: {fileID: 2084275844800580024} + - component: {fileID: 2084275844800580023} + - component: {fileID: 2084275844800580025} + - component: {fileID: 3271020097140099258} m_Layer: 0 - m_Name: Sun + m_Name: Protostar m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &6572685539244401289 +--- !u!4 &2084275844800580021 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5508245818244581766} + m_GameObject: {fileID: 2084275844800580026} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.31, y: -0.09, z: 0} - m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &7383058586621682203 +--- !u!212 &2084275844800580022 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5508245818244581766} + m_GameObject: {fileID: 2084275844800580026} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -73,7 +75,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: d8cf31929ca287542bdc219ec19f002e, type: 3} - m_Color: {r: 1, g: 1, b: 0, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 0.15686275} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -83,19 +85,19 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!50 &3951280190561447455 +--- !u!50 &2084275844800580024 Rigidbody2D: serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5508245818244581766} + m_GameObject: {fileID: 2084275844800580026} m_BodyType: 0 m_Simulated: 1 m_UseFullKinematicContacts: 0 - m_UseAutoMass: 1 - m_Mass: 5 + m_UseAutoMass: 0 + m_Mass: 10 m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 0 @@ -104,19 +106,49 @@ Rigidbody2D: m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 ---- !u!58 &5758426961102176851 +--- !u!58 &2084275844800580023 CircleCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5508245818244581766} + m_GameObject: {fileID: 2084275844800580026} m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 0 + m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} serializedVersion: 2 m_Radius: 0.5 +--- !u!114 &2084275844800580025 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2084275844800580026} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d16f17bda197c324f8b088f106c66c5c, type: 3} + m_Name: + m_EditorClassIdentifier: + isStatic: 1 + positionInList: 0 +--- !u!114 &3271020097140099258 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2084275844800580026} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2f86d0ffd697a6046a85ea2885566da9, type: 3} + m_Name: + m_EditorClassIdentifier: + absorbedParticles: 0 + absorbedMass: 0 + scaleOnMass: 1 + syncMass: 1 diff --git a/Assets/Prefabs/Nothing.prefab.meta b/Assets/Prefabs/BlackHole.prefab.meta similarity index 74% rename from Assets/Prefabs/Nothing.prefab.meta rename to Assets/Prefabs/BlackHole.prefab.meta index 747ca20..2479401 100644 --- a/Assets/Prefabs/Nothing.prefab.meta +++ b/Assets/Prefabs/BlackHole.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d810808c92b542d418721ca53dca1fee +guid: d2ff0823532914e4a8f5ecd0efc2a146 PrefabImporter: externalObjects: {} userData: diff --git a/Assets/Prefabs/MainCamera.prefab b/Assets/Prefabs/MainCamera.prefab index 25616a1..0caaa09 100644 --- a/Assets/Prefabs/MainCamera.prefab +++ b/Assets/Prefabs/MainCamera.prefab @@ -98,7 +98,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6c6157b8c0c98584db4becc892a8f6fd, type: 3} m_Name: m_EditorClassIdentifier: - prefab: {fileID: 5473375028011702754, guid: e73d8e05bd7498c4a80a63094f4594a8, type: 3} + prefabToSpawn: {fileID: 5473375028011702754, guid: e73d8e05bd7498c4a80a63094f4594a8, + type: 3} + mouseButton: 0 --- !u!114 &1504932583 MonoBehaviour: m_ObjectHideFlags: 0 @@ -111,7 +113,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 45a8a9da7e5b8734eb709105fd6e30e1, type: 3} m_Name: m_EditorClassIdentifier: - zoomMultiplier: 1 + zoomMultiplier: 3 zoomAxisName: MouseWheel --- !u!114 &1504932587 MonoBehaviour: @@ -125,3 +127,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: faf7dfc2fa2059f4a96e4a134b4ef2ab, type: 3} m_Name: m_EditorClassIdentifier: + axisName: MouseLeft diff --git a/Assets/Prefabs/Nothing.prefab b/Assets/Prefabs/Nothing.prefab deleted file mode 100644 index 4e64710..0000000 --- a/Assets/Prefabs/Nothing.prefab +++ /dev/null @@ -1,32 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &6786529680537240613 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7085311716076432966} - m_Layer: 0 - m_Name: Nothing - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7085311716076432966 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6786529680537240613} - 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_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Prefabs/Gravitation Object.prefab b/Assets/Prefabs/Particle.prefab similarity index 84% rename from Assets/Prefabs/Gravitation Object.prefab rename to Assets/Prefabs/Particle.prefab index 4e81eae..9306d85 100644 --- a/Assets/Prefabs/Gravitation Object.prefab +++ b/Assets/Prefabs/Particle.prefab @@ -9,13 +9,13 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5473375028011702783} + - component: {fileID: 1061936008197383768} - component: {fileID: 5473375028011702782} - component: {fileID: 5473375028011702753} - component: {fileID: 5473375028011702752} - component: {fileID: 5473375028011702755} - - component: {fileID: 5319285082587561044} m_Layer: 0 - m_Name: Gravitation Object + m_Name: Particle m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -29,13 +29,31 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5473375028011702754} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2, y: 0.88, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 851405983337701308} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1061936008197383768 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5473375028011702754} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 14169e6aef16b684f869320425c986ab, type: 3} + m_Name: + m_EditorClassIdentifier: + rigidbody: {fileID: 0} + gravitation: {fileID: 0} + gameController: {fileID: 0} + merger: {fileID: 0} + particleCollider: {fileID: 0} + mergeCollider: {fileID: 0} --- !u!50 &5473375028011702782 Rigidbody2D: serializedVersion: 4 @@ -135,49 +153,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d16f17bda197c324f8b088f106c66c5c, type: 3} m_Name: m_EditorClassIdentifier: + isStatic: 0 positionInList: 0 ---- !u!114 &5319285082587561044 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5473375028011702754} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8cb7610d172100841907b194dece1565, type: 3} - m_Name: - m_EditorClassIdentifier: - disappearAfter: 5 - colorCurve: - serializedVersion: 2 - key0: {r: 1, g: 0, b: 0, a: 0} - key1: {r: 1, g: 1, b: 1, a: 1} - key2: {r: 1, g: 0.82856506, b: 0.82856506, 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: 21203 - 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_NumColorKeys: 2 - m_NumAlphaKeys: 2 --- !u!1 &8635663089806839545 GameObject: m_ObjectHideFlags: 0 @@ -238,6 +215,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1010c8363cc1ebd4e9c1808f9a2737e2, type: 3} m_Name: m_EditorClassIdentifier: - mergeIntoPrefab: {fileID: 5508245818244581766, guid: 81be647bed73a164cb47269e43863cac, - type: 3} - setMergedMassFromTotal: 1 + particle: {fileID: 0} diff --git a/Assets/Prefabs/Gravitation Object.prefab.meta b/Assets/Prefabs/Particle.prefab.meta similarity index 100% rename from Assets/Prefabs/Gravitation Object.prefab.meta rename to Assets/Prefabs/Particle.prefab.meta diff --git a/Assets/Prefabs/Sun.prefab.meta b/Assets/Prefabs/Sun.prefab.meta deleted file mode 100644 index 156bf7d..0000000 --- a/Assets/Prefabs/Sun.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 81be647bed73a164cb47269e43863cac -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index 8c93692..baabcc2 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -121,6 +121,105 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &769317669 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2084275844800580026, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_Name + value: BlackHole + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalScale.x + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580021, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_LocalScale.y + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580024, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_Mass + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 2084275844800580023, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: m_Radius + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3271020097140099258, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: absorbedParticles + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 3271020097140099258, guid: d2ff0823532914e4a8f5ecd0efc2a146, + type: 3} + propertyPath: absorbedMass + value: 7 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d2ff0823532914e4a8f5ecd0efc2a146, type: 3} --- !u!1001 &1803533283597936005 PrefabInstance: m_ObjectHideFlags: 0 @@ -188,6 +287,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4937878819460165300, guid: bf08d766b6e86cf4a8773489143ab2d5, + type: 3} + propertyPath: gravitationConstant + value: 2 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: bf08d766b6e86cf4a8773489143ab2d5, type: 3} --- !u!1001 &9221969453494073200 @@ -240,7 +344,7 @@ PrefabInstance: - target: {fileID: 9221969453073420272, guid: 6baf9ec6ad712d940a83a3bf6ae3e6b1, type: 3} propertyPath: m_RootOrder - value: 1 + value: 2 objectReference: {fileID: 0} - target: {fileID: 9221969453073420272, guid: 6baf9ec6ad712d940a83a3bf6ae3e6b1, type: 3} @@ -257,10 +361,9 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 1504932582, guid: 6baf9ec6ad712d940a83a3bf6ae3e6b1, type: 3} - propertyPath: prefabToSpawn - value: - objectReference: {fileID: 5473375028011702754, guid: e73d8e05bd7498c4a80a63094f4594a8, - type: 3} + - target: {fileID: 1504932587, guid: 6baf9ec6ad712d940a83a3bf6ae3e6b1, type: 3} + propertyPath: axisName + value: MouseMiddle + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6baf9ec6ad712d940a83a3bf6ae3e6b1, type: 3} diff --git a/Assets/XR.meta b/Assets/XR.meta deleted file mode 100644 index 170fd5a..0000000 --- a/Assets/XR.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dcd4e7f566b6b1f49964b0b51c681ac6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/XR/XRGeneralSettings.asset b/Assets/XR/XRGeneralSettings.asset deleted file mode 100644 index 508c0a8..0000000 --- a/Assets/XR/XRGeneralSettings.asset +++ /dev/null @@ -1,47 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !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: d2dc886499c26824283350fa532d087d, type: 3} - m_Name: XRGeneralSettings - m_EditorClassIdentifier: - Keys: 01000000 - Values: - - {fileID: 8859528010114943273} ---- !u!114 &7854906144317399671 -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: f4c3631f5e58749a59194e0cf6baf6d5, type: 3} - m_Name: Standalone Loaders - m_EditorClassIdentifier: - m_RequiresSettingsUpdate: 0 - m_AutomaticLoading: 0 - m_AutomaticRunning: 0 - m_Loaders: [] ---- !u!114 &8859528010114943273 -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: d236b7d11115f2143951f1e14045df39, type: 3} - m_Name: Standalone Settings - m_EditorClassIdentifier: - m_LoaderManagerInstance: {fileID: 7854906144317399671} - m_InitManagerOnStart: 1 diff --git a/Assets/XR/XRGeneralSettings.asset.meta b/Assets/XR/XRGeneralSettings.asset.meta deleted file mode 100644 index f26724b..0000000 --- a/Assets/XR/XRGeneralSettings.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7c8c2f042ca8bcf468405a9dff7f1571 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 4023b39..6fcb347 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -92,7 +92,7 @@ InputManager: negativeButton: positiveButton: mouse 2 altNegativeButton: - altPositiveButton: w + altPositiveButton: space gravity: 0 dead: 0 sensitivity: 0.1