Something went wrong. Try again.
A unity based gravity simulation thing inspired by interplanetary (the game)
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960using Rendering;using Unity.Entities;using UnityEngine;
public class RenderPropsGUI : MonoBehaviour{ private float _pointSize = 0.5f; private float _smoothA = 1f; private float _smoothB = 1f; private float _G = 1f; private SystemHandle sys; void Start() { sys = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<RenderGravityFieldSystem>(); }
void Update() { var p = World.DefaultGameObjectInjectionWorld.EntityManager.GetComponentData<RenderGravityFieldSystem.Params>(sys); p.PointSize = _pointSize; p.SmoothA = _smoothA; p.SmoothB = _smoothB; p.G = _G; World.DefaultGameObjectInjectionWorld.EntityManager.SetComponentData(sys, p); }
void OnGUI() { GUILayout.BeginArea (new Rect (0,0,200,100), new GUIStyle { normal = new GUIStyleState{ background = Texture2D.grayTexture }, }); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("G Constant", GUILayout.Width(80)); _G = GUILayout.HorizontalSlider(_G, 0.1f, 10f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Point Size", GUILayout.Width(80)); _pointSize = GUILayout.HorizontalSlider(_pointSize, 0, 1); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Smooth A", GUILayout.Width(80)); _smoothA = GUILayout.HorizontalSlider(_smoothA, 0, 1); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Smooth B", GUILayout.Width(80)); _smoothB = GUILayout.HorizontalSlider(_smoothB, 0, 1); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); }}