net.dreditor.trackphrase 0.0.0-stage → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "DREditor.TrackPhrase",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Cinemachine",
6
+ "DREditor.Editor",
7
+ "DREditor",
8
+ "DREditor.Minigames",
9
+ "DREditor.Minigames.Debates"
10
+ ],
11
+ "includePlatforms": [],
12
+ "excludePlatforms": [],
13
+ "allowUnsafeCode": false,
14
+ "overrideReferences": false,
15
+ "precompiledReferences": [],
16
+ "autoReferenced": true,
17
+ "defineConstraints": [],
18
+ "versionDefines": [
19
+ {
20
+ "name": "com.unity.cinemachine",
21
+ "expression": "0.0.0",
22
+ "define": "CINEMACHINE"
23
+ }
24
+ ],
25
+ "noEngineReferences": false
26
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 65cd61a13104ad144a92c903a5997d69
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,165 @@
1
+ //Editing Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if CINEMACHINE
3
+ using Cinemachine;
4
+ using UnityEngine;
5
+ using UnityEngine.Serialization;
6
+ using static Cinemachine.CinemachineDollyCart;
7
+
8
+ namespace DREditor.TrackPhrase
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader("")]
14
+ [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
15
+ #if UNITY_2018_3_OR_NEWER
16
+ [ExecuteAlways]
17
+ #else
18
+ [ExecuteInEditMode]
19
+ #endif
20
+ [DisallowMultipleComponent]
21
+ public class DollyCartNSD : MonoBehaviour
22
+ {
23
+ /// <summary></summary>
24
+ [Tooltip("")]
25
+ [SerializeField] protected CinemachinePathBase m_Path;
26
+
27
+ /// <summary></summary>
28
+ [Tooltip("")]
29
+ [SerializeField] protected UpdateMethod m_UpdateMethod = UpdateMethod.Update;
30
+
31
+ /// <summary></summary>
32
+ [Tooltip("")]
33
+ [SerializeField] protected CinemachinePathBase.PositionUnits m_PositionUnits = CinemachinePathBase.PositionUnits.Distance;
34
+
35
+ /// <summary></summary>
36
+ [Tooltip("")]
37
+ [FormerlySerializedAs("m_Velocity")]
38
+ [SerializeField] protected float m_Speed;
39
+
40
+ /// <summary></summary>
41
+ [Tooltip("")]
42
+ [FormerlySerializedAs("m_CurrentDistance")]
43
+ [SerializeField] protected float m_Position;
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ [Tooltip("")]
49
+ [SerializeField] protected bool useCurve = false;
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ [Tooltip("")]
55
+ [SerializeField] protected bool reset = false;
56
+
57
+ /// <summary>
58
+ ///
59
+ /// </summary>
60
+ [Tooltip("")]
61
+ [SerializeField] protected AnimationCurve curve = new(new Keyframe[]
62
+ {
63
+ new(0,0), new(1, 1)
64
+ });
65
+
66
+
67
+ /// <summary>
68
+ ///
69
+ /// </summary>
70
+ /// <param name="m_Path"></param>
71
+ public virtual void SetPath(CinemachinePathBase m_Path) => this.m_Path = m_Path;
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ /// <param name="m_Speed"></param>
77
+ public virtual void SetSpeed(float m_Speed) => this.m_Speed = m_Speed;
78
+
79
+ /// <summary>
80
+ ///
81
+ /// </summary>
82
+ /// <param name="m_Position"></param>
83
+ public virtual void SetPosition(float m_Position) => this.m_Position = m_Position;
84
+
85
+ /// <summary>
86
+ ///
87
+ /// </summary>
88
+ /// <param name="m_PositionUnits"></param>
89
+ public virtual void SetPositionUnits(CinemachinePathBase.PositionUnits m_PositionUnits)
90
+ => this.m_PositionUnits = m_PositionUnits;
91
+
92
+ /// <summary>
93
+ ///
94
+ /// </summary>
95
+ /// <param name="useCurve"></param>
96
+ public virtual void SetUseCurve(bool useCurve) => this.useCurve = useCurve;
97
+
98
+ /// <summary>
99
+ ///
100
+ /// </summary>
101
+ /// <param name="curve"></param>
102
+ public virtual void SetCurve(AnimationCurve curve) => this.curve = curve;
103
+
104
+
105
+ /// <summary>
106
+ ///
107
+ /// </summary>
108
+ protected virtual void FixedUpdate()
109
+ {
110
+ if (m_UpdateMethod == UpdateMethod.FixedUpdate)
111
+ SetCartPosition(m_Position + m_Speed * Time.deltaTime);
112
+ }
113
+
114
+ /// <summary>
115
+ ///
116
+ /// </summary>
117
+ /// <remarks></remarks>
118
+ protected virtual void Update()
119
+ {
120
+ if (reset)
121
+ {
122
+ m_Position = useCurve ? 0.1f : 0;
123
+
124
+ reset = false;
125
+
126
+ return;
127
+ }
128
+
129
+ float speed = Application.isPlaying ? m_Speed : 0;
130
+
131
+ if (useCurve)
132
+ speed = curve.Evaluate(m_Position);
133
+
134
+ if (m_UpdateMethod == UpdateMethod.Update)
135
+ SetCartPosition(m_Position + speed * Time.deltaTime);
136
+ }
137
+
138
+ /// <summary>
139
+ ///
140
+ /// </summary>
141
+ protected virtual void LateUpdate()
142
+ {
143
+ if (!Application.isPlaying)
144
+ SetCartPosition(m_Position);
145
+ else if (m_UpdateMethod == UpdateMethod.LateUpdate)
146
+ SetCartPosition(m_Position + m_Speed * Time.deltaTime);
147
+ }
148
+
149
+ /// <summary>
150
+ ///
151
+ /// </summary>
152
+ /// <param name="distanceAlongPath"></param>
153
+ protected virtual void SetCartPosition(float distanceAlongPath)
154
+ {
155
+ if (m_Path != null)
156
+ {
157
+ m_Position = m_Path.StandardizeUnit(distanceAlongPath, m_PositionUnits);
158
+
159
+ transform.SetPositionAndRotation(m_Path.EvaluatePositionAtUnit(m_Position, m_PositionUnits),
160
+ m_Path.EvaluateOrientationAtUnit(m_Position, m_PositionUnits));
161
+ }
162
+ }
163
+ }
164
+ }
165
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 5a079ac016565894483fbba7e43665f7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/PhraseShake.cs ADDED
@@ -0,0 +1,103 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if CINEMACHINE
3
+ #if DOTWEEN
4
+ using DG.Tweening;
5
+ #endif
6
+ using DREditor.Minigames.Debates;
7
+ using DREditor.Processables;
8
+ using UnityEngine;
9
+
10
+ namespace DREditor.TrackPhrase
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ [RequireComponent(typeof(PhraseTrack))]
16
+ [ClassHeader(nameof(IPhraseHitListener) + ", " + nameof(IPhraseResetter) + ", " + nameof(IPrioritizable) +
17
+ "\n\n")]
18
+ public class PhraseShake : MonoBehaviour, IPhraseHitListener, IPrioritizable
19
+ {
20
+ /// <summary>
21
+ ///
22
+ /// </summary>
23
+ [Tooltip("")]
24
+ [SerializeField] protected int priority = 2;
25
+
26
+
27
+ public int Priority { get => priority; set => priority = value; }
28
+
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ [Header("")]
34
+ [Divider]
35
+ [Tooltip("")]
36
+ [SerializeField] protected float duration = 0.5f;
37
+
38
+ /// <summary>
39
+ ///
40
+ /// </summary>
41
+ [Tooltip("")]
42
+ [SerializeField] protected float strength = 0.25f;
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ [Tooltip("")]
48
+ [SerializeField] protected float randomness = 45;
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ [Tooltip("")]
54
+ [SerializeField] protected int vibrato = 20;
55
+
56
+ /// <summary>
57
+ ///
58
+ /// </summary>
59
+ [Tooltip("")]
60
+ [SerializeField] protected bool fadeOut = true;
61
+
62
+ /// <summary>
63
+ ///
64
+ /// </summary>
65
+ [Tooltip("")]
66
+ [SerializeField] protected bool snapping = false;
67
+
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ protected PhraseTrack track;
73
+
74
+
75
+ protected virtual void Awake() => track = GetComponent<PhraseTrack>();
76
+
77
+
78
+ /// <inheritdoc/>
79
+ public virtual void OnHit() => Shake();
80
+
81
+ /// <summary>
82
+ ///
83
+ /// </summary>
84
+ protected virtual void Shake()
85
+ {
86
+ #if DOTWEEN
87
+ if (track != null && track.IsUsingTrack())
88
+ transform.DOShakePosition(duration, strength, vibrato, randomness, snapping, fadeOut);
89
+ else
90
+ transform.parent.DOShakePosition(duration, strength, vibrato, randomness, snapping, fadeOut);
91
+ #endif
92
+ }
93
+
94
+ #if DOTWEEN
95
+ /// <inheritdoc/>
96
+ public virtual void Reset() => transform.DOKill();
97
+ #else
98
+ /// <inheritdoc/>
99
+ public virtual void Reset() { }
100
+ #endif
101
+ }
102
+ }
103
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 194efdf2422823844bf93b93bfab659d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/PhraseTrack.cs ADDED
@@ -0,0 +1,185 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if CINEMACHINE
3
+ using Cinemachine;
4
+ using DREditor.Cameras;
5
+ using DREditor.Minigames.Debates;
6
+ using DREditor.Processables;
7
+ using UnityEngine;
8
+
9
+ namespace DREditor.TrackPhrase
10
+ {
11
+ /// <summary>
12
+ ///
13
+ /// </summary>
14
+ [ClassHeader(nameof(IPhraseHandlerComponent) + ", " + nameof(IPhraseShatterListener) + ", " + nameof(IPhraseResetter) +
15
+ ", " + nameof(IPrioritizable) +
16
+ "\n\n")]
17
+ public class PhraseTrack : MonoBehaviour, IPhraseHandlerComponent, IPhraseShatterListener, IPhraseResetter, IPrioritizable
18
+ {
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ [Tooltip("")]
23
+ [SerializeField] protected int priority = 1;
24
+
25
+
26
+ public int Priority { get => priority; set => priority = value; }
27
+
28
+
29
+ /// <summary>
30
+ ///
31
+ /// </summary>
32
+ protected TrackPath trackPath;
33
+
34
+ /// <summary>
35
+ ///
36
+ /// </summary>
37
+ protected DollyCartNSD cart;
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ protected CinemachinePath path;
43
+
44
+ /// <summary>
45
+ ///
46
+ /// </summary>
47
+ protected bool usingTrack = false;
48
+
49
+ /// <summary>
50
+ ///
51
+ /// </summary>
52
+ protected GameObject pathRef;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ protected Transform cameraTransform;
58
+
59
+
60
+ protected virtual void Awake() => cameraTransform = FindAnyObjectByType<DRTrialCamera>().transform;
61
+
62
+
63
+ /// <inheritdoc/>
64
+ public virtual void StartPhrase<T>(T phrase) where T : PhraseBase
65
+ {
66
+ foreach (var animation in phrase.animations)
67
+ if (animation is TrackPath trackPath)
68
+ this.trackPath = trackPath;
69
+
70
+ if (trackPath != null && trackPath.Points.Length > 0)
71
+ StartAnimation();
72
+ }
73
+
74
+ /// <summary>
75
+ ///
76
+ /// </summary>
77
+ protected virtual void StartAnimation()
78
+ {
79
+ InitializeCart();
80
+
81
+ InitializePath();
82
+
83
+ PlayCart();
84
+ }
85
+
86
+ /// <summary>
87
+ ///
88
+ /// </summary>
89
+ protected virtual void InitializeCart()
90
+ {
91
+ GameObject parent = transform.parent.gameObject;
92
+
93
+ if (parent.TryGetComponent<DollyCartNSD>(out var cart))
94
+ {
95
+ this.cart = cart;
96
+
97
+ cart.SetPath(null);
98
+
99
+ cart.SetSpeed(0);
100
+
101
+ cart.SetPosition(0);
102
+ }
103
+ else
104
+ this.cart = parent.AddComponent<DollyCartNSD>();
105
+ }
106
+
107
+ /// <summary>
108
+ ///
109
+ /// </summary>
110
+ protected virtual void InitializePath()
111
+ {
112
+ pathRef = new GameObject();
113
+
114
+ GameObject ch = new();
115
+
116
+ ch.transform.parent = pathRef.transform;
117
+
118
+ path = ch.AddComponent<CinemachinePath>();
119
+
120
+ path.gameObject.transform.localPosition = trackPath.Position;
121
+
122
+ Vector4 rot = trackPath.Rotation;
123
+
124
+ path.gameObject.transform.localEulerAngles = new(rot.x, rot.y, rot.z);
125
+
126
+ pathRef.transform.SetPositionAndRotation(new(0, cameraTransform.position.y, 0),
127
+ new Quaternion(0, cameraTransform.rotation.y, 0, cameraTransform.rotation.w));
128
+
129
+ transform.localPosition = new(0, -1, 0);
130
+ }
131
+
132
+ /// <summary>
133
+ ///
134
+ /// </summary>
135
+ protected virtual void PlayCart()
136
+ {
137
+ cart.SetPosition(0);
138
+
139
+ cart.SetPositionUnits(CinemachinePathBase.PositionUnits.Normalized);
140
+
141
+ cart.SetCurve(trackPath.SpeedCurve);
142
+
143
+ cart.SetUseCurve(true);
144
+
145
+ path.m_Waypoints = trackPath.Points;
146
+
147
+ cart.SetPath(path);
148
+
149
+ cart.SetSpeed(1);
150
+
151
+ cart.enabled = true;
152
+
153
+ usingTrack = true;
154
+ }
155
+
156
+ /// <summary>
157
+ ///
158
+ /// </summary>
159
+ /// <returns></returns>
160
+ public virtual bool IsUsingTrack() => usingTrack;
161
+
162
+
163
+ /// <inheritdoc/>
164
+ public virtual void OnShattered()
165
+ {
166
+ if (usingTrack)
167
+ transform.parent.gameObject.GetComponent<DollyCartNSD>().enabled = false;
168
+ }
169
+
170
+ /// <inheritdoc/>
171
+ public virtual void Reset()
172
+ {
173
+ if (transform.parent.gameObject.TryGetComponent<DollyCartNSD>(out var cart))
174
+ Destroy(cart);
175
+
176
+ if (pathRef != null)
177
+ Destroy(pathRef);
178
+
179
+ trackPath = null;
180
+
181
+ usingTrack = false;
182
+ }
183
+ }
184
+ }
185
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 3e2c7f3f41b90154187a1c6dbc13bbcc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,94 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!1 &907238091587208738
4
+ GameObject:
5
+ m_ObjectHideFlags: 0
6
+ m_CorrespondingSourceObject: {fileID: 0}
7
+ m_PrefabInstance: {fileID: 0}
8
+ m_PrefabAsset: {fileID: 0}
9
+ serializedVersion: 6
10
+ m_Component:
11
+ - component: {fileID: 7942543658575344102}
12
+ m_Layer: 0
13
+ m_Name: Track_Parent
14
+ m_TagString: Untagged
15
+ m_Icon: {fileID: 0}
16
+ m_NavMeshLayer: 0
17
+ m_StaticEditorFlags: 0
18
+ m_IsActive: 1
19
+ --- !u!4 &7942543658575344102
20
+ Transform:
21
+ m_ObjectHideFlags: 0
22
+ m_CorrespondingSourceObject: {fileID: 0}
23
+ m_PrefabInstance: {fileID: 0}
24
+ m_PrefabAsset: {fileID: 0}
25
+ m_GameObject: {fileID: 907238091587208738}
26
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
27
+ m_LocalPosition: {x: 0, y: 7.83, z: 0}
28
+ m_LocalScale: {x: 1, y: 1, z: 1}
29
+ m_ConstrainProportionsScale: 0
30
+ m_Children:
31
+ - {fileID: 871339856408963998}
32
+ m_Father: {fileID: 0}
33
+ m_RootOrder: 0
34
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35
+ --- !u!1 &8289200428657646794
36
+ GameObject:
37
+ m_ObjectHideFlags: 0
38
+ m_CorrespondingSourceObject: {fileID: 0}
39
+ m_PrefabInstance: {fileID: 0}
40
+ m_PrefabAsset: {fileID: 0}
41
+ serializedVersion: 6
42
+ m_Component:
43
+ - component: {fileID: 871339856408963998}
44
+ - component: {fileID: 2407333302034471369}
45
+ m_Layer: 0
46
+ m_Name: Path
47
+ m_TagString: Untagged
48
+ m_Icon: {fileID: 0}
49
+ m_NavMeshLayer: 0
50
+ m_StaticEditorFlags: 0
51
+ m_IsActive: 1
52
+ --- !u!4 &871339856408963998
53
+ Transform:
54
+ m_ObjectHideFlags: 0
55
+ m_CorrespondingSourceObject: {fileID: 0}
56
+ m_PrefabInstance: {fileID: 0}
57
+ m_PrefabAsset: {fileID: 0}
58
+ m_GameObject: {fileID: 8289200428657646794}
59
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
60
+ m_LocalPosition: {x: 0, y: 0, z: 9}
61
+ m_LocalScale: {x: 1, y: 1, z: 1}
62
+ m_ConstrainProportionsScale: 0
63
+ m_Children: []
64
+ m_Father: {fileID: 7942543658575344102}
65
+ m_RootOrder: 0
66
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
67
+ --- !u!114 &2407333302034471369
68
+ MonoBehaviour:
69
+ m_ObjectHideFlags: 0
70
+ m_CorrespondingSourceObject: {fileID: 0}
71
+ m_PrefabInstance: {fileID: 0}
72
+ m_PrefabAsset: {fileID: 0}
73
+ m_GameObject: {fileID: 8289200428657646794}
74
+ m_Enabled: 1
75
+ m_EditorHideFlags: 0
76
+ m_Script: {fileID: 11500000, guid: 2d37e5385efd7064cb1d54c94960acae, type: 3}
77
+ m_Name:
78
+ m_EditorClassIdentifier:
79
+ m_Resolution: 20
80
+ m_Appearance:
81
+ pathColor: {r: 0, g: 1, b: 0, a: 1}
82
+ inactivePathColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
83
+ width: 0.2
84
+ m_Looped: 0
85
+ m_Waypoints:
86
+ - position: {x: 0, y: 0, z: 0}
87
+ tangent: {x: 0, y: 0, z: 0}
88
+ roll: 0
89
+ - position: {x: 0, y: 0, z: 0}
90
+ tangent: {x: 0, y: 0, z: 0}
91
+ roll: 0
92
+ - position: {x: 0, y: 0, z: 0}
93
+ tangent: {x: 0, y: 0, z: 0}
94
+ roll: 0
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 733530f3d40d8944aadad51b883ab1d9
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,101 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if UNITY_EDITOR && CINEMACHINE
3
+ using Cinemachine;
4
+ using DREditor.Editor.Utility;
5
+ using UnityEditor;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.TrackPhrase
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [CustomClassEditor(typeof(TrackPath))]
14
+ public class TrackAnimationEditor : ClassEditorTypeBase<TrackPath>
15
+ {
16
+ /// <inheritdoc/>
17
+ protected override void OnInspectorGUI() => PhraseTrack();
18
+
19
+ /// <summary>
20
+ ///
21
+ /// </summary>
22
+ protected virtual void PhraseTrack()
23
+ {
24
+ target.Position = HandyFields.Vector3Field("Track Position: ", target.Position, 200, 7);
25
+
26
+ target.Rotation = HandyFields.Vector4Field("Track Angle: ", target.Rotation, 200, 7);
27
+
28
+ DisplayTrackSpeed();
29
+
30
+ GUILayout.Space(25);
31
+ }
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ protected virtual void DisplayTrackSpeed()
37
+ {
38
+ using (new GUILayout.HorizontalScope())
39
+ {
40
+ ImportPathSelection();
41
+
42
+ DisplayClearWaypointsButton();
43
+
44
+ target.SpeedCurve = EditorGUILayout.CurveField(target.SpeedCurve);
45
+
46
+ DisplayResetCurveButton();
47
+ }
48
+ }
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ protected virtual void ImportPathSelection()
54
+ {
55
+ if (GUILayout.Button("Import Selection", GUILayout.Width(130)))
56
+ {
57
+ CinemachinePath.Waypoint[] points = Selection.gameObjects[0].GetComponent<CinemachinePath>().m_Waypoints;
58
+
59
+ if (points != null && points.Length > 0)
60
+ target.Points = points;
61
+ else
62
+ UnityEngine.Debug.Log("You need to select a Path in the hierarchy!");
63
+ }
64
+ }
65
+
66
+ /// <summary>
67
+ ///
68
+ /// </summary>
69
+ protected virtual void DisplayClearWaypointsButton()
70
+ {
71
+ if (GUILayout.Button("Clear Waypoints", GUILayout.Width(130)))
72
+ target.Points = null;
73
+
74
+ if (target.SpeedCurve == null)
75
+ ResetTrackCurve();
76
+ }
77
+
78
+ /// <summary>
79
+ ///
80
+ /// </summary>
81
+ protected virtual void DisplayResetCurveButton()
82
+ {
83
+ if (GUILayout.Button("Reset Curve", GUILayout.Width(100)) &&
84
+ EditorUtility.DisplayDialog("Reset Curve", "Are you sure you want to Reset this Curve?",
85
+ "Yes", "No"))
86
+ ResetTrackCurve();
87
+ }
88
+
89
+ /// <summary>
90
+ ///
91
+ /// </summary>
92
+ protected virtual void ResetTrackCurve()
93
+ {
94
+ target.SpeedCurve = new AnimationCurve()
95
+ {
96
+ keys = new Keyframe[] { new(0, 1), new(0.5f, 0.09f), new(1, 1) }
97
+ };
98
+ }
99
+ }
100
+ }
101
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d026c1bca24b9624eb15162460f56b91
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/TrackPath.cs ADDED
@@ -0,0 +1,77 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if CINEMACHINE
3
+ using Cinemachine;
4
+ using DREditor.Minigames.Debates;
5
+ using System;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.TrackPhrase
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [Serializable]
14
+ public class TrackPath : IPhraseAnimationArchitecture
15
+ {
16
+ /// <summary>
17
+ ///
18
+ /// </summary>
19
+ public Vector3 position;
20
+
21
+ /// <summary>
22
+ ///
23
+ /// </summary>
24
+ public Vector3 Position { get => position; set => position = value; }
25
+
26
+ /// <summary>
27
+ ///
28
+ /// </summary>
29
+ public Vector4 rotation;
30
+
31
+ /// <summary>
32
+ ///
33
+ /// </summary>
34
+ public Vector4 Rotation { get => rotation; set => rotation = value; }
35
+
36
+ /// <summary>
37
+ ///
38
+ /// </summary>
39
+ public CinemachinePath.Waypoint[] points;
40
+
41
+ /// <summary>
42
+ ///
43
+ /// </summary>
44
+ public CinemachinePath.Waypoint[] Points { get => points; set => points = value; }
45
+
46
+ /// <summary>
47
+ ///
48
+ /// </summary>
49
+ public AnimationCurve speedCurve;
50
+
51
+ /// <summary>
52
+ ///
53
+ /// </summary>
54
+ public AnimationCurve SpeedCurve { get => speedCurve; set => speedCurve = value; }
55
+
56
+
57
+ /// <inheritdoc/>
58
+ public virtual void Initialize(object o = null) { }
59
+
60
+ /// <inheritdoc/>
61
+ public virtual void Apply(IPhraseAnimationArchitecture architecture)
62
+ {
63
+ UnityEngine.Debug.Log("REPORT: The currently selected track animation architecture has been replaced (likely by a preset).");
64
+
65
+ TrackPath trackPath = architecture as TrackPath;
66
+
67
+ position = trackPath.position;
68
+
69
+ rotation = trackPath.rotation;
70
+
71
+ points = trackPath.points;
72
+
73
+ speedCurve = trackPath.speedCurve;
74
+ }
75
+ }
76
+ }
77
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a06a96b95f2e12a4b83072f5b0b28cd7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "net.dreditor.trackphrase",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.7",
4
+ "displayName": "DREditor Track Phrase",
5
+ "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
+ "unity": "6000.4",
7
+ "dependencies": {
8
+ "com.unity.cinemachine": "2.10.7",
9
+ "net.dreditor.core": "0.1.7",
10
+ "net.dreditor.minigames": "0.1.7",
11
+ "net.dreditor.minigames.debates": "0.1.7"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "author": {
17
+ "name": "Benjamin \"Sweden\" Jillson",
18
+ "email": "dreditortool@gmail.com",
19
+ "url": "https://dreditor.net"
20
+ },
21
+ "keywords": [
22
+ "editor",
23
+ "tool",
24
+ "dreditor"
25
+ ],
26
+ "samples": [
27
+ {
28
+ "displayName": "Samples",
29
+ "description": "",
30
+ "path": "Samples~"
31
+ }
32
+ ],
33
+ "documentationUrl": "https://dreditor.net",
34
+ "license": "Apache-2.0",
35
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
36
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html",
37
+ "repository": {
38
+ "url": "https://github.com/CertifiedSharp/DREditor",
39
+ "type": "git",
40
+ "revision": "14ca252fbb33eb6f53557ecaed1c10902877698f"
41
+ }
42
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: a581ee62c04232643b27efe0e81e4489
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.