init
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b47a45649f44855b50d7efd8637fd23
|
||||
timeCreated: 1768928367
|
||||
@@ -0,0 +1,59 @@
|
||||
using RPGCore.Movement.ObjectModules.UnitMovement;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace RPGCore.Movement.Editor.Drawers
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(UnitMovementModule))]
|
||||
public class UnitMovementModuleDrawer : PropertyDrawer
|
||||
{
|
||||
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
||||
{
|
||||
var root = new VisualElement();
|
||||
|
||||
if (Application.isPlaying) root.Add(CreateDebugBox(property));
|
||||
root.Add(new PropertyField(property));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private HelpBox CreateDebugBox(SerializedProperty property)
|
||||
{
|
||||
var debugBox = new HelpBox();
|
||||
debugBox.style.flexDirection = FlexDirection.Column;
|
||||
debugBox.style.alignItems = Align.Stretch;
|
||||
debugBox.SetEnabled(false);
|
||||
|
||||
debugBox.Add(new Label("RUNTIME DEBUG:"));
|
||||
|
||||
var groundSteepnessField = new FloatField(nameof(UnitMovementModule.groundSteepness));
|
||||
debugBox.Add(groundSteepnessField);
|
||||
var isOnGroundField = new Toggle(nameof(UnitMovementModule.isOnGround));
|
||||
debugBox.Add(isOnGroundField);
|
||||
var rotateYawField = new FloatField(nameof(UnitMovementModule.rotateYaw));
|
||||
debugBox.Add(rotateYawField);
|
||||
var moveVectorField = new Vector3Field(nameof(UnitMovementModule.accelerationVector));
|
||||
debugBox.Add(moveVectorField);
|
||||
var linearVelocityField = new Vector3Field(nameof(Rigidbody.linearVelocity));
|
||||
debugBox.Add(linearVelocityField);
|
||||
var linearVelocityMagnitudeField = new FloatField(nameof(Rigidbody.linearVelocity.magnitude));
|
||||
debugBox.Add(linearVelocityMagnitudeField);
|
||||
|
||||
|
||||
debugBox.schedule.Execute(() =>
|
||||
{
|
||||
var module = property.boxedValue as UnitMovementModule;
|
||||
groundSteepnessField.value = module.groundSteepness;
|
||||
isOnGroundField.value = module.isOnGround;
|
||||
rotateYawField.value = module.rotateYaw;
|
||||
moveVectorField.value = module.accelerationVector;
|
||||
linearVelocityField.value = module.parent.rigidbody.linearVelocity;
|
||||
linearVelocityMagnitudeField.value = module.parent.rigidbody.linearVelocity.magnitude;
|
||||
}).Every(100);
|
||||
|
||||
return debugBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3acb507069ca47ceb32fc3b5be9da459
|
||||
timeCreated: 1768928385
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "RPGCore.Movement.Editor",
|
||||
"rootNamespace": "RPGCore.Movement.Editor",
|
||||
"references": [
|
||||
"RPGCore",
|
||||
"RPGCore.Editor",
|
||||
"RPGCore.Movement",
|
||||
"RPGCoreCommon.Helpers"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 162316575de365d43817366fcbce56bf
|
||||
timeCreated: 1772973849
|
||||
Reference in New Issue
Block a user