diff options
Diffstat (limited to 'Assets/Scripts')
82 files changed, 1524 insertions, 163 deletions
diff --git a/Assets/Scripts/ApplicationMain.cs b/Assets/Scripts/ApplicationMain.cs index e445e2ee..558a8c9d 100644 --- a/Assets/Scripts/ApplicationMain.cs +++ b/Assets/Scripts/ApplicationMain.cs @@ -6,7 +6,7 @@ public class ApplicationMain : MonoBehaviour { void Start() { - InputManager.Instance.Init(); + _InputManager.Instance.Init(); PhysicsWorld.Instance.Init();
PhysicsWorld.Instance.onUpdate += OnPhysicsUpdate; @@ -14,7 +14,7 @@ public class ApplicationMain : MonoBehaviour void Update() { - InputManager.Instance.Update();
+ _InputManager.Instance.Update();
AvatarManager.Instance.OnUpdate();
PhysicsWorld.Instance.Update();
} diff --git a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs b/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs index b3bdd3fa..5b4cfda3 100644 --- a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs +++ b/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs @@ -6,6 +6,6 @@ public class ActionWipeCmdRecord : ActionBase { public override void Execute() { - InputManager.Instance.CommandRecord.Clear(); + _InputManager.Instance.CommandRecord.Clear(); } }
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs index 52abad03..e958776a 100644 --- a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs +++ b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs @@ -13,6 +13,6 @@ public class ConditionButtonHold : ConditionBase public override bool Evaluate() { - return InputManager.Instance.IsButtonHold(m_Button); + return _InputManager.Instance.IsButtonHold(m_Button); } } diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs index d735ef5b..46ce602f 100644 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs +++ b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs @@ -16,7 +16,7 @@ public class ConditionCommand : ConditionBase public override bool Evaluate()
{
- return InputManager.Instance.CurrentCommand.code == m_TargetCommand;
+ return _InputManager.Instance.CurrentCommand.code == m_TargetCommand;
}
}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs index 71a7dbf3..e54435b4 100644 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs +++ b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs @@ -21,7 +21,7 @@ public class ConditionCommandSeq : ConditionBase public override bool Evaluate()
{
- List<Command> commandRecord = InputManager.Instance.CommandRecord;
+ List<Command> commandRecord = _InputManager.Instance.CommandRecord;
if (commandRecord == null || commandRecord.Count < m_CommandSeq.Count)
return false;
id.Clear();
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs index 06a76784..f1317d80 100644 --- a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs +++ b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs @@ -10,7 +10,7 @@ public class ConditionNoMoveButtonHold : ConditionBase public override bool Evaluate() { - bool isMoveButtonDown = InputManager.Instance.IsButtonHold(GamepadButton.Left) || InputManager.Instance.IsButtonHold(GamepadButton.Right); + bool isMoveButtonDown = _InputManager.Instance.IsButtonHold(GamepadButton.Left) || _InputManager.Instance.IsButtonHold(GamepadButton.Right); return !isMoveButtonDown; } } diff --git a/Assets/Scripts/Input/InputManager.cs b/Assets/Scripts/Input/InputManager.cs index 6bce55c6..82780cea 100644 --- a/Assets/Scripts/Input/InputManager.cs +++ b/Assets/Scripts/Input/InputManager.cs @@ -2,163 +2,16 @@ using System.Collections.Generic;
using UnityEngine;
-public class InputManager : Singleton<InputManager>
+// 处理输入逻辑
+public class InputManager : SingletonMB<InputManager>
{
- private List<Command> m_CommandRecord;
- public List<Command> CommandRecord
- {
- get
- {
- return m_CommandRecord;
- }
- }
- private readonly int kCommandRecords = 10;
+ public void OnMove(Vector3 dir)
+ {
+ }
- // 本帧内的指令,会在下一帧被清空
- private Command m_CurrentCommand;
- public Command CurrentCommand
- {
- get
- {
- return m_CurrentCommand;
- }
- }
+ public void OnSkill()
+ {
- private enum Axis { Up, Down, Left, Right};
-
- private bool[] m_Axis = new bool[4] { false, false, false, false};
-
- public void Init()
- {
- m_CommandRecord = new List<Command>();
- m_CurrentCommand = new Command(GamepadButton.Blank, 0);
- }
-
- private bool GetAxis(Axis axis)
- {
- return false;
- bool axisRaw = false;
- switch (axis)
- {
- case Axis.Left: axisRaw = Input.GetAxisRaw("Horizontal") == -1; break;
- case Axis.Right: axisRaw = Input.GetAxisRaw("Horizontal") == 1; break;
- case Axis.Down: axisRaw = Input.GetAxisRaw("Vertical") == -1; break;
- case Axis.Up: axisRaw = Input.GetAxisRaw("Vertical") == 1; break;
- }
- if (axisRaw)
- {
- if(!m_Axis[(int)axis])
- {
- m_Axis[(int)axis] = true;
- return true;
- }
- return false;
- }
- else
- {
- m_Axis[(int)axis] = false;
- return false;
- }
- }
-
- public void Update()
- {
- GamepadButton cmd = GamepadButton.Blank;
- // 移动
- if (Input.GetKeyDown("w") || GetAxis(Axis.Up))
- cmd = GamepadButton.Up;
- if (Input.GetKeyDown("s") || GetAxis(Axis.Down))
- cmd = GamepadButton.Down;
- if (Input.GetKeyDown("a") || GetAxis(Axis.Left))
- cmd = GamepadButton.Left;
- if (Input.GetKeyDown("d") || GetAxis(Axis.Right))
- cmd = GamepadButton.Right;
- // 动作
- if (Input.GetKeyDown("j") || Input.GetKeyDown(KeyCode.Joystick1Button2))
- cmd = GamepadButton.Circle;
- if (Input.GetKeyDown("k") || Input.GetKeyDown(KeyCode.Joystick1Button0))
- cmd = GamepadButton.Triangle;
- if (Input.GetKeyDown("l") || Input.GetKeyDown(KeyCode.Joystick1Button1))
- cmd = GamepadButton.Square;
- if (Input.GetKeyDown("u") || Input.GetKeyDown(KeyCode.Joystick1Button3))
- cmd = GamepadButton.Cross;
-
- if(cmd != GamepadButton.Blank)
- {
- float time = Time.time;
- Command command = new Command(cmd, time);
- //Debug.Log(CommandToString(command));
-
- m_CurrentCommand = command;
- m_CommandRecord.Add(command);
-
- if(m_CommandRecord.Count > 10)
- m_CommandRecord.RemoveRange(0, m_CommandRecord.Count - 10);
- }
- else if(m_CurrentCommand.code != GamepadButton.Blank)
- {
- m_CurrentCommand = Command.Blank;
- }
- }
-
- string CommandCodeToString(GamepadButton cmd)
- {
- switch(cmd)
- {
- case GamepadButton.Left: return "←";
- case GamepadButton.Right: return "→";
- case GamepadButton.Up: return "↑";
- case GamepadButton.Down: return "↓";
- case GamepadButton.Circle: return "○";
- case GamepadButton.Triangle: return "△";
- case GamepadButton.Square: return "□";
- case GamepadButton.Cross: return "×";
- default: return "Unknown";
- }
- }
-
- string CommandToString(Command cmd)
- {
- string sign = CommandCodeToString(cmd.code);
- return sign + " " + cmd.time + "s" + " " + cmd.id;
- }
-
- string GetGamepadButtonKey(GamepadButton button)
- {
- switch (button)
- {
- case GamepadButton.Blank: return "";
- case GamepadButton.Up: return "w";
- case GamepadButton.Down: return "s";
- case GamepadButton.Left: return "a";
- case GamepadButton.Right: return "d";
- case GamepadButton.Circle: return "j";
- case GamepadButton.Triangle: return "k";
- case GamepadButton.Square: return "l";
- case GamepadButton.Cross: return "u";
- }
- return "";
- }
-
- bool GetGamepadButtonState(GamepadButton button)
- {
- switch (button)
- {
- case GamepadButton.Up: return m_Axis[(int)Axis.Up];
- case GamepadButton.Down: return m_Axis[(int)Axis.Down];
- case GamepadButton.Left: return m_Axis[(int)Axis.Left];
- case GamepadButton.Right: return m_Axis[(int)Axis.Right];
- case GamepadButton.Circle: return Input.GetKey(KeyCode.Joystick1Button2);
- case GamepadButton.Triangle: return Input.GetKey(KeyCode.Joystick1Button0);
- case GamepadButton.Square: return Input.GetKey(KeyCode.Joystick1Button1);
- case GamepadButton.Cross: return Input.GetKey(KeyCode.Joystick1Button3);
- }
- return false;
- }
-
- public bool IsButtonHold(GamepadButton button)
- {
- return Input.GetKey(GetGamepadButtonKey(button)) || GetGamepadButtonState(button);
- }
+ }
}
diff --git a/Assets/Scripts/Input/InputManager.cs.meta b/Assets/Scripts/Input/InputManager.cs.meta index 234b6d17..c426b3c5 100644 --- a/Assets/Scripts/Input/InputManager.cs.meta +++ b/Assets/Scripts/Input/InputManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 26195ae7cb9459e498256c387da7273e +guid: 16f7a980b8509a146971d6ad5133b63a MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Input/_InputManager.cs b/Assets/Scripts/Input/_InputManager.cs new file mode 100644 index 00000000..a9d120e4 --- /dev/null +++ b/Assets/Scripts/Input/_InputManager.cs @@ -0,0 +1,164 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class _InputManager : Singleton<_InputManager>
+{
+ private List<Command> m_CommandRecord;
+ public List<Command> CommandRecord
+ {
+ get
+ {
+ return m_CommandRecord;
+ }
+ }
+ private readonly int kCommandRecords = 10;
+
+ // 本帧内的指令,会在下一帧被清空
+ private Command m_CurrentCommand;
+ public Command CurrentCommand
+ {
+ get
+ {
+ return m_CurrentCommand;
+ }
+ }
+
+ private enum Axis { Up, Down, Left, Right};
+
+ private bool[] m_Axis = new bool[4] { false, false, false, false};
+
+ public void Init()
+ {
+ m_CommandRecord = new List<Command>();
+ m_CurrentCommand = new Command(GamepadButton.Blank, 0);
+ }
+
+ private bool GetAxis(Axis axis)
+ {
+ return false;
+ bool axisRaw = false;
+ switch (axis)
+ {
+ case Axis.Left: axisRaw = Input.GetAxisRaw("Horizontal") == -1; break;
+ case Axis.Right: axisRaw = Input.GetAxisRaw("Horizontal") == 1; break;
+ case Axis.Down: axisRaw = Input.GetAxisRaw("Vertical") == -1; break;
+ case Axis.Up: axisRaw = Input.GetAxisRaw("Vertical") == 1; break;
+ }
+ if (axisRaw)
+ {
+ if(!m_Axis[(int)axis])
+ {
+ m_Axis[(int)axis] = true;
+ return true;
+ }
+ return false;
+ }
+ else
+ {
+ m_Axis[(int)axis] = false;
+ return false;
+ }
+ }
+
+ public void Update()
+ {
+ GamepadButton cmd = GamepadButton.Blank;
+ // 移动
+ if (Input.GetKeyDown("w") || GetAxis(Axis.Up))
+ cmd = GamepadButton.Up;
+ if (Input.GetKeyDown("s") || GetAxis(Axis.Down))
+ cmd = GamepadButton.Down;
+ if (Input.GetKeyDown("a") || GetAxis(Axis.Left))
+ cmd = GamepadButton.Left;
+ if (Input.GetKeyDown("d") || GetAxis(Axis.Right))
+ cmd = GamepadButton.Right;
+ // 动作
+ if (Input.GetKeyDown("j") || Input.GetKeyDown(KeyCode.Joystick1Button2))
+ cmd = GamepadButton.Circle;
+ if (Input.GetKeyDown("k") || Input.GetKeyDown(KeyCode.Joystick1Button0))
+ cmd = GamepadButton.Triangle;
+ if (Input.GetKeyDown("l") || Input.GetKeyDown(KeyCode.Joystick1Button1))
+ cmd = GamepadButton.Square;
+ if (Input.GetKeyDown("u") || Input.GetKeyDown(KeyCode.Joystick1Button3))
+ cmd = GamepadButton.Cross;
+
+ if(cmd != GamepadButton.Blank)
+ {
+ float time = Time.time;
+ Command command = new Command(cmd, time);
+ //Debug.Log(CommandToString(command));
+
+ m_CurrentCommand = command;
+ m_CommandRecord.Add(command);
+
+ if(m_CommandRecord.Count > 10)
+ m_CommandRecord.RemoveRange(0, m_CommandRecord.Count - 10);
+ }
+ else if(m_CurrentCommand.code != GamepadButton.Blank)
+ {
+ m_CurrentCommand = Command.Blank;
+ }
+ }
+
+ string CommandCodeToString(GamepadButton cmd)
+ {
+ switch(cmd)
+ {
+ case GamepadButton.Left: return "←";
+ case GamepadButton.Right: return "→";
+ case GamepadButton.Up: return "↑";
+ case GamepadButton.Down: return "↓";
+ case GamepadButton.Circle: return "○";
+ case GamepadButton.Triangle: return "△";
+ case GamepadButton.Square: return "□";
+ case GamepadButton.Cross: return "×";
+ default: return "Unknown";
+ }
+ }
+
+ string CommandToString(Command cmd)
+ {
+ string sign = CommandCodeToString(cmd.code);
+ return sign + " " + cmd.time + "s" + " " + cmd.id;
+ }
+
+ string GetGamepadButtonKey(GamepadButton button)
+ {
+ switch (button)
+ {
+ case GamepadButton.Blank: return "";
+ case GamepadButton.Up: return "w";
+ case GamepadButton.Down: return "s";
+ case GamepadButton.Left: return "a";
+ case GamepadButton.Right: return "d";
+ case GamepadButton.Circle: return "j";
+ case GamepadButton.Triangle: return "k";
+ case GamepadButton.Square: return "l";
+ case GamepadButton.Cross: return "u";
+ }
+ return "";
+ }
+
+ bool GetGamepadButtonState(GamepadButton button)
+ {
+ switch (button)
+ {
+ case GamepadButton.Up: return m_Axis[(int)Axis.Up];
+ case GamepadButton.Down: return m_Axis[(int)Axis.Down];
+ case GamepadButton.Left: return m_Axis[(int)Axis.Left];
+ case GamepadButton.Right: return m_Axis[(int)Axis.Right];
+ case GamepadButton.Circle: return Input.GetKey(KeyCode.Joystick1Button2);
+ case GamepadButton.Triangle: return Input.GetKey(KeyCode.Joystick1Button0);
+ case GamepadButton.Square: return Input.GetKey(KeyCode.Joystick1Button1);
+ case GamepadButton.Cross: return Input.GetKey(KeyCode.Joystick1Button3);
+ }
+ return false;
+ }
+
+ public bool IsButtonHold(GamepadButton button)
+ {
+ return Input.GetKey(GetGamepadButtonKey(button)) || GetGamepadButtonState(button);
+ }
+
+}
diff --git a/Assets/Scripts/Input/_InputManager.cs.meta b/Assets/Scripts/Input/_InputManager.cs.meta new file mode 100644 index 00000000..234b6d17 --- /dev/null +++ b/Assets/Scripts/Input/_InputManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26195ae7cb9459e498256c387da7273e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Managers/UnitManager.cs b/Assets/Scripts/Managers/UnitManager.cs new file mode 100644 index 00000000..f268d033 --- /dev/null +++ b/Assets/Scripts/Managers/UnitManager.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UnitManager : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Managers/UnitManager.cs.meta b/Assets/Scripts/Managers/UnitManager.cs.meta new file mode 100644 index 00000000..8f44e5ae --- /dev/null +++ b/Assets/Scripts/Managers/UnitManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f38cf602494915748a234fd75081ea2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Projectile.meta b/Assets/Scripts/Projectile.meta new file mode 100644 index 00000000..77d7b251 --- /dev/null +++ b/Assets/Scripts/Projectile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2cad9f3ec9c62140b5f9e35ba922e39 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Projectile/Projectile.cs b/Assets/Scripts/Projectile/Projectile.cs new file mode 100644 index 00000000..867ffab1 --- /dev/null +++ b/Assets/Scripts/Projectile/Projectile.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Projectile : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Projectile/Projectile.cs.meta b/Assets/Scripts/Projectile/Projectile.cs.meta new file mode 100644 index 00000000..62f134f1 --- /dev/null +++ b/Assets/Scripts/Projectile/Projectile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cdf18ab35a113044a86f2070840b1396 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Projectile/ProjectileHook.cs b/Assets/Scripts/Projectile/ProjectileHook.cs new file mode 100644 index 00000000..8542b12f --- /dev/null +++ b/Assets/Scripts/Projectile/ProjectileHook.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ProjectileHook : Projectile
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Projectile/ProjectileHook.cs.meta b/Assets/Scripts/Projectile/ProjectileHook.cs.meta new file mode 100644 index 00000000..2fc67005 --- /dev/null +++ b/Assets/Scripts/Projectile/ProjectileHook.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05206e0405d80df41b7374518fba41a5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit.meta b/Assets/Scripts/Unit.meta new file mode 100644 index 00000000..8fdbc7d9 --- /dev/null +++ b/Assets/Scripts/Unit.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c1ad0a008a9c3cd4cb20cec962a3f7fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/AnimationData.cs b/Assets/Scripts/Unit/AnimationData.cs new file mode 100644 index 00000000..0091b798 --- /dev/null +++ b/Assets/Scripts/Unit/AnimationData.cs @@ -0,0 +1,14 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 某个动画的数据,包括帧事件、碰撞盒
+[CreateAssetMenu(fileName = "Animation Data")]
+public class AnimationData : ScriptableObject
+{
+ public string animationFile;
+
+ public List<AnimationEventBase> animationEvents;
+
+ public List<ColliderData> colliders;
+}
diff --git a/Assets/Scripts/Unit/AnimationData.cs.meta b/Assets/Scripts/Unit/AnimationData.cs.meta new file mode 100644 index 00000000..3096f841 --- /dev/null +++ b/Assets/Scripts/Unit/AnimationData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cab6406109041434e890f22d6455172f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider.meta b/Assets/Scripts/Unit/Collider.meta new file mode 100644 index 00000000..58f0c5a3 --- /dev/null +++ b/Assets/Scripts/Unit/Collider.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bdd24f4780cd7394c8591ad34d8938cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderBox.cs b/Assets/Scripts/Unit/Collider/ColliderBox.cs new file mode 100644 index 00000000..b2c2022a --- /dev/null +++ b/Assets/Scripts/Unit/Collider/ColliderBox.cs @@ -0,0 +1,18 @@ +using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[Serializable]
+public class ColliderBox
+{
+ public enum EColliderType
+ {
+ HitBox,
+ HurtBox,
+ }
+ [SerializeField] public EColliderType type;
+ [SerializeField] public Vector3 position;
+ [SerializeField] public Vector3 size;
+ [SerializeField] public bool active;
+}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta b/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta new file mode 100644 index 00000000..439b4b67 --- /dev/null +++ b/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8d463de484da614bb9cad410152198a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderData.cs b/Assets/Scripts/Unit/Collider/ColliderData.cs new file mode 100644 index 00000000..177d2dd5 --- /dev/null +++ b/Assets/Scripts/Unit/Collider/ColliderData.cs @@ -0,0 +1,20 @@ +using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[Serializable]
+public class ColliderData
+{
+ [Serializable]
+ public class ColliderFrame
+ {
+ [SerializeField] public int frameIndex;
+ [SerializeField] public Vector3 position;
+ [SerializeField] public Vector3 size;
+ [SerializeField] public bool active;
+ }
+
+ [SerializeField] public ColliderBox.EColliderType type;
+ [SerializeField] public List<ColliderFrame> frames;
+}
diff --git a/Assets/Scripts/Unit/Collider/ColliderData.cs.meta b/Assets/Scripts/Unit/Collider/ColliderData.cs.meta new file mode 100644 index 00000000..c66d5502 --- /dev/null +++ b/Assets/Scripts/Unit/Collider/ColliderData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 80e8515ea336e6a4ca6ebadad243468f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component.meta b/Assets/Scripts/Unit/Component.meta new file mode 100644 index 00000000..3d416e3a --- /dev/null +++ b/Assets/Scripts/Unit/Component.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98e1c36fe676e0b4f8ea933e9619db82 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitAnimation.cs b/Assets/Scripts/Unit/Component/UnitAnimation.cs new file mode 100644 index 00000000..ac04148d --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitAnimation.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 播放动画,执行帧事件
+[DisallowMultipleComponent]
+public class UnitAnimation : UnitComponent
+{
+ private Animator m_Animator;
+
+ private TimelineEvent m_Timeline;
+
+ public void Play()
+ {
+
+ }
+
+}
diff --git a/Assets/Scripts/Unit/Component/UnitAnimation.cs.meta b/Assets/Scripts/Unit/Component/UnitAnimation.cs.meta new file mode 100644 index 00000000..75ce33fe --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4af875f33239ebf409f3e4954c0ee0cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitCollider.cs b/Assets/Scripts/Unit/Component/UnitCollider.cs new file mode 100644 index 00000000..46b79f26 --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitCollider.cs @@ -0,0 +1,19 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[DisallowMultipleComponent]
+public class UnitCollider : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Component/UnitCollider.cs.meta b/Assets/Scripts/Unit/Component/UnitCollider.cs.meta new file mode 100644 index 00000000..fa98ddc9 --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitCollider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a4f3dea33ad590458ab820a086a8be3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitComponent.cs b/Assets/Scripts/Unit/Component/UnitComponent.cs new file mode 100644 index 00000000..28f49eda --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitComponent.cs @@ -0,0 +1,28 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UnitComponent : MonoBehaviour
+{
+ protected UnitController m_Owner;
+
+ public bool IsAlive
+ {
+ get
+ {
+ return m_Owner != null;
+ }
+ }
+
+ public virtual void Initialize()
+ {
+ m_Owner = GetComponent<UnitController>();
+ }
+
+ public virtual void Release()
+ {
+ m_Owner = null;
+ StopAllCoroutines();
+ }
+
+}
diff --git a/Assets/Scripts/Unit/Component/UnitComponent.cs.meta b/Assets/Scripts/Unit/Component/UnitComponent.cs.meta new file mode 100644 index 00000000..2641a06f --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c2f1fe7707e5364aab4ddc6a962bb6e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitRender.cs b/Assets/Scripts/Unit/Component/UnitRender.cs new file mode 100644 index 00000000..cf308bab --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitRender.cs @@ -0,0 +1,19 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[DisallowMultipleComponent]
+public class UnitRender : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Component/UnitRender.cs.meta b/Assets/Scripts/Unit/Component/UnitRender.cs.meta new file mode 100644 index 00000000..98aaba31 --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitRender.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a5b6a015d074924b8a247980bb04693 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitSkill.cs b/Assets/Scripts/Unit/Component/UnitSkill.cs new file mode 100644 index 00000000..6a6a3a0e --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitSkill.cs @@ -0,0 +1,12 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 技能逻辑
+[DisallowMultipleComponent]
+
+public class UnitSkill : UnitComponent
+{
+
+
+}
diff --git a/Assets/Scripts/Unit/Component/UnitSkill.cs.meta b/Assets/Scripts/Unit/Component/UnitSkill.cs.meta new file mode 100644 index 00000000..882bb398 --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitSkill.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d55937c5d88bcc84986d79cd2ec0468b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Component/UnitState.cs b/Assets/Scripts/Unit/Component/UnitState.cs new file mode 100644 index 00000000..d5b91cec --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitState.cs @@ -0,0 +1,115 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 角色状态机
+[DisallowMultipleComponent]
+public class UnitState : UnitComponent
+{
+ public enum EUnitState
+ {
+ Idle = 1,
+ Move = 1 << 2,
+ Spawn = 1 << 3,
+ Die = 1 << 4,
+ Dead = 1 << 5,
+ Skill = 1 << 6,
+ //
+ HitAir = 1 << 7,
+ HitAirHit = 1 << 8,
+ Knockdown = 1 << 9,
+ //
+ HitGuard = 1 << 10,
+ //
+ Walk = 1 << 11,
+ }
+
+ [SerializeField] private EUnitState m_State;
+ public EUnitState CurrentState { get { return m_State; } }
+
+ private delegate void ExitStateHandler(EUnitState nextState);
+ private delegate void EnterStateHandler(EUnitState prevState);
+
+ private Dictionary<EUnitState, ExitStateHandler> m_ExitStateHandlerDic = new Dictionary<EUnitState, ExitStateHandler>();
+ private Dictionary<EUnitState, EnterStateHandler> m_EnterStateHandlerDic = new Dictionary<EUnitState, EnterStateHandler>();
+
+ #region state param
+ public struct IdleParam {}
+
+ public struct MoveParam
+ {
+ }
+
+ public struct SkillParam
+ {
+
+ }
+ #endregion
+
+ void InitState()
+ {
+ m_EnterStateHandlerDic.Add(EUnitState.Idle, OnIdleEnter);
+ m_EnterStateHandlerDic.Add(EUnitState.Move, OnMoveEnter);
+
+ m_ExitStateHandlerDic.Add(EUnitState.Idle, OnIdleExit);
+ m_ExitStateHandlerDic.Add(EUnitState.Move, OnMoveExit);
+ }
+
+ public void ChangeState<T>(EUnitState nextState, T param, bool bForce = false)
+ {
+ if (!IsChange(nextState, bForce))
+ return;
+
+ StopAllCoroutines();
+
+ m_ExitStateHandlerDic[m_State](nextState);
+
+ EUnitState prevState = m_State;
+ m_State = nextState;
+ m_EnterStateHandlerDic[m_State](prevState);
+
+ StartCoroutine(m_State.ToString(), param);
+ }
+
+ bool IsChange(EUnitState newState, bool bForce)
+ {
+ if (newState != m_State || bForce)
+ return true;
+ return false;
+ }
+
+ #region Idle
+ void OnIdleEnter(EUnitState prevState)
+ {
+
+ }
+ IEnumerator Idle(IdleParam param)
+ {
+ m_Owner.unitAnimation.Play();
+ yield return null;
+ }
+ void OnIdleExit(EUnitState nextState)
+ {
+
+ }
+ #endregion
+
+ #region Move
+ void OnMoveEnter(EUnitState prevState)
+ {
+
+ }
+
+ IEnumerator Move(MoveParam param)
+ {
+ yield return null;
+ }
+
+ void OnMoveExit(EUnitState nextState)
+ {
+
+ }
+
+ #endregion
+
+}
diff --git a/Assets/Scripts/Unit/Component/UnitState.cs.meta b/Assets/Scripts/Unit/Component/UnitState.cs.meta new file mode 100644 index 00000000..781994dc --- /dev/null +++ b/Assets/Scripts/Unit/Component/UnitState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e5c9c1db07e3c734ebf185f14cc7356a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller.meta b/Assets/Scripts/Unit/Controller.meta new file mode 100644 index 00000000..54dfab62 --- /dev/null +++ b/Assets/Scripts/Unit/Controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e8ee977d4de170a439bd598f793d4989 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/PCController.cs b/Assets/Scripts/Unit/Controller/PCController.cs new file mode 100644 index 00000000..8350b503 --- /dev/null +++ b/Assets/Scripts/Unit/Controller/PCController.cs @@ -0,0 +1,19 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[DisallowMultipleComponent]
+public class PCController : UnitComponent
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Controller/PCController.cs.meta b/Assets/Scripts/Unit/Controller/PCController.cs.meta new file mode 100644 index 00000000..d7ed1aa3 --- /dev/null +++ b/Assets/Scripts/Unit/Controller/PCController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d3cdc0aac9d88142b135a9aa3792000 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/UnitController.cs b/Assets/Scripts/Unit/Controller/UnitController.cs new file mode 100644 index 00000000..76dc9791 --- /dev/null +++ b/Assets/Scripts/Unit/Controller/UnitController.cs @@ -0,0 +1,21 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UnitController : MonoBehaviour
+{
+ public UnitRender unitRender;
+
+ public UnitState unitState;
+
+ public UnitAnimation unitAnimation;
+
+ public UnitSkill unitSkill;
+
+ public void Initialize()
+ {
+ unitRender = GetComponent<UnitRender>();
+
+ }
+
+}
diff --git a/Assets/Scripts/Unit/Controller/UnitController.cs.meta b/Assets/Scripts/Unit/Controller/UnitController.cs.meta new file mode 100644 index 00000000..326dd122 --- /dev/null +++ b/Assets/Scripts/Unit/Controller/UnitController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea5af1ca0baa89e4fbbe5d87920fb748 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events.meta b/Assets/Scripts/Unit/Events.meta new file mode 100644 index 00000000..afb263d4 --- /dev/null +++ b/Assets/Scripts/Unit/Events.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 15b356fbacd238c4c967af284dcf9320 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/AnimationEventBase.cs b/Assets/Scripts/Unit/Events/AnimationEventBase.cs new file mode 100644 index 00000000..bcaf9eae --- /dev/null +++ b/Assets/Scripts/Unit/Events/AnimationEventBase.cs @@ -0,0 +1,9 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class AnimationEventBase : ScriptableObject
+{
+ public int startFrame;
+ public TimelineEvent.EEventType type;
+}
diff --git a/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta b/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta new file mode 100644 index 00000000..346639b7 --- /dev/null +++ b/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dcc64954e16467640a4c85e184747ecd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/Editor.meta b/Assets/Scripts/Unit/Events/Editor.meta new file mode 100644 index 00000000..c76c19aa --- /dev/null +++ b/Assets/Scripts/Unit/Events/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7fe98fd5a5f07b94694065f2722b59b1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs b/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs new file mode 100644 index 00000000..047b064c --- /dev/null +++ b/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs @@ -0,0 +1,37 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+[CustomEditor(typeof(AnimationData))]
+public class AnimationDataEditor : Editor
+{
+ AnimationData animData;
+
+ public void OnEnable()
+ {
+ animData = target as AnimationData;
+ }
+
+ public void OnDisable()
+ {
+
+ }
+
+ public override void OnInspectorGUI()
+ {
+ if (animData == null)
+ return;
+ EditorGUI.BeginChangeCheck();
+
+ GUILayout.Label("Animation File:");
+ animData.animationFile = GUILayout.TextField(animData.animationFile);
+
+ if(EditorGUI.EndChangeCheck())
+ {
+ EditorUtility.SetDirty(animData);
+ AssetDatabase.SaveAssets();
+ }
+ }
+
+}
diff --git a/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs.meta b/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs.meta new file mode 100644 index 00000000..2ec7d039 --- /dev/null +++ b/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f340a992a68e144cb133678df7b505d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventAfterImage.cs b/Assets/Scripts/Unit/Events/EventAfterImage.cs new file mode 100644 index 00000000..9c0ea5ac --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventAfterImage.cs @@ -0,0 +1,16 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventAfterImage : AnimationEventBase
+{
+ public enum EAfterImageType
+ {
+ None = 0,
+ BlackWhite,
+ Golden,
+ }
+
+ public EAfterImageType afterType;
+
+}
diff --git a/Assets/Scripts/Unit/Events/EventAfterImage.cs.meta b/Assets/Scripts/Unit/Events/EventAfterImage.cs.meta new file mode 100644 index 00000000..9985730b --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventAfterImage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d07ec6150f55c1844a54dbc664e0c95d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventBulletTime.cs b/Assets/Scripts/Unit/Events/EventBulletTime.cs new file mode 100644 index 00000000..22c2b83f --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventBulletTime.cs @@ -0,0 +1,9 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventBulletTime : AnimationEventBase
+{
+
+
+}
diff --git a/Assets/Scripts/Unit/Events/EventBulletTime.cs.meta b/Assets/Scripts/Unit/Events/EventBulletTime.cs.meta new file mode 100644 index 00000000..1d2e22dc --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventBulletTime.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 554b381d61ce5494b9b4e60b72521a6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventCameraBlur.cs b/Assets/Scripts/Unit/Events/EventCameraBlur.cs new file mode 100644 index 00000000..bab672fa --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraBlur.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventCameraBlur : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Events/EventCameraBlur.cs.meta b/Assets/Scripts/Unit/Events/EventCameraBlur.cs.meta new file mode 100644 index 00000000..816be65b --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraBlur.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f064336a95165d4fa6af02fadb70bc0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventCameraShake.cs b/Assets/Scripts/Unit/Events/EventCameraShake.cs new file mode 100644 index 00000000..f352f415 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraShake.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventCameraShake : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Events/EventCameraShake.cs.meta b/Assets/Scripts/Unit/Events/EventCameraShake.cs.meta new file mode 100644 index 00000000..7e19dd10 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraShake.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9aeba330898fc54fb170f0689e5460c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs b/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs new file mode 100644 index 00000000..b9cb1a2e --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventCameraWhiteOut : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs.meta b/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs.meta new file mode 100644 index 00000000..2c73556e --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraWhiteOut.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f4a27077d030aa54ebbb7c192ca59979 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventCameraZoom.cs b/Assets/Scripts/Unit/Events/EventCameraZoom.cs new file mode 100644 index 00000000..8efac028 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraZoom.cs @@ -0,0 +1,18 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventCameraZoom : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Unit/Events/EventCameraZoom.cs.meta b/Assets/Scripts/Unit/Events/EventCameraZoom.cs.meta new file mode 100644 index 00000000..9fb41c39 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventCameraZoom.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5214828735209264c83cf0e3b1c12efe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventEffect.cs b/Assets/Scripts/Unit/Events/EventEffect.cs new file mode 100644 index 00000000..65479cb7 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventEffect.cs @@ -0,0 +1,13 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventEffect : AnimationEventBase
+{
+ public string effectName;
+ public bool attached;
+ public string bone;
+ public Vector3 position;
+ public Quaternion rotation;
+ public Vector3 scale;
+}
diff --git a/Assets/Scripts/Unit/Events/EventEffect.cs.meta b/Assets/Scripts/Unit/Events/EventEffect.cs.meta new file mode 100644 index 00000000..c88ceaa0 --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventEffect.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9fe45d0826fb033448a877f1d49199d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMeshFade.cs b/Assets/Scripts/Unit/Events/EventMeshFade.cs new file mode 100644 index 00000000..ee256b0f --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventMeshFade.cs @@ -0,0 +1,8 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class EventMeshFade : AnimationEventBase
+{
+
+}
diff --git a/Assets/Scripts/Unit/Events/EventMeshFade.cs.meta b/Assets/Scripts/Unit/Events/EventMeshFade.cs.meta new file mode 100644 index 00000000..5ab8c0bf --- /dev/null +++ b/Assets/Scripts/Unit/Events/EventMeshFade.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 761dbef185f094f439b2710ed7e5fcd1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotion.meta b/Assets/Scripts/Unit/RootMotion.meta new file mode 100644 index 00000000..9c6a1e68 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7b8fe0702c50cdc499ecd8a554e820b9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotion/Editor.meta b/Assets/Scripts/Unit/RootMotion/Editor.meta new file mode 100644 index 00000000..1c6cc85c --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 440869c8d68f8dc4e9d0b5d9f0e7e7c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs b/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs new file mode 100644 index 00000000..facf295b --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs @@ -0,0 +1,17 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+public class RootMotionEditor : EditorWindow
+{
+ private void OnEnable()
+ {
+ }
+
+ private void OnDisable()
+ {
+
+ }
+
+}
diff --git a/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs.meta b/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs.meta new file mode 100644 index 00000000..1920ba98 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/Editor/RootMotionEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb06b4e84fe52cc40b983bf33ce6809b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotion/RootMotionData.cs b/Assets/Scripts/Unit/RootMotion/RootMotionData.cs new file mode 100644 index 00000000..44f3d294 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/RootMotionData.cs @@ -0,0 +1,9 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RootMotionData : ScriptableObject
+{
+
+
+}
diff --git a/Assets/Scripts/Unit/RootMotion/RootMotionData.cs.meta b/Assets/Scripts/Unit/RootMotion/RootMotionData.cs.meta new file mode 100644 index 00000000..2b211572 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/RootMotionData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3a20e0c1a718a24f8d14eed06ad5bad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotion/RootMotionScene.unity b/Assets/Scripts/Unit/RootMotion/RootMotionScene.unity new file mode 100644 index 00000000..7dfe21e8 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/RootMotionScene.unity @@ -0,0 +1,265 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &684401757 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 684401759} + - component: {fileID: 684401758} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &684401758 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684401757} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &684401759 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684401757} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &902212380 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 902212383} + - component: {fileID: 902212382} + - component: {fileID: 902212381} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &902212381 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902212380} + m_Enabled: 1 +--- !u!20 &902212382 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902212380} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &902212383 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902212380} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + 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/Scripts/Unit/RootMotion/RootMotionScene.unity.meta b/Assets/Scripts/Unit/RootMotion/RootMotionScene.unity.meta new file mode 100644 index 00000000..b96d1254 --- /dev/null +++ b/Assets/Scripts/Unit/RootMotion/RootMotionScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 02758cbad5cdf2f44a8dc1e9c146ef4a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/TimelineEvent.cs b/Assets/Scripts/Unit/TimelineEvent.cs new file mode 100644 index 00000000..86c6a124 --- /dev/null +++ b/Assets/Scripts/Unit/TimelineEvent.cs @@ -0,0 +1,38 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 动画帧事件
+[DisallowMultipleComponent]
+public partial class TimelineEvent: MonoBehaviour
+{
+ public enum EEventType
+ {
+ EventCameraZoom, // 相机聚焦
+ EventCameraShake, // 相机晃动
+ EventCameraBlur, // 相机模糊
+ EventCameraWhiteOut, // 相机白屏
+ EventAfterImage, // 角色残像
+ EventMeshFade, // 角色透明度
+ EventMeshGloss, // 角色泛光
+ EventProjectile, // 发射体
+ EventEffect, // 特效
+ EventSound, // 音效
+ EventUIDrift, //
+ }
+
+ void EventEffect(EventEffect effect)
+ {
+ }
+
+ void EventAfterImage(EventAfterImage afterImage)
+ {
+
+ }
+
+ void EventMeshFade(EventMeshFade meshFade)
+ {
+
+ }
+
+}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/TimelineEvent.cs.meta b/Assets/Scripts/Unit/TimelineEvent.cs.meta new file mode 100644 index 00000000..50d16ded --- /dev/null +++ b/Assets/Scripts/Unit/TimelineEvent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9991268d8dcef1f43bcab1e7a31f6511 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitData.cs b/Assets/Scripts/Unit/UnitData.cs new file mode 100644 index 00000000..81921d2f --- /dev/null +++ b/Assets/Scripts/Unit/UnitData.cs @@ -0,0 +1,10 @@ +using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UnitData : ScriptableObject
+{
+ public List<AnimationData> animations;
+
+}
diff --git a/Assets/Scripts/Unit/UnitData.cs.meta b/Assets/Scripts/Unit/UnitData.cs.meta new file mode 100644 index 00000000..fdd22280 --- /dev/null +++ b/Assets/Scripts/Unit/UnitData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3517d9ffab3b50f4d97c6a1db74fff11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitParts.cs b/Assets/Scripts/Unit/UnitParts.cs new file mode 100644 index 00000000..a7af9c50 --- /dev/null +++ b/Assets/Scripts/Unit/UnitParts.cs @@ -0,0 +1,12 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+// 部件
+[DisallowMultipleComponent]
+public class UnitParts : MonoBehaviour
+{
+
+
+}
diff --git a/Assets/Scripts/Unit/UnitParts.cs.meta b/Assets/Scripts/Unit/UnitParts.cs.meta new file mode 100644 index 00000000..c95d5fdb --- /dev/null +++ b/Assets/Scripts/Unit/UnitParts.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19d4fad3ce933bf45a32ff4d0d7e328a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitRootMotion.cs b/Assets/Scripts/Unit/UnitRootMotion.cs new file mode 100644 index 00000000..40a82f1d --- /dev/null +++ b/Assets/Scripts/Unit/UnitRootMotion.cs @@ -0,0 +1,37 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// 同步root motion到角色根节点
+[ExecuteInEditMode]
+[DisallowMultipleComponent]
+public class UnitRootMotion : MonoBehaviour
+{
+ Transform m_Root;
+ Animator m_Animator; + + [HideInInspector] + public bool applyToRoot = true;
+
+ private void Awake()
+ {
+ m_Root = transform.parent;
+ m_Animator = GetComponent<Animator>();
+ }
+
+ void OnAnimatorMove()
+ {
+ if (m_Animator == null)
+ return;
+ if (applyToRoot && m_Root)
+ {
+ m_Root.rotation *= m_Animator.deltaRotation;
+ m_Root.position += m_Animator.deltaPosition;
+ }
+ else
+ {
+ transform.rotation *= m_Animator.deltaRotation;
+ transform.position += m_Animator.deltaPosition;
+ }
+ }
+}
diff --git a/Assets/Scripts/Unit/UnitRootMotion.cs.meta b/Assets/Scripts/Unit/UnitRootMotion.cs.meta new file mode 100644 index 00000000..42622b66 --- /dev/null +++ b/Assets/Scripts/Unit/UnitRootMotion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05efd5500263f8b4083c459be5fb763d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Utils/Singleton.cs b/Assets/Scripts/Utils/Singleton.cs index bdec31d3..a882238a 100644 --- a/Assets/Scripts/Utils/Singleton.cs +++ b/Assets/Scripts/Utils/Singleton.cs @@ -4,6 +4,21 @@ using UnityEngine; using System;
+public class SingletonMB<T> : MonoBehaviour where T : class
+{
+ protected static T s_Instance;
+ public static T Instance
+ {
+ get { return s_Instance; }
+ }
+
+ protected virtual void Awake()
+ {
+ s_Instance = gameObject.GetComponent(typeof(T)) as T;
+ }
+
+}
+
public class Singleton<T> where T : class, new()
{
private static T _instance;
|