diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts')
510 files changed, 0 insertions, 17001 deletions
diff --git a/Assets/Scripts/ApplicationMain.cs b/Assets/Scripts/ApplicationMain.cs deleted file mode 100644 index 558a8c9d..00000000 --- a/Assets/Scripts/ApplicationMain.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ApplicationMain : MonoBehaviour -{ - void Start() - { - _InputManager.Instance.Init(); - PhysicsWorld.Instance.Init();
-
- PhysicsWorld.Instance.onUpdate += OnPhysicsUpdate; - } - - void Update() - { - _InputManager.Instance.Update();
- AvatarManager.Instance.OnUpdate();
- PhysicsWorld.Instance.Update();
- } - - void OnPhysicsUpdate()
- {
- HitManager.Instance.OnPhysicsUpdate();
- AvatarManager.Instance.OnPhysicsUpdate();
- }
-
- private void OnDrawGizmos()
- {
- PhysicsWorld.Instance.DrawGizmos();
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/ApplicationMain.cs.meta b/Assets/Scripts/ApplicationMain.cs.meta deleted file mode 100644 index 3f311e73..00000000 --- a/Assets/Scripts/ApplicationMain.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 224df99af56dfa04f9e9649ebfbdd4a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar.meta b/Assets/Scripts/Avatar.meta deleted file mode 100644 index 0819432c..00000000 --- a/Assets/Scripts/Avatar.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 01431b5a11017ed49a2687d2ebc20e69 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions.meta b/Assets/Scripts/Avatar/Actions.meta deleted file mode 100644 index d3b985d9..00000000 --- a/Assets/Scripts/Avatar/Actions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 11a73902b983ea045bd5fb50d69dc802 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs b/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs deleted file mode 100644 index 6f2252d7..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionAnimCrossFade : ActionBase -{ - Animator m_Animator; - int m_TargetAnimation; - float m_Duration; - - public ActionAnimCrossFade(Animator animator, int toAnim, float duration = 0) - { - m_Animator = animator; - m_TargetAnimation = toAnim; - m_Duration = duration; - } - - public override void Execute() - { - m_Animator.CrossFade(m_TargetAnimation, m_Duration); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs.meta b/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs.meta deleted file mode 100644 index 6eed1575..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionAnimCrossFade.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 86ec4b9e82965164ba7d950129542f85 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionBase.cs b/Assets/Scripts/Avatar/Actions/ActionBase.cs deleted file mode 100644 index 1458e340..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionBase.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public abstract class ActionBase -{ - private int m_ID; - public int ID - { - get - { - return m_ID; - } - } - - protected ActionBase() - { - m_ID = UIDManager.Acquire(); - } - - public abstract void Execute(); - -} diff --git a/Assets/Scripts/Avatar/Actions/ActionBase.cs.meta b/Assets/Scripts/Avatar/Actions/ActionBase.cs.meta deleted file mode 100644 index 8ef84b69..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bbdb3ec1494e7c8418f9068fb2815cfc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs b/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs deleted file mode 100644 index 82b176fd..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionDontUseGravity : ActionBase -{ - PhysicsBody m_Body; - - public ActionDontUseGravity(PhysicsBody body) - { - m_Body = body; - } - - public override void Execute() - { - m_Body.UseGravity = false; - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs.meta b/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs.meta deleted file mode 100644 index 9957eef0..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionDontUseGravity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 500bcab3888d71747971dfa5f364fcd6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects.meta b/Assets/Scripts/Avatar/Actions/ActionEffects.meta deleted file mode 100644 index 17a426dd..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0b5ccfefc2e6b104a8566f4da9a16c5f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs deleted file mode 100644 index 0b2ac361..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActionActivateAfterImage : ActionBase
-{
- private bool m_IsActive;
-
- public ActionActivateAfterImage(bool isActive)
- {
- m_IsActive = isActive;
- }
-
- public override void Execute()
- {
- AfterImagePool.Instance.Activate(m_IsActive);
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs.meta b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs.meta deleted file mode 100644 index 189e2f24..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionActivateAfterImage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8df8331b2b9416b499e856b691c2326e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs deleted file mode 100644 index 1d5c2f8b..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActionAfterImageInterval : ActionBase
-{
- private int m_Interval;
-
- public ActionAfterImageInterval(int interval)
- {
- m_Interval = interval;
- }
-
- public override void Execute()
- {
- AfterImagePool.Instance.SetInterval(m_Interval);
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs.meta b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs.meta deleted file mode 100644 index fa144bad..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionAfterImageInterval.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e87b2df9fee7956449df7dc2d430b862 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs deleted file mode 100644 index 6a00aaa8..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 播放特效
-public class ActionPlayEffect : ActionBase
-{
- enum Type
- {
- GivenPosition, // 固定位置
- FollowObject, // 动态位置
- Avatar, // 角色
- }
-
- Type m_Type;
-
- string m_Effect;
- Vector3 m_Position;
- Vector3 m_Rotation;
- Vector3 m_Scale;
- Transform m_Follow;
- Avatar m_Avatar;
-
- public ActionPlayEffect(string effect, Vector3 position, Vector3 rotation, Vector3 scale)
- {
-
- }
-
- public ActionPlayEffect(string effect, Transform followPosition, Vector3 rotation, Vector3 scale)
- {
-
- }
-
- public ActionPlayEffect(string effect, Avatar avatar, Vector3 rotation, Vector3 scale)
- {
- m_Type = Type.Avatar;
- m_Effect = effect;
- m_Avatar = avatar;
- m_Rotation = rotation;
- m_Scale = scale;
- }
-
- public override void Execute()
- {
- if (m_Type == Type.Avatar)
- m_Position = m_Avatar.GetEffectPosition();
- EffectsManager.Instance.PlayEffect(m_Effect, m_Position, m_Rotation, m_Scale);
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs.meta b/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs.meta deleted file mode 100644 index 0e085fc4..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ca4c24da837b8854f8510118217e063d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs b/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs deleted file mode 100644 index c411c3fa..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 创建角色残影 -/// </summary> -public class ActionFlashEffect : ActionBase -{ - public override void Execute() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs.meta b/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs.meta deleted file mode 100644 index ea99c96b..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionFlashEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a193a2045f759e4abaff6bfef12658f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionFreeze.cs b/Assets/Scripts/Avatar/Actions/ActionFreeze.cs deleted file mode 100644 index 7f26f35a..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionFreeze.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionFreze : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionFreeze.cs.meta b/Assets/Scripts/Avatar/Actions/ActionFreeze.cs.meta deleted file mode 100644 index eb9fe77a..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionFreeze.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 32c173c981e85414c83ec9b0fc7d9722 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionJump.cs b/Assets/Scripts/Avatar/Actions/ActionJump.cs deleted file mode 100644 index 364dd7de..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJump.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 垂直跳跃,切换到jump state
-public class ActionJump : ActionSwitchState
-{
- private JumpState m_JumpState;
-
- public ActionJump(StateController system, JumpState jumpState)
- : base(system, jumpState)
- {
- m_JumpState = jumpState;
- }
-
- public override void Execute()
- {
- m_JumpState.SetDir(JumpState.Direction.Neutral);
- base.Execute();
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionJump.cs.meta b/Assets/Scripts/Avatar/Actions/ActionJump.cs.meta deleted file mode 100644 index 8c48a0a7..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJump.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 987cd3139a86b4c4fa0acdbb621e9e14 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs b/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs deleted file mode 100644 index c21fce77..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionJumpBack : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs.meta b/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs.meta deleted file mode 100644 index c8db01c7..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpBack.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1b4b55d531ec4084294169cddfbeb57a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs b/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs deleted file mode 100644 index 0751d659..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActionJumpBackward : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs.meta b/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs.meta deleted file mode 100644 index 99c729b3..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpBackward.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 635bcce72805fc14ebc1cb057db4e1b2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs b/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs deleted file mode 100644 index 2fb28dc4..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 垂直跳跃,切换到jump state
-public class ActionJumpForward : ActionSwitchState
-{
- private JumpState m_JumpState;
-
- public ActionJumpForward(StateController system, JumpState jumpState)
- : base(system, jumpState)
- {
- m_JumpState = jumpState;
- }
-
- public override void Execute()
- {
- m_JumpState.SetDir(JumpState.Direction.Forward);
- base.Execute(); // switch to jump state
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs.meta b/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs.meta deleted file mode 100644 index 27f6ba43..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionJumpForward.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0c97763c6fe099c43bab267ccc3888a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionLog.cs b/Assets/Scripts/Avatar/Actions/ActionLog.cs deleted file mode 100644 index b276d2ef..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionLog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionLog : ActionBase -{ - string m_Content = ""; - - public ActionLog(string content) - { - m_Content = content; - } - - public override void Execute() - { - Debug.Log(m_Content); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionLog.cs.meta b/Assets/Scripts/Avatar/Actions/ActionLog.cs.meta deleted file mode 100644 index 92995276..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionLog.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 012a5a398b677f94abeb0aa12659d5ec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs b/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs deleted file mode 100644 index 442ce999..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionPlaySfx : ActionBase -{ - GameObject m_Sfx; - Vector3 m_TargetPos; - - public ActionPlaySfx(GameObject sfx, Vector3 position) - { - m_Sfx = sfx; - m_TargetPos = position; - } - - public override void Execute() - { - } -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs.meta b/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs.meta deleted file mode 100644 index 2b206e8f..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPlaySfx.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 302075a0d3527d44f9188351f0f6d070 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs b/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs deleted file mode 100644 index 237b7455..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionPlaySound : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs.meta b/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs.meta deleted file mode 100644 index a9bbf014..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPlaySound.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c43194c5e437d5d4fb02a7b0618a7b0e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs b/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs deleted file mode 100644 index 9db10173..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionPosAdd : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs.meta b/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs.meta deleted file mode 100644 index 209f3795..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionPositionAdd.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fc9cfba8e327546488ec1c83add3e127 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionRush.cs b/Assets/Scripts/Avatar/Actions/ActionRush.cs deleted file mode 100644 index 19f1b625..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionRush.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionRush : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionRush.cs.meta b/Assets/Scripts/Avatar/Actions/ActionRush.cs.meta deleted file mode 100644 index 760ef5f0..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionRush.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 43fb6de9baefcab4087468f33ae40a51 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs b/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs deleted file mode 100644 index 8869801d..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionSetFeetPosition : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs.meta deleted file mode 100644 index 87656dc0..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetFeetPosition.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: da4e331f7a5282e4ca369384e69e98a4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs b/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs deleted file mode 100644 index 5e2f62ed..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionSetLocalVelocity : ActionBase -{
- PhysicsBody m_Body;
-
- Vector3 m_Velocity;
-
- public ActionSetLocalVelocity(PhysicsBody body, Vector3 localVelocity)
- {
- m_Body = body;
- m_Velocity = localVelocity;
- }
-
- public override void Execute()
- {
- m_Body.LocalVelocity = m_Velocity;
- } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs.meta deleted file mode 100644 index 0a91e7cd..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetLocalVelocity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d0c4285c1d134b045b7a5f323c258579 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs b/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs deleted file mode 100644 index a4e62294..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionSetPosition : ActionBase -{ - public ActionSetPosition() - { - } - - public override void Execute() - { - throw new System.NotImplementedException(); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs.meta deleted file mode 100644 index 466f5692..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetPosition.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6125833c9bb56f546bbd74cb0c7c32b3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs b/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs deleted file mode 100644 index 3289ac81..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionSetVelocity : ActionBase -{ - PhysicsBody m_Body; - - Vector3 m_Velocity; - - public ActionSetVelocity(PhysicsBody body, Vector3 velocity) - { - m_Body = body; - m_Velocity = velocity; - } - - public override void Execute() - { - m_Body.Velocity = m_Velocity; - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs.meta deleted file mode 100644 index 3f677ed0..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetVelocity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0334529cb8b95d5449a4d50a41099c0e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs b/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs deleted file mode 100644 index effc3ca7..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionSetVelocityX : ActionBase -{ - PhysicsBody m_Body; - - float m_VelX; - - public ActionSetVelocityX(PhysicsBody body, float x) - { - m_Body = body; - m_VelX = x; - } - - public override void Execute() - { - Vector3 v = m_Body.Velocity; - v.x = m_VelX; - m_Body.Velocity = v; - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs.meta deleted file mode 100644 index 5b39b3ec..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSetVelocityX.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6130f371839788049b56f4d71468bc51 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs b/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs deleted file mode 100644 index d55270ab..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActionShakeCamera : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs.meta b/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs.meta deleted file mode 100644 index 93a39df8..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionShakeCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a5f356ae9f970af40b86475bc21a0d5c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs b/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs deleted file mode 100644 index 890d1e66..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 基础的切换 state -public class ActionSwitchState : ActionBase -{ - StateController m_StateController; - StateBase m_TargetState; - - public ActionSwitchState(StateController stateSystem, StateBase targetState) - { - m_StateController = stateSystem; - m_TargetState = targetState; - } - - public override void Execute() - { -#if UNITY_EDITOR - string thsName = m_StateController.Current.GetType().FullName; - string clsName = m_TargetState.GetType().FullName; - Debug.Log(thsName + " -> " + clsName); -#endif - - m_StateController.SwitchToState(m_TargetState); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs.meta b/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs.meta deleted file mode 100644 index 3059d95d..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionSwitchAbility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce17bc5eca89ffc468e536284af75c4f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs b/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs deleted file mode 100644 index 8d888d30..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionTowardLeft : ActionBase -{ - Transform m_Obj; - Vector3 m_Angel = new Vector3(0, -90, 0); - - public ActionTowardLeft(Transform obj) - { - m_Obj = obj; - } - - public override void Execute() - { - m_Obj.rotation = Quaternion.Euler(m_Angel); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs.meta b/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs.meta deleted file mode 100644 index 313b4775..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTowardLeft.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 44aaf2eda01524845942fae69a26b5e1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs b/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs deleted file mode 100644 index b7dadf3a..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionTowardRight : ActionBase -{ - Transform m_Obj; - Vector3 m_Angel = new Vector3(0, 90, 0); - - public ActionTowardRight(Transform obj) - { - m_Obj = obj; - } - - public override void Execute() - { - m_Obj.rotation = Quaternion.Euler(m_Angel); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs.meta b/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs.meta deleted file mode 100644 index 1477951b..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTowardRight.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a2b93c99bf228014392dcff8416c8fe0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionTurn180.cs b/Assets/Scripts/Avatar/Actions/ActionTurn180.cs deleted file mode 100644 index 325a3e88..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTurn180.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionTurn180 : ActionBase -{ - Transform m_Obj; - Vector3 m_Angel = new Vector3(0, 180, 0); - - public ActionTurn180(Transform obj) - { - m_Obj = obj; - } - - public override void Execute() - { - m_Obj.Rotate(m_Angel); - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionTurn180.cs.meta b/Assets/Scripts/Avatar/Actions/ActionTurn180.cs.meta deleted file mode 100644 index ee218a48..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionTurn180.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fcc6f64fbe0e7cb48a2db882fe5611c7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs b/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs deleted file mode 100644 index 92cf3261..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionUseGravity : ActionBase -{ - PhysicsBody m_Body; - - public ActionUseGravity(PhysicsBody body) - { - m_Body = body; - } - - public override void Execute() - { - m_Body.UseGravity = true; - } -} diff --git a/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs.meta b/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs.meta deleted file mode 100644 index 42eeb7aa..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionUseGravity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5b25d9149f0503645907db055a0e94f5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs b/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs deleted file mode 100644 index 5b4cfda3..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionWipeCmdRecord : ActionBase -{ - public override void Execute() - { - _InputManager.Instance.CommandRecord.Clear(); - } -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs.meta b/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs.meta deleted file mode 100644 index 86c5ec59..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionWipeCmdRecord.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6124291d136fa604bafde35cb10af76b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/CameraActions.meta b/Assets/Scripts/Avatar/Actions/CameraActions.meta deleted file mode 100644 index a4650ff8..00000000 --- a/Assets/Scripts/Avatar/Actions/CameraActions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7d30a503b2bf1b04284baaadbf080a1f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs b/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs deleted file mode 100644 index 607473c2..00000000 --- a/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionMoveCamera : ActionBase -{
- public ActionMoveCamera()
- {
-
- }
-
- public override void Execute()
- {
- throw new System.NotImplementedException();
- }
-} diff --git a/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs.meta b/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs.meta deleted file mode 100644 index 3812e732..00000000 --- a/Assets/Scripts/Avatar/Actions/CameraActions/ActionMoveCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 67f15f0e55848fe4187e667a2e3e7d76 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs b/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs deleted file mode 100644 index 11c965cf..00000000 --- a/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionPauseTime : ActionBase -{
- public override void Execute()
- {
-
-
- } -} diff --git a/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs.meta b/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs.meta deleted file mode 100644 index 5cca5838..00000000 --- a/Assets/Scripts/Avatar/Actions/CameraActions/ActionPauseTime.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f2e2377ca8624a4097987aa981db53d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/EffectActions.meta b/Assets/Scripts/Avatar/Actions/EffectActions.meta deleted file mode 100644 index 8b300c5b..00000000 --- a/Assets/Scripts/Avatar/Actions/EffectActions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c8aea8ed2489dde4fba46dde6f2a8d09 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs b/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs deleted file mode 100644 index 2da01daf..00000000 --- a/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 残影特效 -public class ActionDisableGhost : ActionBase -{ - CharacterGhostEffect m_GhostEffect; - - public ActionDisableGhost(CharacterGhostEffect effect) - { - m_GhostEffect = effect; - } - - public override void Execute() - { - m_GhostEffect.IsEnable = false; - } -} diff --git a/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs.meta b/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs.meta deleted file mode 100644 index 185da50b..00000000 --- a/Assets/Scripts/Avatar/Actions/EffectActions/ActionDisableGhost.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8548d7836b8033643954ca68cc3a5948 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs b/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs deleted file mode 100644 index fa2d8e74..00000000 --- a/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 残影特效 -public class ActionEffectGhost : ActionBase -{ - CharacterGhostEffect m_GhostEffect; - - public ActionEffectGhost(CharacterGhostEffect effect) - { - m_GhostEffect = effect; - } - - public override void Execute() - { - m_GhostEffect.IsEnable = true; - } -} diff --git a/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs.meta b/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs.meta deleted file mode 100644 index 6a55db7d..00000000 --- a/Assets/Scripts/Avatar/Actions/EffectActions/ActionEffectGhost.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 68cbffdb70cd84041b2aa7b2134a10e8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/UberActions.meta b/Assets/Scripts/Avatar/Actions/UberActions.meta deleted file mode 100644 index c2620d0e..00000000 --- a/Assets/Scripts/Avatar/Actions/UberActions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 74422fa2d75a19040b26845660f7b51b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs b/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs deleted file mode 100644 index b62d3b37..00000000 --- a/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ActionUber : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs.meta b/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs.meta deleted file mode 100644 index 69d003aa..00000000 --- a/Assets/Scripts/Avatar/Actions/UberActions/ActionUber.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5986fb71b8f521d4c9bffe103916f1c5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Avatar.cs b/Assets/Scripts/Avatar/Avatar.cs deleted file mode 100644 index 8787b942..00000000 --- a/Assets/Scripts/Avatar/Avatar.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-
-/// <summary>
-/// 角色,包括player和opponents
-/// </summary>
-public partial class Avatar : MonoBehaviour, IInteractable
-{
- public string Name;
-
- // 一个角色包括一个身体的collider和若干hitbox和hurtbox
- public PhysicsBody m_Body; - public PhysicsBox m_BodyCollider;
- public Hitbox[] m_Hitbox;
- public Hurtbox[] m_Hurtbox;
-
- public Transform m_Hips; -
- protected StateController m_StateController = new StateController();
-
- // 预定义的state,角色必须定义的
- protected StateBase m_StateLightHurt;
- protected StateBase m_StateMidiumHurt;
- protected StateBase m_StateHeavyHurt;
- protected StateBase m_StateGroundHurt;
- protected StateBase m_StateAirHurt;
-
- public PhysicsBody Body
- {
- get
- {
- return m_Body;
- }
- }
-
- public PhysicsPrimitive[] GetAllPrimitive()
- {
- throw new System.NotImplementedException();
- }
-
- protected void Init()
- {
- AvatarManager.Instance.AddAvatar(this);
- }
-
- public PhysicsBox GetHitbox()
- {
- throw new System.NotImplementedException();
- }
-
- public PhysicsBox GetHurtbox()
- {
- throw new System.NotImplementedException();
- }
-
- public PhysicsPrimitive[] GetAllHit()
- {
- throw new System.NotImplementedException();
- }
-
- public bool IsHit()
- {
- for (int i = 0; i < m_Hitbox.Length; ++i)
- {
- if (PhysicsWorld.Instance.HasCollision(m_Hitbox[i].Collider))
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsHurt()
- {
- for (int i = 0; i < m_Hitbox.Length; ++i)
- {
- if (PhysicsWorld.Instance.HasCollision(m_Hurtbox[i].Collider))
- {
- return true;
- }
- }
- return false;
- }
-
- public void OnUpdate()
- {
- m_StateController.OnUpdate();
- }
-
- // 在物理模拟之后调用
- public void OnPhysicsUpdate()
- {
- m_StateController.OnPhysicsUpdate();
- }
-
- public virtual Vector3 GetEffectPosition()
- {
- return Vector3.zero;
- }
-
- // 获得当前击打如果有的话
- public Hit GetHit()
- {
- return m_StateController.GetHit();
- }
-
- public virtual void OnHit(HitInfo hitInfo)
- {
- //Debug.Log("Hit");
- m_StateController.OnHit(hitInfo);
- }
-
- public virtual void OnHurt(HurtInfo hurtInfo)
- {
- //Debug.Log("Hurt");
- HitDefination hitDef = hurtInfo.hitDef;
- if (hitDef != null)
- ApplyHit(hitDef);
- m_StateController.OnHurt(hurtInfo);
- }
-
-
- protected ConditionBase Not(ConditionBase cond)
- {
- return new ConditionNot(cond);
- }
-
- protected ConditionBase And(ConditionBase c1, ConditionBase c2)
- {
- return new ConditionAnd(c1, c2);
- }
-
- protected ConditionBase Ands(params ConditionBase[] cond)
- {
- List<ConditionBase> conditions = new List<ConditionBase>();
- for (int i = 0; i < cond.Length; ++i)
- {
- conditions.Add(cond[i]);
- }
- ConditionMultiAnd and = new ConditionMultiAnd(conditions);
- return and;
- }
-
- protected ConditionBase Or(ConditionBase c1, ConditionBase c2)
- {
- return new ConditionOr(c1, c2);
- }
-
-}
diff --git a/Assets/Scripts/Avatar/Avatar.cs.meta b/Assets/Scripts/Avatar/Avatar.cs.meta deleted file mode 100644 index 88269a31..00000000 --- a/Assets/Scripts/Avatar/Avatar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a9cb2414b4a10143919919cfe80537e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Avatar_Hurt.cs b/Assets/Scripts/Avatar/Avatar_Hurt.cs deleted file mode 100644 index c6b840b9..00000000 --- a/Assets/Scripts/Avatar/Avatar_Hurt.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class Avatar : MonoBehaviour, IInteractable
-{
- void ApplyHit(HitDefination hit)
- {
- if(hit.hurtAddForce.magnitude != 0)
- {
- m_Body.AddForce(hit.hurtAddForce);
- }
-
- // 切换到受击状态
- switch(hit.type)
- {
- case HitType.Light: m_StateController.SwitchToState(m_StateLightHurt); break;
- case HitType.Midium: m_StateController.SwitchToState(m_StateMidiumHurt); break;
- case HitType.Heavy: m_StateController.SwitchToState(m_StateHeavyHurt); break;
- case HitType.Ground: m_StateController.SwitchToState(m_StateGroundHurt); break;
- case HitType.Air: m_StateController.SwitchToState(m_StateAirHurt); break;
- default:
- m_StateController.SwitchToState(m_StateLightHurt);
- break;
- }
-
- // spark
- if(hit.sparkName != string.Empty)
- {
- if(hit.sparkHostType == HitSparkHost.Center)
- {
- SparksManager.Instance.PlaySpark(hit.sparkName, m_Hips);
- }
- }
-
- }
-
-}
diff --git a/Assets/Scripts/Avatar/Avatar_Hurt.cs.meta b/Assets/Scripts/Avatar/Avatar_Hurt.cs.meta deleted file mode 100644 index 9b72c6ac..00000000 --- a/Assets/Scripts/Avatar/Avatar_Hurt.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b8225de6932892342bf356e15bda0858 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Bahaviours.meta b/Assets/Scripts/Avatar/Bahaviours.meta deleted file mode 100644 index 982222bf..00000000 --- a/Assets/Scripts/Avatar/Bahaviours.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d10a8e3e46f321146b54b9f74ca76db6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs b/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs deleted file mode 100644 index cbc9c632..00000000 --- a/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GhostEffectSpwan : MonoBehaviour -{ - public CharacterGhostEffect GhostEffect; - - public void SpawnGhost() - { - GhostEffect.CreateGhost(); - } - -} diff --git a/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs.meta b/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs.meta deleted file mode 100644 index 4acfc78c..00000000 --- a/Assets/Scripts/Avatar/Bahaviours/GhostEffectSpwan.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 12bdc2613cfcd9043ad58b1bcc15c8ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions.meta b/Assets/Scripts/Avatar/Conditions.meta deleted file mode 100644 index 9ee89e8b..00000000 --- a/Assets/Scripts/Avatar/Conditions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4564e909667997f48822cb2d05ed360f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs deleted file mode 100644 index 4b71b837..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 记录之前的state序列满足某个序列
-/// combo的时候根据当前序列决定combo
-/// </summary>
-public class ConditionStateSeq : ConditionBase
-{
- List<int> m_TargetStateSeq = new List<int>();
-
- public ConditionStateSeq(List<int> commandSeq)
- : base()
- {
- m_TargetStateSeq = commandSeq;
- }
-
- public override bool Evaluate()
- {
- // 验证记录的stateSeq是否满足
-
-
- throw new System.NotImplementedException();
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta deleted file mode 100644 index 5070f1cc..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7bbf0480c45c29843b8ba41229bb29b1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs deleted file mode 100644 index 0f9b4529..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionAttkExpireTime : ConditionBase -{ - AttackState m_State; - float m_ExpireTime; - - public ConditionAttkExpireTime(AttackState attack, float expireTime) - { - m_State = attack; - m_ExpireTime = expireTime; - } - - public override bool Evaluate() - { - return m_State.ExpireTime > m_ExpireTime; - } -} - diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta deleted file mode 100644 index 80b4d7a7..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 385e621dcc66179459c6f2a2b3b81319 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs deleted file mode 100644 index 8dff29da..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 触发条件基类
-/// </summary>
-public abstract class ConditionBase
-{
-
- public ConditionBase()
- {
- }
-
- public abstract bool Evaluate();
-
-}
-
-/// <summary>
-/// 两个condition都达成才会返回真
-/// </summary>
-public sealed class ConditionNot : ConditionBase
-{
- ConditionBase m_Condition;
-
-
- public ConditionNot(ConditionBase cond)
- : base()
- {
- m_Condition = cond;
- }
-
- public override bool Evaluate()
- {
- return !m_Condition.Evaluate();
- }
-}
-
-/// <summary>
-/// 总是满足
-/// </summary>
-public sealed class ConditionAlways : ConditionBase
-{
- public override bool Evaluate()
- {
- return true;
- }
-}
-
-/// <summary>
-/// 总是不满足
-/// </summary>
-public sealed class ConditionAlwaysNot : ConditionBase
-{
- public override bool Evaluate()
- {
- return false;
- }
-}
-
-/// <summary>
-/// 两个condition都达成才会返回真
-/// </summary>
-public sealed class ConditionAnd : ConditionBase
-{
- ConditionBase m_FirstCondition, m_LastCondition;
-
-
- public ConditionAnd(ConditionBase first, ConditionBase last)
- : base()
- {
- m_FirstCondition = first;
- m_LastCondition = last;
- }
-
- public override bool Evaluate()
- {
- return m_FirstCondition.Evaluate() && m_LastCondition.Evaluate();
- }
-}
-
-/// <summary>
-/// 两个condition至少一个达成才会返回真
-/// </summary>
-public sealed class ConditionOr : ConditionBase
-{
- ConditionBase m_FirstCondition, m_LastCondition;
-
-
- public ConditionOr(ConditionBase first, ConditionBase last)
- : base()
- {
- m_FirstCondition = first;
- m_LastCondition = last;
- }
-
- public override bool Evaluate()
- {
- return m_FirstCondition.Evaluate() || m_LastCondition.Evaluate();
- }
-}
-
-
-/// <summary>
-/// 两个condition都不达成才会返回真
-/// </summary>
-public sealed class ConditionNone : ConditionBase
-{
- ConditionBase m_FirstCondition, m_LastCondition;
-
- public ConditionNone(ConditionBase first, ConditionBase last)
- : base()
- {
- m_FirstCondition = first;
- m_LastCondition = last;
- }
-
- public override bool Evaluate()
- {
- return !m_FirstCondition.Evaluate() && !m_LastCondition.Evaluate();
- }
-}
-
-
-/// <summary>
-/// 多个condition都达成才会返回真
-/// </summary>
-public sealed class ConditionMultiAnd : ConditionBase
-{
- List<ConditionBase> m_Conditions = new List<ConditionBase>();
-
- public ConditionMultiAnd(List<ConditionBase> conditions)
- : base()
- {
- m_Conditions.AddRange(conditions);
- }
-
- public override bool Evaluate()
- {
- foreach(var condition in m_Conditions)
- {
- if(!condition.Evaluate())
- return false;
- }
- return true;
- }
-}
-
-/// <summary>
-/// 多个condition至少一个达成才会返回真
-/// </summary>
-public sealed class ConditionMultiOr : ConditionBase
-{
- List<ConditionBase> m_Conditions;
-
- public ConditionMultiOr(List<ConditionBase> conditions)
- : base()
- {
- m_Conditions.AddRange(conditions);
- }
-
- public override bool Evaluate()
- {
- foreach (var condition in m_Conditions)
- {
- if (condition.Evaluate())
- return true;
- }
- return false;
- }
-}
-
-/// <summary>
-/// 多个condition都不达成才会返回真
-/// </summary>
-public sealed class ConditionMultiNone : ConditionBase
-{
- List<ConditionBase> m_Conditions;
-
- public ConditionMultiNone(List<ConditionBase> conditions)
- : base()
- {
- m_Conditions.AddRange(conditions);
- }
-
- public override bool Evaluate()
- {
- foreach (var condition in m_Conditions)
- {
- if (condition.Evaluate())
- return false;
- }
- return true;
- }
-}
-
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta deleted file mode 100644 index 4c321ffd..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 21029775aaf8cdd4a868a45725313c3a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs deleted file mode 100644 index e958776a..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionButtonHold : ConditionBase -{ - GamepadButton m_Button; - - public ConditionButtonHold(GamepadButton button) - { - m_Button = button; - } - - public override bool Evaluate() - { - return _InputManager.Instance.IsButtonHold(m_Button); - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta deleted file mode 100644 index 82d350e2..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b0cd6f63cbe32649a15ab38d5bb6ee3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs deleted file mode 100644 index ec4e489c..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionCheckHp : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta deleted file mode 100644 index e5b205b2..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e4b80b2be76ae9149af7b8a57f1e68ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs b/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs deleted file mode 100644 index 98859483..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionCheckJumpState : ConditionBase -{ - JumpState m_State; - JumpState.Stage m_Stage; - JumpState.Direction m_Direction; - - public ConditionCheckJumpState(JumpState state, JumpState.Stage stage = JumpState.Stage.None, JumpState.Direction direction = JumpState.Direction.None) - { - m_State = state; - m_State = state; - m_Direction = direction; - } - - public override bool Evaluate() - { - if (m_State == null) - return false; - if (m_Stage != JumpState.Stage.None && m_Direction != JumpState.Direction.None) - { - return m_State.CurStage == m_Stage - && m_State.CurDirection == m_Direction; - } - else if (m_Stage != JumpState.Stage.None && m_Direction == JumpState.Direction.None) - { - return m_State.CurStage == m_Stage; - } - else if (m_Stage == JumpState.Stage.None && m_Direction != JumpState.Direction.None) - { - return m_State.CurDirection == m_Direction; - } - else - return false; - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs.meta deleted file mode 100644 index aefa0807..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d7c948fe9eefbd14d9137b19e92e1fc4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs deleted file mode 100644 index c14bff3c..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionCheckMp : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta deleted file mode 100644 index d920a18f..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a603843f7ac083c45ba5b2ec23d4cc0b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs deleted file mode 100644 index 1b6159cb..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 连击操作,综合ConditionMotionRange和ConditionCommand
-/// </summary>
-public class ConditionCombo : ConditionBase
-{
- public override bool Evaluate()
- {
- throw new System.NotImplementedException();
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta deleted file mode 100644 index 45582943..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 015528a2fbc923f45b1e25c11a6ade2b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs deleted file mode 100644 index 46ce602f..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 按下某个command
-/// </summary>
-public class ConditionCommand : ConditionBase
-{
- GamepadButton m_TargetCommand;
-
- public ConditionCommand(GamepadButton command)
- {
- m_TargetCommand = command;
- }
-
- public override bool Evaluate()
- {
- return _InputManager.Instance.CurrentCommand.code == m_TargetCommand;
- }
-
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta deleted file mode 100644 index 100638e6..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6334908b568b7c046bbeb3f526f95841 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs deleted file mode 100644 index e54435b4..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 一个command序列,用来触发连击
-/// </summary>
-public class ConditionCommandSeq : ConditionBase
-{
- List<GamepadButton> m_CommandSeq = new List<GamepadButton>();
- float m_DeltaTime = 0;
- List<int> m_LastCmdID = new List<int>();
-
- List<int> id = new List<int>();
-
- public ConditionCommandSeq(List<GamepadButton> commandSeq, float maxDeltaTime)
- {
- m_CommandSeq.AddRange(commandSeq);
- m_DeltaTime = maxDeltaTime;
- }
-
- public override bool Evaluate()
- {
- List<Command> commandRecord = _InputManager.Instance.CommandRecord;
- if (commandRecord == null || commandRecord.Count < m_CommandSeq.Count)
- return false;
- id.Clear();
- for (int i = 1; i < m_CommandSeq.Count; ++i)
- {
- GamepadButton button = m_CommandSeq[i];
- GamepadButton preButton = m_CommandSeq[i-1];
- int j = commandRecord.Count - m_CommandSeq.Count + i;
- Command cmd = commandRecord[j];
- Command preCmd = commandRecord[j-1];
- if (preCmd.code != preButton || cmd.code != button)
- return false;
- if (cmd.time - preCmd.time > m_DeltaTime)
- return false;
- id.Add(preCmd.id);
- if (j == commandRecord.Count - 1)
- id.Add(cmd.id);
- }
-
- //for (int i = 0; i < id.Count; ++i)
- //{
- // if (m_LastCmdID.Contains(id[i]))
- // return false;
- //}
- //m_LastCmdID.Clear();
- //m_LastCmdID.AddRange(id);
-
- return true;
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta deleted file mode 100644 index fc77bd3c..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7316354e3f99412419c866e0fc3906c6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs deleted file mode 100644 index 212e5172..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 某个角色是否浮空
-/// </summary>
-public class ConditionInAir : ConditionBase
-{
- PhysicsPrimitive m_Prim;
-
- public ConditionInAir(PhysicsPrimitive prim)
- {
- m_Prim = prim;
- }
-
- public override bool Evaluate()
- {
- return m_Prim.IsInAir;
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta deleted file mode 100644 index 8bbf610f..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8855eebdb67a2cc4baeb2a21e5b40ed4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs deleted file mode 100644 index a6e57e37..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ConditionJumpDone : ConditionBase
-{
- JumpState m_Jump;
- float m_T;
-
- public ConditionJumpDone(JumpState jump, float t = 1f)
- {
- m_Jump = jump;
- m_T = t;
- }
-
- public override bool Evaluate()
- {
- return m_Jump.IsJumpDone(m_T);
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta deleted file mode 100644 index 34a9de96..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 734f6d264357f2c43b13f8203f7ecd41 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs deleted file mode 100644 index e0f75a69..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionJumpOnGround : ConditionBase -{ - JumpState m_Jump; - - public ConditionJumpOnGround(JumpState jump) - { - m_Jump = jump; - } - - public override bool Evaluate() - { - return m_Jump.IsJumpGround(); - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta deleted file mode 100644 index 33f0341b..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1a04452218ec0b849bbed3d0ba35cd12 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs deleted file mode 100644 index a6bd96c0..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ConditionJumpReady : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta deleted file mode 100644 index d947e116..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 300b4929ffe151c43bfce427115a05a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs deleted file mode 100644 index 18d71e86..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 动画已经播放完毕 -/// </summary> -public class ConditionMotionAtEnd : ConditionBase -{ - Animator m_Animator; - int m_AnimationHash; - - public ConditionMotionAtEnd(Animator animator, int animationHash) - : base() - { - m_Animator = animator; - m_AnimationHash = animationHash; - } - - public override bool Evaluate() - { - AnimatorStateInfo info = m_Animator.GetCurrentAnimatorStateInfo(0); - if(info.shortNameHash == m_AnimationHash) - { - float t = info.normalizedTime; - if (t >= 0.99f) - return true; - } - return false; - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta deleted file mode 100644 index 1688dd68..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f5cbdf2ebe12b5d46afa21a62609d15c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs deleted file mode 100644 index 282ef929..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionAnimFrameRange : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta deleted file mode 100644 index 3fc88fb1..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28e7aa2c7b5a9d74b936ec5731eeec36 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs deleted file mode 100644 index c902ae26..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 某个动画是否播放到了某个时间(归一化了的)范围内 -/// </summary> -public sealed class ConditionMotionRange : ConditionBase -{ - Vector2 m_TimeRange = new Vector2(); - Animator m_Animator; - - public ConditionMotionRange(Animator animator, float start, float end) - { - m_Animator = animator; - - m_TimeRange.Set(start, end); - } - - public override bool Evaluate() - { - AnimatorStateInfo info = m_Animator.GetCurrentAnimatorStateInfo(0); - float time = info.normalizedTime; - bool result = time >= m_TimeRange.x && time <= m_TimeRange.y; - return result; - } - -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta deleted file mode 100644 index 926a8560..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 56b6b5bfaf0d4e147a2f0f1809e7739b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs deleted file mode 100644 index 1084f191..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionMoveButtonHold : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta deleted file mode 100644 index 45cf47bb..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 77299e998cbe9d1429c2d0b731bff6e3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs deleted file mode 100644 index f1317d80..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionNoMoveButtonHold : ConditionBase -{ - public ConditionNoMoveButtonHold() - { - } - - public override bool Evaluate() - { - bool isMoveButtonDown = _InputManager.Instance.IsButtonHold(GamepadButton.Left) || _InputManager.Instance.IsButtonHold(GamepadButton.Right); - return !isMoveButtonDown; - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta deleted file mode 100644 index db883c19..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce1302d58bf3a7043b6e2e25d13525d9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs deleted file mode 100644 index 8db94951..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionNotHit : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta deleted file mode 100644 index 7058713f..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b0d86b3d8867b144f90fcedf4a6351c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs deleted file mode 100644 index 9604677a..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionNotHurt : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta deleted file mode 100644 index bbe77240..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ab089a23fff18a647856f2e33a145784 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs deleted file mode 100644 index 36cbfd05..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionTowardLeft : ConditionBase -{ - Transform m_Obj; - - public ConditionTowardLeft(Transform obj) - { - m_Obj = obj; - } - - public override bool Evaluate() - { - return Mathf.Approximately(m_Obj.rotation.eulerAngles.y, 270f) - || Mathf.Approximately(m_Obj.rotation.eulerAngles.y, -90f); - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta deleted file mode 100644 index e3a399a6..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e2f90baa8b157234f93cdb949b43cd24 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs deleted file mode 100644 index d26a1fd0..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ConditionTowardRight : ConditionBase -{ - Transform m_Obj; - - public ConditionTowardRight(Transform obj) - { - m_Obj = obj; - } - - public override bool Evaluate() - { - return Mathf.Approximately(m_Obj.rotation.eulerAngles.y, 90f); - } -} diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta deleted file mode 100644 index 901efb57..00000000 --- a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ab6f3e1b40a1eff4196b069e4fd25469 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/Interactive.meta b/Assets/Scripts/Avatar/Conditions/Interactive.meta deleted file mode 100644 index cf125393..00000000 --- a/Assets/Scripts/Avatar/Conditions/Interactive.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 38b2530cdab57854e90007371516c2bf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs deleted file mode 100644 index d36cc538..00000000 --- a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// hitbox击中
-public class ConditionHit : ConditionBase
-{
- IInteractable m_Obj;
-
- public ConditionHit(IInteractable obj)
- {
- m_Obj = obj;
-
- }
-
- public override bool Evaluate()
- {
- bool isHit = m_Obj.IsHit();
- return isHit;
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta deleted file mode 100644 index 9c607983..00000000 --- a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c354907230901bf45849e4bb93601b60 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs deleted file mode 100644 index 8a76528d..00000000 --- a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// hurtbox被击中
-public class ConditionHurt : ConditionBase
-{
- IInteractable m_Obj;
-
- public ConditionHurt(IInteractable obj)
- {
- m_Obj = obj;
- }
-
- public override bool Evaluate()
- {
- bool isHit = m_Obj.IsHit();
- return isHit;
- }
-}
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta deleted file mode 100644 index e54feb2d..00000000 --- a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 62448f0af4616f64c987ac12131db584 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/EnforceZCoord.cs b/Assets/Scripts/Avatar/EnforceZCoord.cs deleted file mode 100644 index 2adcd4d6..00000000 --- a/Assets/Scripts/Avatar/EnforceZCoord.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class EnforceZCoord : MonoBehaviour -{ - private void Start()
- {
-
- }
-
- void OnAnimatorMove() - { - Animator animator = GetComponent<Animator>(); - if (animator == null) - return; - - AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); - - if (stateInfo.IsTag("IgnoreRootMotion")) - { - // ignore root motion - //Debug.Log("ignore root motion "); - } - else if (stateInfo.IsTag("IgnoreRootMotionY")) - { - Vector3 position = transform.position; - position.x += animator.deltaPosition.x; - transform.position = position; - - transform.rotation *= animator.deltaRotation; - } - else - { - // animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果 - // 在后面做一个硬性约束z=0,将角色限制在z=0平面上 - Vector3 position = transform.position; - position.x += animator.deltaPosition.x; - position.y += animator.deltaPosition.y; - transform.position = position; - - // animation clip导入设置旋转一般上设置为baked inpose,不需要手动限制 - transform.rotation *= animator.deltaRotation; - } - } -} diff --git a/Assets/Scripts/Avatar/EnforceZCoord.cs.meta b/Assets/Scripts/Avatar/EnforceZCoord.cs.meta deleted file mode 100644 index 76f8b6ce..00000000 --- a/Assets/Scripts/Avatar/EnforceZCoord.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 159e1f8ce7b6ba840b409f1e6e8f3e3e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/HitDefination.cs b/Assets/Scripts/Avatar/HitDefination.cs deleted file mode 100644 index d5d68b23..00000000 --- a/Assets/Scripts/Avatar/HitDefination.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary>
-/// 攻击类型,对应不同的受击者反馈(动作)
-/// </summary> -public enum HitType
-{
- Light, // 轻击
- Midium, // 中击
- Heavy, // 重击
- Ground, // 击倒
- Air, // 击飞
-} - -public enum HitSparkHost
-{
- Center, // 受击者质心 - Hitpoint, // 重叠盒子中心 - Fixed, // 固定挂点sparkHost - WorldPosition, // 世界空间位置sparkRotation -} - -/// <summary>
-/// 一个hit的定义,如果一个attack有多个hit,需要定义多个HitDef
-/// </summary> -public class HitDefination -{
- // 触发的开始和结束时间范围,用来处理一个attack多个hit的情况
- public float start = 0f; - public float end = 1f;
-
- public HitType type = HitType.Light; // 类型
-
- // 特效
- public string sparkName = string.Empty; // 特效 - public HitSparkHost sparkHostType = HitSparkHost.Center;
- public Transform sparkHost = null; // 特效挂点 - public Vector3 sparkPosition; // 特效位置 - public Quaternion sparkRotation; // 特效旋转 - public Vector3 sparkScale = Vector3.one; // 特效缩放 - - // 相机反馈 - - // 攻击方反馈 - - // 受击方反馈 - public Vector3 hurtAddForce = Vector3.zero; - -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/HitDefination.cs.meta b/Assets/Scripts/Avatar/HitDefination.cs.meta deleted file mode 100644 index d542f9ff..00000000 --- a/Assets/Scripts/Avatar/HitDefination.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 25b7556b2c9481e49938afa25157f3fc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/HitInfo.cs b/Assets/Scripts/Avatar/HitInfo.cs deleted file mode 100644 index aef9a03f..00000000 --- a/Assets/Scripts/Avatar/HitInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary>
-/// 每个招式配置的单个hit数据
-/// </summary> -public class Hit -{ - public HitDefination defination; - - /// <summary> - /// 记录这个hit命中的avatar,避免连续击中 - /// </summary> - private List<IInteractable> m_HitAvatars = new List<IInteractable>(); - - public void AddRecord(IInteractable interactable) - { - if (!m_HitAvatars.Contains(interactable)) - m_HitAvatars.Add(interactable); - } - - // 招式结束后,清除记录的avatar - public void WipeRecords() - { - m_HitAvatars.Clear(); - } - - public bool HasRecord(IInteractable interactable)
- {
- return m_HitAvatars.Contains(interactable);
- } - -} diff --git a/Assets/Scripts/Avatar/HitInfo.cs.meta b/Assets/Scripts/Avatar/HitInfo.cs.meta deleted file mode 100644 index ab541e49..00000000 --- a/Assets/Scripts/Avatar/HitInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3f1668cf50ed81641a8f344328012e30 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Hitbox.cs b/Assets/Scripts/Avatar/Hitbox.cs deleted file mode 100644 index 5fd0cecf..00000000 --- a/Assets/Scripts/Avatar/Hitbox.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Hitbox : MonoBehaviour
-{
- [SerializeField]
- private PhysicsBox m_BoxCollider;
- public PhysicsBox Collider
- {
- get
- {
- return m_BoxCollider;
- }
- }
-
- [SerializeField]
- private MonoBehaviour m_Host ;
-
- public IInteractable Host
- {
- get
- {
- return m_Host as IInteractable;
- }
- }
-
- private void Awake()
- {
- HitManager.Instance.AddHitBox(this);
- }
-
-}
diff --git a/Assets/Scripts/Avatar/Hitbox.cs.meta b/Assets/Scripts/Avatar/Hitbox.cs.meta deleted file mode 100644 index 19075d69..00000000 --- a/Assets/Scripts/Avatar/Hitbox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f763a2db7c267714f824ca6a69bec569 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Hurtbox.cs b/Assets/Scripts/Avatar/Hurtbox.cs deleted file mode 100644 index b5bd738f..00000000 --- a/Assets/Scripts/Avatar/Hurtbox.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Hurtbox : MonoBehaviour
-{
- [SerializeField]
- private PhysicsBox m_BoxCollider;
- public PhysicsBox Collider
- {
- get {
- return m_BoxCollider;
- }
- }
-
- [SerializeField]
- private MonoBehaviour m_Host;
-
- public IInteractable Host
- {
- get
- {
- return m_Host as IInteractable;
- }
- }
-
- private void Awake()
- {
- HitManager.Instance.AddHurtBox(this);
- }
-
-
-}
diff --git a/Assets/Scripts/Avatar/Hurtbox.cs.meta b/Assets/Scripts/Avatar/Hurtbox.cs.meta deleted file mode 100644 index f0c2e2ff..00000000 --- a/Assets/Scripts/Avatar/Hurtbox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 154a74587976e25469eae9a4a8c7762b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/IInteractable.cs b/Assets/Scripts/Avatar/IInteractable.cs deleted file mode 100644 index 7a648c6c..00000000 --- a/Assets/Scripts/Avatar/IInteractable.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public interface IInteractable -{ - PhysicsPrimitive[] GetAllPrimitive(); - - PhysicsBox GetHitbox(); - - PhysicsBox GetHurtbox(); - - PhysicsPrimitive[] GetAllHit(); - - bool IsHit(); - - bool IsHurt();
-
- void OnHit(HitInfo hitInfo); - - void OnHurt(HurtInfo hurtInfo); - -} diff --git a/Assets/Scripts/Avatar/IInteractable.cs.meta b/Assets/Scripts/Avatar/IInteractable.cs.meta deleted file mode 100644 index ae065c04..00000000 --- a/Assets/Scripts/Avatar/IInteractable.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f6f243903bde9804488701c6d0f7920a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/StateController.cs b/Assets/Scripts/Avatar/StateController.cs deleted file mode 100644 index 12ba6fe4..00000000 --- a/Assets/Scripts/Avatar/StateController.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 每个角色拥有一个state system -/// </summary> -public class StateController -{ - /// <summary> - /// 当前执行的state - /// </summary> - private StateBase m_Currrent; - - public StateBase Current - { - get - { - return m_Currrent; - } - } - - private List<StateBase> m_States = new List<StateBase>(); - - private UberState m_UberState; - - public StateController() - { - } - - public void ForceStart(StateBase state) - { - if (state == null) - return; - - if (m_Currrent != null) - m_Currrent.OnExit(); - - m_Currrent = state; - m_Currrent.OnEnter(); - } - - public void SetUberState(UberState state) - { - m_UberState = state; - } - - public void AddState(StateBase state) - { - m_States.Add(state); - } - - public void OnUpdate() - { - if(m_Currrent != null) - { - m_Currrent.OnUpdate(); - } - if(m_UberState != null) - { - m_UberState.OnUpdate(); - } - } - - public void OnPhysicsUpdate() - { - if(m_Currrent != null) - { - m_Currrent.OnPhysicsUpdate(); - } - if(m_UberState != null) - { - m_UberState.OnPhysicsUpdate(); - } - } - - public void OnHit(HitInfo info) - { - if (m_Currrent != null) - m_Currrent.OnHit(info); - } - - public void OnHurt(HurtInfo info) - { - if (m_Currrent != null) - m_Currrent.OnHurt(info); - } - - public void SwitchToState(StateBase targetState) - { - if (m_Currrent != null) - m_Currrent.OnExit(); - m_Currrent = targetState; - m_Currrent.OnEnter(); - } - - // 获得当前击打如果有的话 - public Hit GetHit() - { - if (Current == null || !(Current is AttackState)) - return null; - AttackState state = Current as AttackState; - return state.GetHit(); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/StateController.cs.meta b/Assets/Scripts/Avatar/StateController.cs.meta deleted file mode 100644 index 8974eb37..00000000 --- a/Assets/Scripts/Avatar/StateController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4dec6f0208c6e564980e1380ad151233 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States.meta b/Assets/Scripts/Avatar/States.meta deleted file mode 100644 index 4b958769..00000000 --- a/Assets/Scripts/Avatar/States.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 962b8b798c2077c4db88f3828ba14d55 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/AbilityBase.cs b/Assets/Scripts/Avatar/States/AbilityBase.cs deleted file mode 100644 index 4932a3de..00000000 --- a/Assets/Scripts/Avatar/States/AbilityBase.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 同一个角色同一个时间只能有一个state -/// </summary> -public abstract class StateBase -{ - protected int m_StateID; - public int ID - { - get - { - return m_StateID; - } - } - - public StateBase() - { - m_StateID = UIDManager.Acquire(); - } - - public virtual void OnInit() { } - - /// <summary> - /// 进入当前state的回调 - /// </summary> - public virtual void OnEnter() { } - - /// <summary> - /// 退出当前state的回调 - /// </summary> - public virtual void OnExit() { } - - /// <summary> - /// 当前state的update函数 - /// </summary> - public virtual void OnUpdate() { } - - /// <summary> - /// 在物理模拟之后更新 - /// </summary> - public virtual void OnPhysicsUpdate() { } - - /// <summary> - /// 过渡到下一个state的回调 - /// </summary> - /// <param name="to"></param> - public virtual void OnTranslate(StateBase to) { } - - /// <summary> - /// 检测到hitbox碰撞时的回调 - /// </summary> - public virtual void OnHit(HitInfo info) { } - - /// <summary> - /// 检测到hurtbox碰撞时的回调 - /// </summary> - public virtual void OnHurt(HurtInfo info) { } - - /// <summary> - /// 检测到defendbox碰撞时的回调 - /// </summary> - public virtual void OnDefend() { } -} diff --git a/Assets/Scripts/Avatar/States/AbilityBase.cs.meta b/Assets/Scripts/Avatar/States/AbilityBase.cs.meta deleted file mode 100644 index 79a6b7eb..00000000 --- a/Assets/Scripts/Avatar/States/AbilityBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a3b3cfab4bd1dd74bb539687535b58f1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/AttackState.cs b/Assets/Scripts/Avatar/States/AttackState.cs deleted file mode 100644 index 18a20115..00000000 --- a/Assets/Scripts/Avatar/States/AttackState.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public struct AttackStateConfig -{ - public Vector3 velocity; // velocity setup - public int motion; - public Animator animator; - public PhysicsBody body; - public float crossFade; -} - -// 单独的一个招式 -public class AttackState : StateBase -{ - AttackStateConfig m_Config = new AttackStateConfig(); - - private List<Trigger> m_Triggers = new List<Trigger>(); - - private List<Trigger> m_PhysicsTriggers = new List<Trigger>(); - - /// <summary> - /// 这个招式配置的hit - /// </summary> - private List<Hit> m_Hits = new List<Hit>(); - - /// <summary> - /// 从动画结束开始计时 - /// </summary> - float m_TimeCount; - public float ExpireTime - { - get - { - return m_TimeCount; - } - } - - /// <summary> - /// 这个招式的hit个数 - /// </summary> - public int HitCount - { - get - { - return m_Hits != null ? m_Hits.Count : 0; - } - } - - - public AttackState(Animator animator, int animation, PhysicsBody body = null, float crossFade = 0f) - { - m_Config.animator = animator; - m_Config.motion = animation; - m_Config.velocity = Vector3.zero; - m_Config.body = body; - m_Config.crossFade = crossFade; - } - - public AttackState(AttackStateConfig config) - { - m_Config = config; - } - - public override void OnInit() - { - } - - public override void OnDefend() - { - throw new System.NotImplementedException(); - } - - public override void OnEnter() - { - m_TimeCount = 0; - - m_Config.animator.CrossFade(m_Config.motion, m_Config.crossFade); - - if(m_Config.body != null) - { - m_Config.body.LocalVelocity = m_Config.velocity; - } - - foreach(var hit in m_Hits) - { - hit.WipeRecords(); - } - - foreach(var trigger in m_Triggers) - { - trigger.Reset(); - } - } - - public override void OnExit() - { - m_TimeCount = 0; - } - - public override void OnHit(HitInfo info) - { - } - - public override void OnHurt(HurtInfo info) - { - } - - public override void OnTranslate(StateBase to) - { - } - - public override void OnUpdate() - { - AnimatorStateInfo info = m_Config.animator.GetCurrentAnimatorStateInfo(0); - if(info.shortNameHash == m_Config.motion && info.normalizedTime >= 0.99f) - { - m_TimeCount += Time.deltaTime; - } - foreach (var stateTrigger in m_Triggers) - { - if (stateTrigger.Update() && stateTrigger.Swallow) - break; - } - } - - // 在物理模拟之后 - public override void OnPhysicsUpdate() - { - foreach (var trigger in m_PhysicsTriggers) - { - if (trigger.Update() && trigger.Swallow) - break; - } - } - - public void AddTrigger(Trigger trigger) - { - if (trigger == null || m_Triggers.Contains(trigger)) - return; - m_Triggers.Add(trigger); - } - - public void AddPhysicsTrigger(Trigger trigger) - { - if (trigger == null || m_PhysicsTriggers.Contains(trigger)) - return; - m_PhysicsTriggers.Add(trigger); - } - - public void AddHitDefination(HitDefination defination) - { - Hit info = new Hit(); - info.defination = defination; - m_Hits.Add(info); - } - - // 获得当前时间点产生的hit - public Hit GetHit() - { - AnimatorStateInfo info = m_Config.animator.GetCurrentAnimatorStateInfo(0); - float normalizeTime = info.normalizedTime; - for (int i = 0; i< m_Hits.Count; ++i) - { - Hit hit = m_Hits[i]; - float start = hit.defination.start; - float end = hit.defination.end; - if(normalizeTime >= start && normalizeTime <= end) - { - return hit; - } - } - return null; - } - -} diff --git a/Assets/Scripts/Avatar/States/AttackState.cs.meta b/Assets/Scripts/Avatar/States/AttackState.cs.meta deleted file mode 100644 index 4159d2bc..00000000 --- a/Assets/Scripts/Avatar/States/AttackState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eefcc728a2660c0459b0d79230cc4dec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/DashState.cs b/Assets/Scripts/Avatar/States/DashState.cs deleted file mode 100644 index c9237d4c..00000000 --- a/Assets/Scripts/Avatar/States/DashState.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class DashState : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Avatar/States/DashState.cs.meta b/Assets/Scripts/Avatar/States/DashState.cs.meta deleted file mode 100644 index c246c665..00000000 --- a/Assets/Scripts/Avatar/States/DashState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6d5a31f4a65fbba429d0a2ff3b3a49a4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/DodgeState.cs b/Assets/Scripts/Avatar/States/DodgeState.cs deleted file mode 100644 index 58bc9301..00000000 --- a/Assets/Scripts/Avatar/States/DodgeState.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - - -/// <summary> -/// Dodge state -/// </summary> -public class DodgeState : StateBase -{ - public DodgeState() - { - - } - -} diff --git a/Assets/Scripts/Avatar/States/DodgeState.cs.meta b/Assets/Scripts/Avatar/States/DodgeState.cs.meta deleted file mode 100644 index e7297a88..00000000 --- a/Assets/Scripts/Avatar/States/DodgeState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 838e30895704e13479bfb0f5c06229e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/HurtState.cs b/Assets/Scripts/Avatar/States/HurtState.cs deleted file mode 100644 index db48d1a4..00000000 --- a/Assets/Scripts/Avatar/States/HurtState.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 将伤害类型进行分类,决定不同的motion类型 -/// </summary> -public enum HurtType -{ - Light = 0, // 轻击 - Medium, // 中击 - Hard, // 重击 - Back, - Up, - Diagup -} - - -public class HurtState : StateBase -{ - Animator m_Animator; - - int m_AnimHash; - - /// <summary> - /// 在Idle状态时可以切换的state - /// </summary> - private List<Trigger> m_Triggers = new List<Trigger>(); - - public HurtState(Animator animator, int animation) - : base() - { - m_Animator = animator; - m_AnimHash = animation; - } - - public override void OnEnter() - { - m_Animator.CrossFadeInFixedTime(m_AnimHash, 0.25f); - - foreach (var trigger in m_Triggers) - { - trigger.Reset(); - } - } - - public override void OnInit() - { - base.OnInit(); - } - - public override void OnUpdate() - { - foreach (var trigger in m_Triggers) - { - if (trigger.Update() && trigger.Swallow) - break; - } - - base.OnUpdate(); - } - - public void AddTrigger(Trigger trigger) - { - if (trigger == null || m_Triggers.Contains(trigger)) - return; - m_Triggers.Add(trigger); - } - -} diff --git a/Assets/Scripts/Avatar/States/HurtState.cs.meta b/Assets/Scripts/Avatar/States/HurtState.cs.meta deleted file mode 100644 index ba24ef88..00000000 --- a/Assets/Scripts/Avatar/States/HurtState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a7f21d9eef4527249a00204754fbff5b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/IdleState.cs b/Assets/Scripts/Avatar/States/IdleState.cs deleted file mode 100644 index 8b46b904..00000000 --- a/Assets/Scripts/Avatar/States/IdleState.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - - -public class IdleState : StateBase -{ - Animator m_Animator; - - int m_AnimHash; - - /// <summary> - /// 在Idle状态时可以切换的state - /// </summary> - private List<Trigger> m_Triggers = new List<Trigger>(); - - public IdleState(Animator animator, int animation) - : base() - { - m_Animator = animator; - m_AnimHash = animation; - } - - public override void OnEnter() - { - m_Animator.CrossFadeInFixedTime(m_AnimHash, 0.25f); - - foreach (var trigger in m_Triggers) - { - trigger.Reset(); - } - } - - public override void OnInit() - { - base.OnInit(); - } - - public override void OnUpdate() - { - foreach(var trigger in m_Triggers) - { - if (trigger.Update() && trigger.Swallow) - break; - } - - base.OnUpdate(); - } - - public void AddTrigger(Trigger trigger) - { - if (trigger == null || m_Triggers.Contains(trigger)) - return; - m_Triggers.Add(trigger); - } - -} diff --git a/Assets/Scripts/Avatar/States/IdleState.cs.meta b/Assets/Scripts/Avatar/States/IdleState.cs.meta deleted file mode 100644 index f872a5a6..00000000 --- a/Assets/Scripts/Avatar/States/IdleState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5761f8b5c41ec014381b1bd33ad42f1d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/JumpState.cs b/Assets/Scripts/Avatar/States/JumpState.cs deleted file mode 100644 index 1e172358..00000000 --- a/Assets/Scripts/Avatar/States/JumpState.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public struct JumpStateConfig -{ - public PhysicsBody body; - public PhysicsPrimitive collider; - public Animator animator; - - public float neutralJumpSpeedY; // 垂直跳跃的基础速度 - public float fowardJumpSpeedX; // 向前跳跃的水平速度 - public float backwardJumpSpeedX; // 向后跳跃的水平速度(一般来说是负值) - - public int animJump; - public int animNU; - public int animFU; - public int animBU; - public int animND; - public int animFD; - public int animBD; - public int animJumpEnd; - - public bool skipStart; //没有准备动作 -} - -public class JumpState : StateBase -{ - public enum Direction - { - None, - Neutral, - Forward, - Backward - } - - public enum Stage - { - None, - Ready, - Up, - Down, - End, - } - - Direction m_Dir; - - PhysicsBody m_Body; - PhysicsPrimitive m_Collider; - - Animator m_Animator; - - public float m_NeutralJumpSpeedY; // 垂直跳跃的基础速度 - public float m_FowardJumpSpeedX; // 向前跳跃的水平速度 - public float m_BackwardJumpSpeedX; // 向后跳跃的水平速度(一般来说是负值) - - // jump motions - int m_AnimJumpStart; // on ground - int m_AnimJumpNeutralUpwards; - int m_AnimJumpNeutralDownwards; - int m_AnimJumpFwdUpwards; - int m_AnimJumpFwdDownwards; - int m_AnimJumpBackUpwards; - int m_AnimJumpBackDownwards; - int m_AnimJumpEnd; // on ground again - - int m_CurAnim; - Stage m_CurStage; - int m_CurUpMotion; - int m_CurDownMotion; - Vector3 m_CurInitVelocity; - - public Stage CurStage - { - get - { - return m_CurStage; - } - } - - public Direction CurDirection - { - get - { - return m_Dir; - } - } - - private List<Trigger> m_Triggers = new List<Trigger>(); - - bool m_SkipStart; - - public JumpState(JumpStateConfig config) - { - m_Body = config.body; - m_Collider = config.collider; - m_Animator = config.animator; - m_NeutralJumpSpeedY = config.neutralJumpSpeedY; - m_FowardJumpSpeedX = config.fowardJumpSpeedX; - m_BackwardJumpSpeedX = config.backwardJumpSpeedX; - m_AnimJumpStart = config.animJump; - m_AnimJumpNeutralUpwards = config.animNU; - m_AnimJumpNeutralDownwards = config.animND; - m_AnimJumpFwdUpwards = config.animFU; - m_AnimJumpFwdDownwards = config.animFD; - m_AnimJumpBackUpwards = config.animBU; - m_AnimJumpBackDownwards = config.animBD; - m_AnimJumpEnd = config.animJumpEnd; // on ground again - m_SkipStart = config.skipStart; - } - - public void SetDir(Direction dir) - { - m_Dir = dir; - } - - public override void OnEnter() - { - base.OnEnter(); - - m_CurAnim = 0; - - switch(m_Dir) - { - case Direction.Neutral: - m_CurUpMotion = m_AnimJumpNeutralUpwards; - m_CurDownMotion = m_AnimJumpNeutralDownwards; - m_CurInitVelocity = new Vector3(0, m_NeutralJumpSpeedY, 0); - break; - case Direction.Forward: - m_CurUpMotion = m_AnimJumpFwdUpwards; - m_CurDownMotion = m_AnimJumpFwdDownwards; - m_CurInitVelocity = new Vector3(m_FowardJumpSpeedX, m_NeutralJumpSpeedY, 0); - break; - case Direction.Backward: - m_CurUpMotion = m_AnimJumpBackUpwards; - m_CurDownMotion = m_AnimJumpBackDownwards; - m_CurInitVelocity = new Vector3(m_BackwardJumpSpeedX, m_NeutralJumpSpeedY, 0); - break; - } - - bool isOnGround = m_Collider.IsOnGround; - bool isUp = m_Body.Velocity.y > 0; - bool isDown = m_Body.Velocity.y < 0; - bool isFreeFall = Mathf.Approximately(m_Body.Velocity.y, 0); - - if (isOnGround && !m_SkipStart) - m_CurStage = Stage.Ready; - else if (isUp || isOnGround && m_SkipStart) - m_CurStage = Stage.Up; - else if (isDown || isFreeFall) - m_CurStage = Stage.Down; - } - - public override void OnUpdate() - { - foreach (var stateTrigger in m_Triggers) - { - if (stateTrigger.Update() && stateTrigger.Swallow) - return; - } - - AnimatorStateInfo motionInfo = m_Animator.GetCurrentAnimatorStateInfo(0); - - switch (m_CurStage) - { - case Stage.Ready: - if(m_CurAnim != m_AnimJumpStart) - { - m_Animator.CrossFade(m_AnimJumpStart, 0.2f); - m_CurAnim = m_AnimJumpStart; - } - if(motionInfo.shortNameHash == m_AnimJumpStart && motionInfo.normalizedTime >= 1f) - { - m_CurStage = Stage.Up; - } - break; - case Stage.Up: - if(m_CurAnim != m_CurUpMotion) - { - m_Body.LocalVelocity = m_CurInitVelocity; - m_Animator.CrossFade(m_CurUpMotion, 0.05f); - m_CurAnim = m_CurUpMotion; - } - if(m_Body.Velocity.y < 0) - { - m_CurStage = Stage.Down; - } - break; - case Stage.Down: - if(m_CurAnim != m_CurDownMotion) - { - m_Animator.CrossFade(m_CurDownMotion, 0.5f); - m_CurAnim = m_CurDownMotion; - } - if(m_Collider.IsOnGround) - { - m_CurStage = Stage.End; - } - break; - case Stage.End: - if(m_CurAnim != m_AnimJumpEnd) - { - m_Animator.CrossFade(m_AnimJumpEnd, 0.2f); - m_CurAnim = m_AnimJumpEnd; - } - break; - } - } - - public override void OnPhysicsUpdate() - { - base.OnPhysicsUpdate(); - } - - /// <summary> - /// 跳跃准备动作已经完毕 - /// </summary> - /// <returns></returns> - public bool IsJumpReady() - { - if (m_CurAnim != m_AnimJumpStart) - return false; - - AnimatorStateInfo state = m_Animator.GetCurrentAnimatorStateInfo(0); - if (state.shortNameHash == m_CurAnim && state.normalizedTime >= 1f) - return true; - - return false; - } - - /// <summary> - /// 结束 - /// </summary> - /// <returns></returns> - public bool IsJumpDone(float t = 1f) - { - if (m_CurStage == Stage.End) - { - AnimatorStateInfo state = m_Animator.GetCurrentAnimatorStateInfo(0); - return state.shortNameHash == m_AnimJumpEnd && state.normalizedTime >= t; - } - - return false; - } - - /// <summary> - /// 着地 - /// </summary> - /// <returns></returns> - public bool IsJumpGround() - { - return m_CurStage == Stage.End && m_Collider.IsOnGround; - } - - public void AddTrigger(Trigger trigger) - { - if (trigger == null || m_Triggers.Contains(trigger)) - return; - m_Triggers.Add(trigger); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/States/JumpState.cs.meta b/Assets/Scripts/Avatar/States/JumpState.cs.meta deleted file mode 100644 index 3d18db1c..00000000 --- a/Assets/Scripts/Avatar/States/JumpState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3175c1ee1042e144b77c298e7b61eeb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/MoveState.cs b/Assets/Scripts/Avatar/States/MoveState.cs deleted file mode 100644 index 0fbfcddb..00000000 --- a/Assets/Scripts/Avatar/States/MoveState.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MoveState : StateBase -{ - Animator m_Animator; - int m_AnimHash; - - /// <summary> - /// 在跑动状态时可以切换的state - /// </summary> - private List<Trigger> m_Triggers = new List<Trigger>(); - - public MoveState(Animator animator, int animation) - { - m_Animator = animator; - m_AnimHash = animation; - } - - public override void OnInit() - { - - } - - public override void OnDefend() - { - throw new System.NotImplementedException(); - } - - public override void OnEnter() - { - m_Animator.CrossFadeInFixedTime(m_AnimHash, 0.1f); - - foreach (var trigger in m_Triggers) - { - trigger.Reset(); - } - } - - public override void OnExit() - { - } - - public override void OnTranslate(StateBase to) - { - } - - public override void OnUpdate() - { - foreach (var stateTrigger in m_Triggers) - { - if (stateTrigger.Update() && stateTrigger.Swallow) - break; - } - } - - public void AddTrigger(Trigger trigger) - { - if (trigger == null || m_Triggers.Contains(trigger)) - return; - m_Triggers.Add(trigger); - } - -} diff --git a/Assets/Scripts/Avatar/States/MoveState.cs.meta b/Assets/Scripts/Avatar/States/MoveState.cs.meta deleted file mode 100644 index eb1dbbd7..00000000 --- a/Assets/Scripts/Avatar/States/MoveState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae20739ccc918064dbe538d303d4be99 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/States/UberState.cs b/Assets/Scripts/Avatar/States/UberState.cs deleted file mode 100644 index a0b6d940..00000000 --- a/Assets/Scripts/Avatar/States/UberState.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 一个角色只能有一个uber state,用来处理状态的自动切换 -public abstract class UberState : StateBase -{ - public abstract void OnUpdate(); - - public abstract void OnPhysicsUpdate(); - -} diff --git a/Assets/Scripts/Avatar/States/UberState.cs.meta b/Assets/Scripts/Avatar/States/UberState.cs.meta deleted file mode 100644 index b36ffc94..00000000 --- a/Assets/Scripts/Avatar/States/UberState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eafda132ea825cc46b32edfe09ebdecc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Trigger.cs b/Assets/Scripts/Avatar/Trigger.cs deleted file mode 100644 index a885327c..00000000 --- a/Assets/Scripts/Avatar/Trigger.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public enum TriggerOnlyOnce -{ - Off = 0, - On = 1, -} - -public enum TriggerSwallow -{ - Off = 0, - On = 1 -} - - -/// <summary> -/// 不同效果的trigger继承这个基类 -/// </summary> - -public sealed class Trigger -{ - private TriggerSwallow m_Swallow; - public bool Swallow - { - get - { - return m_Swallow == TriggerSwallow.On; - } - } - - private ConditionBase m_Condition; - private List<ActionBase> m_ActionChain = new List<ActionBase>();
-
- private TriggerOnlyOnce m_OnlyOnce; - - private bool m_IsTriggered; - - public Trigger(ConditionBase condition, List<ActionBase> actions, TriggerOnlyOnce onlyOnce = TriggerOnlyOnce.Off, TriggerSwallow swallow = TriggerSwallow.On) - { - m_OnlyOnce = onlyOnce;
- m_Swallow = swallow; - m_Condition = condition; - m_ActionChain.AddRange(actions); - } - public Trigger(ConditionBase condition, ActionBase action, TriggerOnlyOnce onlyOnce = TriggerOnlyOnce.Off, TriggerSwallow swallow = TriggerSwallow.On) - { - m_OnlyOnce = onlyOnce;
- m_Swallow = swallow; - m_Condition = condition; - m_ActionChain.Add(action); - } - - //重置触发器的参数 - public void Reset() - { - m_IsTriggered = false; - } - - /// <summary> - /// 如果触发执行了,返回true,否则返回false - /// </summary> - /// <returns></returns> - public bool Update() - { - if (m_IsTriggered && m_OnlyOnce == TriggerOnlyOnce.On) - return false; - if (m_Condition.Evaluate()) - { - foreach(var action in m_ActionChain) - { - action.Execute(); - } - m_IsTriggered = true; - return true; - } - return false; - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Avatar/Trigger.cs.meta b/Assets/Scripts/Avatar/Trigger.cs.meta deleted file mode 100644 index 91d7d1b8..00000000 --- a/Assets/Scripts/Avatar/Trigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8c2bda4ac997ddc4e8e9e38c7c718882 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Camera.meta b/Assets/Scripts/Camera.meta deleted file mode 100644 index 139bddae..00000000 --- a/Assets/Scripts/Camera.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 10934c4669147044897200abc6f23a05 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Camera/CameraUtility.cs b/Assets/Scripts/Camera/CameraUtility.cs deleted file mode 100644 index 1f6c10e6..00000000 --- a/Assets/Scripts/Camera/CameraUtility.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public static class CameraExtend
-{
-
- public static Vector3 WorldToCameraSpace(this Camera camera, Vector3 worldPos)
- {
- Vector4 camPos = camera.worldToCameraMatrix * worldPos.ToVector4();
- return camPos.ToVector3();
- }
-
- public static Vector3 CameraToViewportSpace(this Camera camera, Vector3 camPos)
- {
- Matrix4x4 proj = GL.GetGPUProjectionMatrix(camera.projectionMatrix, false);
- Vector4 clipPos = proj * camPos.ToVector4();
- Vector3 ndcPos = (clipPos / clipPos.w);
- Vector3 viewPos = (ndcPos + Vector3.one) / 2f;
- return viewPos;
- }
-
- public static Vector3 CameraToScreenSpace(this Camera camera, Vector3 camPos)
- {
- Vector3 viewPos = camera.CameraToViewportSpace(camPos);
- Vector3 screenPos = new Vector3(
- viewPos.x * camera.pixelWidth,
- viewPos.y * camera.pixelHeight,
- viewPos.z
- );
- return screenPos;
- }
-
-}
-
-public class CameraUtility : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Camera/CameraUtility.cs.meta b/Assets/Scripts/Camera/CameraUtility.cs.meta deleted file mode 100644 index bd11b826..00000000 --- a/Assets/Scripts/Camera/CameraUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6797331b02de5684ab22aeafac41d2c5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Camera/MainCamera.cs b/Assets/Scripts/Camera/MainCamera.cs deleted file mode 100644 index 4d65fa18..00000000 --- a/Assets/Scripts/Camera/MainCamera.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 主相机 -[ExecuteAlways] -[RequireComponent(typeof(Camera))] -public class MainCamera : SingletonMB<MainCamera> -{ - #region inspector - [Serializable] - public struct Region - { - [SerializeField] public float l; - [SerializeField] public float r; - [SerializeField] public float t; - [SerializeField] public float b; - } - - public new Camera camera { get; private set; } - - public Vector3 offset = Vector3.zero; - - [SerializeField] private float z; - - [SerializeField] private Region region; - - [SerializeField] private float moveSpeed; - - [SerializeField] private AnimationCurve speedCurve; - - [SerializeField] private float threshold; - #endregion - - private CustomRenderingPipeline m_CustomRenderingPipeline; - public CustomRenderingPipeline customRenderingPipeline
- { - get - { - if (m_CustomRenderingPipeline == null)
- m_CustomRenderingPipeline = this.gameObject.GetOrAddComponent<CustomRenderingPipeline>(); - return m_CustomRenderingPipeline; - } - } - - private Vector2 position2D - { - get - { - return transform.position; - } - set - { - transform.position = new Vector3(value.x, value.y, transform.position.z); - } - } - - private Vector3 position - { - get - { - return transform.position; - } - set - { - transform.position = value; - } - } - - protected override void Awake() - { - base.Awake(); - camera = gameObject.GetComponent<Camera>(); - } - - private void Start() - { - Vector3 pos = transform.position; - pos.z = this.z; - transform.position = pos; - - Quaternion rot = Quaternion.LookRotation(Vector3.forward); - transform.rotation = rot; - } - - void FollowPlayerCharacter() - { - if (UnitManager.Instance == null || UnitManager.Instance.pc == null) - return; - - Region region = this.region; - - //if (!UnitManager.Instance.pc.isTowardRight) - //{ - // region.l = -this.region.r; - // region.r = -this.region.l; - //} - - Vector3 camPos = position; - - Vector3 worldPos = UnitManager.Instance.pc.transform.position + offset; - - Vector2 viewPos = ((Vector2)camera.WorldToViewportPoint(worldPos)) * 2 - Vector2.one; - - Vector3 dir = (worldPos - camPos).normalized; - float dest = (worldPos - camPos).magnitude; - float curve = speedCurve.Evaluate((threshold - Mathf.Clamp(dest, 0f, threshold)) / threshold); - Vector3 move = curve * dir * moveSpeed * Time.deltaTime; - - if (IsInRegion(viewPos, region)) - { - if(!IsInCenter(viewPos)) - { - position2D = camPos + move; - if((worldPos - position).magnitude <= 0.1f) - { - position2D = worldPos; - } - } - return; - } - position2D = camPos + move; - if ((worldPos - position).magnitude <= 0.1f) - { - position2D = worldPos; - } - } - - bool IsInRegion(Vector2 p, Region region) - { - return p.x > region.l - && p.x < region.r - && p.y > region.b - && p.y < region.t; - } - - bool IsInCenter(Vector2 p) - { - return p.x == (region.l + region.r) / 2 && p.y == (region.t + region.b) / 2; - } - - void Update() - { - FollowPlayerCharacter(); - } - - public void OnGUI() - { - if(MainCameraDebug.OnGUIHandlers != null) - MainCameraDebug.OnGUIHandlers.Invoke(); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Camera/MainCamera.cs.meta b/Assets/Scripts/Camera/MainCamera.cs.meta deleted file mode 100644 index 1ad6678e..00000000 --- a/Assets/Scripts/Camera/MainCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 68da209687f0dcc49967a423b26c204c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Camera/MainCameraDebug.cs b/Assets/Scripts/Camera/MainCameraDebug.cs deleted file mode 100644 index 7a8382ee..00000000 --- a/Assets/Scripts/Camera/MainCameraDebug.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MainCameraDebug -{ - public static Action OnGUIHandlers; - -} diff --git a/Assets/Scripts/Camera/MainCameraDebug.cs.meta b/Assets/Scripts/Camera/MainCameraDebug.cs.meta deleted file mode 100644 index 71e9cdb8..00000000 --- a/Assets/Scripts/Camera/MainCameraDebug.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 31f8e21379e822447b55a74c799469f6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Curve3D.meta b/Assets/Scripts/Curve3D.meta deleted file mode 100644 index fef1c5e7..00000000 --- a/Assets/Scripts/Curve3D.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad8b718b6b700d8419838dad07158567 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta deleted file mode 100644 index ba55f9b7..00000000 --- a/Assets/Scripts/Data.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d9a2eb51c010ce04997157e6eae03108 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Data/EnumDefine.cs b/Assets/Scripts/Data/EnumDefine.cs deleted file mode 100644 index 77519c60..00000000 --- a/Assets/Scripts/Data/EnumDefine.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - - -// unit image effect枚举 -public enum EImageEffectMaterails -{ - MotionBlur, - Glitch, - ColorDrift, -} - -public enum EShader -{ - Blur, - MotionBlur, - Buzz, - - SolidColor, - GBuffer, - - UnitDepth, - -} - diff --git a/Assets/Scripts/Data/EnumDefine.cs.meta b/Assets/Scripts/Data/EnumDefine.cs.meta deleted file mode 100644 index a8332e9b..00000000 --- a/Assets/Scripts/Data/EnumDefine.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e8e2ae14bb9405d47a5b2ff142dcff1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Data/StaticDefine.cs b/Assets/Scripts/Data/StaticDefine.cs deleted file mode 100644 index dcfb19e1..00000000 --- a/Assets/Scripts/Data/StaticDefine.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public static class StaticDefine
-{
- // unit image用到的材质
- public static Dictionary<EImageEffectMaterails, string/*path*/> imageEffectMaterails = new Dictionary<EImageEffectMaterails, string>() {
- { EImageEffectMaterails.MotionBlur, "Assets/Bundle/Materials/Unit/ImageEffect/unit_img_motion_blur.mat"},
- { EImageEffectMaterails.Glitch, "Assets/Bundle/Materials/Unit/ImageEffect/unit_img_glitch.mat"},
- };
-
-
- public struct ShaderDefine
- {
- public ShaderDefine(string n, string p) { name = n; path = p; }
- public string name;
- public string path;
- }
- public static Dictionary<EShader, ShaderDefine> shaders = new Dictionary<EShader, ShaderDefine> {
- { EShader.Blur, new ShaderDefine("Erika/Common/Image/Blur", "")},
- { EShader.MotionBlur, new ShaderDefine("Erika/Common/Image/MotionBlur", "")},
- { EShader.SolidColor, new ShaderDefine("Erika/Common/SolidColor", "") },
- { EShader.UnitDepth, new ShaderDefine("Erika/Unit/Common/Depth", "") },
- { EShader.Buzz, new ShaderDefine("Erika/Common/Image/Buzz", "") },
- { EShader.GBuffer, new ShaderDefine("Erika/Common/GBuffer", "") },
- };
-
- public static string bundleManifest = "bundles"; // Assets/Resources/bundles.json
-
-}
diff --git a/Assets/Scripts/Data/StaticDefine.cs.meta b/Assets/Scripts/Data/StaticDefine.cs.meta deleted file mode 100644 index 66d5548c..00000000 --- a/Assets/Scripts/Data/StaticDefine.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f35e2b3e198e76f4e9194191af049cbc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Drone.meta b/Assets/Scripts/Drone.meta deleted file mode 100644 index 694cff70..00000000 --- a/Assets/Scripts/Drone.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ec3412151f8a72a41b2ed21316763399 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Editor.meta b/Assets/Scripts/Editor.meta deleted file mode 100644 index b8bb2b0e..00000000 --- a/Assets/Scripts/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c08fbb77c6ad1ed4c9499d0fcb73773f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Editor/InspectorUtility.cs b/Assets/Scripts/Editor/InspectorUtility.cs deleted file mode 100644 index 5c1e6e05..00000000 --- a/Assets/Scripts/Editor/InspectorUtility.cs +++ /dev/null @@ -1,169 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections.Generic; -using System.IO; - -/// <summary> -/// Collection of tools and helpers for drawing inspectors -/// </summary> -public class InspectorUtility -{ - /// <summary>Put multiple properties on a single inspector line, with - /// optional label overrides. Passing null as a label (or sublabel) override will - /// cause the property's displayName to be used as a label. For no label at all, - /// pass GUIContent.none.</summary> - /// <param name="rect">Rect in which to draw</param> - /// <param name="label">Main label</param> - /// <param name="props">Properties to place on the line</param> - /// <param name="subLabels">Sublabels for the properties</param> - public static void MultiPropertyOnLine( - Rect rect, - GUIContent label, - SerializedProperty[] props, GUIContent[] subLabels) - { - if (props == null || props.Length == 0) - return; - - const int hSpace = 2; - int indentLevel = EditorGUI.indentLevel; - float labelWidth = EditorGUIUtility.labelWidth; - - float totalSubLabelWidth = 0; - int numBoolColumns = 0; - List<GUIContent> actualLabels = new List<GUIContent>(); - for (int i = 0; i < props.Length; ++i) - { - GUIContent sublabel = new GUIContent(props[i].displayName, props[i].tooltip); - if (subLabels != null && subLabels.Length > i && subLabels[i] != null) - sublabel = subLabels[i]; - actualLabels.Add(sublabel); - totalSubLabelWidth += GUI.skin.label.CalcSize(sublabel).x; - if (i > 0) - totalSubLabelWidth += hSpace; - // Special handling for toggles, or it looks stupid - if (props[i].propertyType == SerializedPropertyType.Boolean) - { - totalSubLabelWidth += rect.height; - ++numBoolColumns; - } - } - - float subFieldWidth = rect.width - labelWidth - totalSubLabelWidth; - float numCols = props.Length - numBoolColumns; - float colWidth = numCols == 0 ? 0 : subFieldWidth / numCols; - - // Main label. If no first sublabel, then main label must take on that - // role, for mouse dragging value-scrolling support - int subfieldStartIndex = 0; - if (label == null) - label = new GUIContent(props[0].displayName, props[0].tooltip); - if (actualLabels[0] != GUIContent.none) - rect = EditorGUI.PrefixLabel(rect, label); - else - { - rect.width = labelWidth + colWidth; - EditorGUI.PropertyField(rect, props[0], label); - rect.x += rect.width + hSpace; - subfieldStartIndex = 1; - } - - for (int i = subfieldStartIndex; i < props.Length; ++i) - { - EditorGUI.indentLevel = 0; - EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(actualLabels[i]).x; - if (props[i].propertyType == SerializedPropertyType.Boolean) - { - rect.width = EditorGUIUtility.labelWidth + rect.height; - props[i].boolValue = EditorGUI.ToggleLeft(rect, actualLabels[i], props[i].boolValue); - } - else - { - rect.width = EditorGUIUtility.labelWidth + colWidth; - EditorGUI.PropertyField(rect, props[i], actualLabels[i]); - } - rect.x += rect.width + hSpace; - } - - EditorGUIUtility.labelWidth = labelWidth; - EditorGUI.indentLevel = indentLevel; - } - - /// <summary> - /// Normalize a curve so that each of X and Y axes ranges from 0 to 1 - /// </summary> - /// <param name="curve">Curve to normalize</param> - /// <returns>The normalized curve</returns> - public static AnimationCurve NormalizeCurve(AnimationCurve curve) - { - Keyframe[] keys = curve.keys; - if (keys.Length > 0) - { - float minTime = keys[0].time; - float maxTime = minTime; - float minVal = keys[0].value; - float maxVal = minVal; - for (int i = 0; i < keys.Length; ++i) - { - minTime = Mathf.Min(minTime, keys[i].time); - maxTime = Mathf.Max(maxTime, keys[i].time); - minVal = Mathf.Min(minVal, keys[i].value); - maxVal = Mathf.Max(maxVal, keys[i].value); - } - float range = maxTime - minTime; - float timeScale = range < 0.0001f ? 1 : 1 / range; - range = maxVal - minVal; - float valScale = range < 1 ? 1 : 1 / range; - float valOffset = 0; - if (range < 1) - { - if (minVal > 0 && minVal + range <= 1) - valOffset = minVal; - else - valOffset = 1 - range; - } - for (int i = 0; i < keys.Length; ++i) - { - keys[i].time = (keys[i].time - minTime) * timeScale; - keys[i].value = ((keys[i].value - minVal) * valScale) + valOffset; - } - curve.keys = keys; - } - return curve; - } - - /// <summary> - /// Remove the "Cinemachine" prefix, then call the standard Unity Nicify. - /// </summary> - /// <param name="name">The name to nicify</param> - /// <returns>The nicified name</returns> - public static string NicifyClassName(string name) - { - if (name.StartsWith("Cinemachine")) - name = name.Substring(11); // Trim the prefix - return ObjectNames.NicifyVariableName(name); - } - - // Temporarily here - /// <summary> - /// Create a game object. Uses ObjectFactory if the Unity version is sufficient. - /// </summary> - /// <param name="name">Name to give the object</param> - /// <param name="types">Optional components to add</param> - /// <returns></returns> - public static GameObject CreateGameObject(string name, params Type[] types) - { - return ObjectFactory.CreateGameObject(name, types); - } - - /// <summary> - /// Force a repaint of the Game View - /// </summary> - /// <param name="unused">Like it says</param> - public static void RepaintGameView(UnityEngine.Object unused = null) - { - EditorApplication.QueuePlayerLoopUpdate(); - UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); - } - -} diff --git a/Assets/Scripts/Editor/InspectorUtility.cs.meta b/Assets/Scripts/Editor/InspectorUtility.cs.meta deleted file mode 100644 index f2152bda..00000000 --- a/Assets/Scripts/Editor/InspectorUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae9f2927fa60f654889df3571b579c86 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Editor/MainCameraEditor.cs b/Assets/Scripts/Editor/MainCameraEditor.cs deleted file mode 100644 index f2ad9479..00000000 --- a/Assets/Scripts/Editor/MainCameraEditor.cs +++ /dev/null @@ -1,42 +0,0 @@ -using UnityEditor; - -[CustomEditor(typeof(MainCamera))] -public class MainCameraEditor : Editor -{ - - private void OnEnable() - { - MainCameraDebug.OnGUIHandlers -= OnGameViewGUI; - MainCameraDebug.OnGUIHandlers += OnGameViewGUI; - } - - private void OnDisable() - { - MainCameraDebug.OnGUIHandlers -= OnGameViewGUI; - - InspectorUtility.RepaintGameView(); - } - - public override void OnInspectorGUI() - { - base.OnInspectorGUI(); - } - - private void OnGameViewGUI() - { - MainCamera camera = target as MainCamera; - if (camera == null) - return; - - //Matrix4x4 oldMatrix = GUI.matrix; - //Rect cameraRect = new Rect(0, 0, 500, 500); - - //GUI.matrix = Matrix4x4.Translate(cameraRect.min); - - ////GUILayout.Button("test"); - //GUI.DrawTexture(new Rect(0, 0, 30, 30), Texture2D.whiteTexture); - - //GUI.matrix = oldMatrix; - } - -} diff --git a/Assets/Scripts/Editor/MainCameraEditor.cs.meta b/Assets/Scripts/Editor/MainCameraEditor.cs.meta deleted file mode 100644 index 76d6d4b1..00000000 --- a/Assets/Scripts/Editor/MainCameraEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eeb2aab4ac403f9429e87defed16c4a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects.meta b/Assets/Scripts/Effects.meta deleted file mode 100644 index 45ac8211..00000000 --- a/Assets/Scripts/Effects.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ddebb1c07b675c348b53394c5f7fe7da -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/AfterImage.meta b/Assets/Scripts/Effects/AfterImage.meta deleted file mode 100644 index 4d4c324a..00000000 --- a/Assets/Scripts/Effects/AfterImage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d16ac0401b1e91a4fa81ceec42b004d8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/AfterImage/AfterImage.cs b/Assets/Scripts/Effects/AfterImage/AfterImage.cs deleted file mode 100644 index 7f40e119..00000000 --- a/Assets/Scripts/Effects/AfterImage/AfterImage.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class AfterImage : MonoBehaviour -{ - public Animator myAnimator; - //public CharacterControl myCharacterControl; - public Renderer[] myRenderers; - - public Animator targetAnimator; - public GameObject targetObject; - - public float time; - public float intensity; - public float pow; - public float timeMax = 45; - - public bool active; - - // Use this for initialization - void Start() - { - //targetObject = - } - - // Update is called once per frame - void Update() - { - if (time > 0) - { - time--; - active = true; - intensity = (time / timeMax) * 10 * pow; - UpdateRenderer(); - } - else - { - active = false; - intensity = 0; - this.transform.gameObject.SetActive(false); - } - } - - void UpdateRenderer() - { - foreach(var renderer in myRenderers)
- {
- for(int i = 0;i < renderer.materials.Length; ++i)
- {
- renderer.materials[i].SetFloat("_Intensity", intensity);
- renderer.materials[i].SetFloat("_MKGlowPower", intensity); - } - }
- } - - public void Activate() - { - active = true; - transform.position = targetObject.transform.position; - transform.localScale = targetObject.transform.lossyScale; - transform.rotation = targetObject.transform.rotation; - transform.gameObject.SetActive(true); - - myAnimator.Play(targetAnimator.GetCurrentAnimatorStateInfo(0).shortNameHash, 0, targetAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime); - - myAnimator.speed = 0.02f; - myAnimator.Update(1/60f); - time = timeMax + 1; - Update(); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Effects/AfterImage/AfterImage.cs.meta b/Assets/Scripts/Effects/AfterImage/AfterImage.cs.meta deleted file mode 100644 index cd1fd19a..00000000 --- a/Assets/Scripts/Effects/AfterImage/AfterImage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5912e1e5f1e32ea429bf6a9ec2d11a0f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs b/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs deleted file mode 100644 index 38d3488d..00000000 --- a/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class AfterImagePool : MonoBehaviour -{ - public static AfterImagePool Instance;
-
- //public CharacterControl myCharacterControl;
- public GameObject targetObject; //Set these manually to the character object you're copying - public Animator targetAnimator; //Set these manually to the character object you're copying - public GameObject prefab; //This is the prefab you made in the scene. It's a parent transform with an animator and AfterImage script on it, with Armature and SkinnedMeshRenderer children - public int poolSize = 10; - public List<AfterImage> afterImages; - - public int interval = 10; - - public int time = 0; - - private bool isActive = false; - - // Use this for initialization - void Start() - { - afterImages = new List<AfterImage>(poolSize); - for (int i = 0; i < poolSize; i++) - { - GameObject nextAfterImage = Instantiate(prefab); - nextAfterImage.transform.SetParent(this.transform); -
- nextAfterImage.GetComponent<AfterImage>().targetObject = targetObject; //Game Object Target - nextAfterImage.GetComponent<AfterImage>().targetAnimator = targetAnimator; //Animator Target
-
- nextAfterImage.SetActive(false);
-
- afterImages.Add(nextAfterImage.GetComponent<AfterImage>());
- }
- Instance = this;
- } - - // Update is called once per frame - void Update() - { - if (!isActive) - return; - - time++; - if (time >= interval)
- {
- time = 0;
- AddAfterImage();
- } - } - - void AddAfterImage() - { - for (int i = 0; i < poolSize; i++) - { - if (!afterImages[i].active)
- {
- afterImages[i].Activate();
- break;
- } - } - } - - public void Activate(bool isActive)
- {
- this.isActive = isActive;
- time = isActive ? interval : 0;
- } - - public void SetInterval(int interval)
- {
- this.interval = interval;
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs.meta b/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs.meta deleted file mode 100644 index 78d84907..00000000 --- a/Assets/Scripts/Effects/AfterImage/AfterImagePool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4aaea939b0abb3c4eb78963aedf4b2f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/AfterImageEffects.cs b/Assets/Scripts/Effects/AfterImageEffects.cs deleted file mode 100644 index e6dd57e7..00000000 --- a/Assets/Scripts/Effects/AfterImageEffects.cs +++ /dev/null @@ -1,186 +0,0 @@ -// using UnityEngine;
-//using System.Collections;
-//using System.Collections.Generic;
-///// <summary>
-///// 残影特效
-///// </summary>
-//public class AfterImageEffects : MonoBehaviour
-//{
-
-// public Material[] materials = new Material[8];
-
-// //开启残影
-// public bool _OpenAfterImage;
-
-// //残影颜色
-// public Color _AfterImageColor = Color.black;
-// //残影的生存时间
-// public float _SurvivalTime = 1;
-// //生成残影的间隔时间
-// public float _IntervalTime = 0.2f;
-// private float _Time = 0;
-// //残影初始透明度
-// [Range(0.1f, 1.0f)]
-// public float _InitialAlpha = 1.0f;
-
-// private List<AfterImage> _AfterImageList;
-// private SkinnedMeshRenderer _SkinnedMeshRenderer;
-
-// void Awake()
-// {
-// _AfterImageList = new List<AfterImage>();
-// _SkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
-// }
-// void Update()
-// {
-// if (_OpenAfterImage && _AfterImageList != null)
-// {
-// if (_SkinnedMeshRenderer == null)
-// {
-// _OpenAfterImage = false;
-// return;
-// }
-
-// _Time += Time.deltaTime;
-// //生成残影
-// CreateAfterImage();
-// //刷新残影
-// UpdateAfterImage();
-// }
-// }
-// /// <summary>
-// /// 生成残影
-// /// </summary>
-// void CreateAfterImage()
-// {
-// //生成残影
-// if (_Time >= _IntervalTime)
-// {
-// _Time = 0;
-
-// Mesh mesh = new Mesh();
-// _SkinnedMeshRenderer.BakeMesh(mesh);
-
-// Material material = new Material(_SkinnedMeshRenderer.material);
-// // SetMaterialRenderingMode(material, RenderingMode.Fade);
-
-// _AfterImageList.Add(new AfterImage(
-// mesh,
-// material,
-// transform.localToWorldMatrix,
-// _InitialAlpha,
-// Time.realtimeSinceStartup,
-// _SurvivalTime));
-// }
-// }
-// /// <summary>
-// /// 刷新残影
-// /// </summary>
-// void UpdateAfterImage()
-// {
-// //刷新残影,根据生存时间销毁已过时的残影
-// for (int i = 0; i < _AfterImageList.Count; i++)
-// {
-// float _PassingTime = Time.realtimeSinceStartup - _AfterImageList[i]._StartTime;
-
-// if (_PassingTime > _AfterImageList[i]._Duration)
-// {
-// _AfterImageList.Remove(_AfterImageList[i]);
-// Destroy(_AfterImageList[i]);
-// continue;
-// }
-
-// if (_AfterImageList[i]._Material.HasProperty("_Color"))
-// {
-// _AfterImageList[i]._Alpha *= (1 - _PassingTime / _AfterImageList[i]._Duration);
-// _AfterImageColor.a = _AfterImageList[i]._Alpha;
-// // _AfterImageList[i]._Material.SetColor("_Color", _AfterImageColor);
-// }
-
-// // 绘制submesh
-// for(int j = 0; j < _AfterImageList[i]._Mesh.subMeshCount; ++j)
-// {
-// if (j >= 4) continue;
-// Graphics.DrawMesh(_AfterImageList[i]._Mesh, _AfterImageList[i]._Matrix, /*_AfterImageList[i]._Material*/materials[j], gameObject.layer, null, j);
-// }
-// }
-// }
-// /// <summary>
-// /// 设置纹理渲染模式
-// /// </summary>
-// void SetMaterialRenderingMode(Material material, RenderingMode renderingMode)
-// {
-// switch (renderingMode)
-// {
-// case RenderingMode.Opaque:
-// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
-// material.SetInt("_ZWrite", 1);
-// material.DisableKeyword("_ALPHATEST_ON");
-// material.DisableKeyword("_ALPHABLEND_ON");
-// material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-// material.renderQueue = -1;
-// break;
-// case RenderingMode.Cutout:
-// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
-// material.SetInt("_ZWrite", 1);
-// material.EnableKeyword("_ALPHATEST_ON");
-// material.DisableKeyword("_ALPHABLEND_ON");
-// material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-// material.renderQueue = 2450;
-// break;
-// case RenderingMode.Fade:
-// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
-// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
-// material.SetInt("_ZWrite", 0);
-// material.DisableKeyword("_ALPHATEST_ON");
-// material.EnableKeyword("_ALPHABLEND_ON");
-// material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-// material.renderQueue = 3000;
-// break;
-// case RenderingMode.Transparent:
-// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
-// material.SetInt("_ZWrite", 0);
-// material.DisableKeyword("_ALPHATEST_ON");
-// material.DisableKeyword("_ALPHABLEND_ON");
-// material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
-// material.renderQueue = 3000;
-// break;
-// }
-// }
-//}
-//public enum RenderingMode
-//{
-// Opaque,
-// Cutout,
-// Fade,
-// Transparent,
-//}
-//class AfterImage : Object
-//{
-// //残影网格
-// public Mesh _Mesh;
-// //残影纹理
-// public Material _Material;
-// //残影位置
-// public Matrix4x4 _Matrix;
-// //残影透明度
-// public float _Alpha;
-// //残影启动时间
-// public float _StartTime;
-// //残影保留时间
-// public float _Duration;
-
-// public AfterImage(Mesh mesh, Material material, Matrix4x4 matrix4x4, float alpha, float startTime, float duration)
-// {
-// _Mesh = mesh;
-// _Material = material;
-// _Matrix = matrix4x4;
-// _Alpha = alpha;
-// _StartTime = startTime;
-// _Duration = duration;
-// }
-
-//}
\ No newline at end of file diff --git a/Assets/Scripts/Effects/AfterImageEffects.cs.meta b/Assets/Scripts/Effects/AfterImageEffects.cs.meta deleted file mode 100644 index f2bd3581..00000000 --- a/Assets/Scripts/Effects/AfterImageEffects.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3f9a1194f9a331f41b8f32865ba192bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/CharacterGhostEffect.cs b/Assets/Scripts/Effects/CharacterGhostEffect.cs deleted file mode 100644 index d422c0a7..00000000 --- a/Assets/Scripts/Effects/CharacterGhostEffect.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class CharacterGhostEffect : EffectHandler -{ - [Tooltip("目标skinMeshRenderer")] - public SkinnedMeshRenderer m_Renderer; - - [Tooltip("如果mesh包含多个submesh,需要每个submesh单独设置一个材质")] - public Material[] Materials; - - [Tooltip("Submesh是否使用同一个材质")] - public bool SubmeshShareMaterial; - - [Tooltip("使用范围内的submesh")] - public bool UseRangedSubmesh; - - [Tooltip("Submesh索引范围")] - public Vector2Int SubmeshRange; - - [Tooltip("是否开启残影效果")] - public bool IsEnable; - - [Tooltip("残影生成的时间间隔")] - public float Interval = 0.1f; - - [Tooltip("残影的生存时间")] - public float LifeTime = 0.5f; - - private float m_Time = 0; - private List<GhostSnapshot> m_Ghosts = new List<GhostSnapshot>(); - - void Update() - { - //if (!IsEnable) - //{ - // if (m_Ghosts.Count > 0) - // UpdateGhost(); // destroy ghosts - // return; - //} - - if (m_Ghosts == null || m_Renderer == null || Materials == null || Materials.Length == 0) - { - IsEnable = false; - return; - } - - m_Time += Time.deltaTime; - - //if(IsEnable) - // CreateGhost(); - - UpdateGhost(); - DrawGhost(); - } - - public void CreateGhost() - { - if(m_Time >= Interval) - { - m_Time -= Interval; - - Mesh mesh = new Mesh(); - m_Renderer.BakeMesh(mesh); - - Matrix4x4 mat = m_Renderer.localToWorldMatrix; - - m_Ghosts.Add(new GhostSnapshot(mesh, mat, Time.realtimeSinceStartup, LifeTime)); - } - } - - void UpdateGhost() - { - for(int i = m_Ghosts.Count - 1; i >= 0 ; --i) - { - GhostSnapshot ghost = m_Ghosts[i]; - float passTime = Time.realtimeSinceStartup - ghost.startTime; - - if (passTime > ghost.lifeTime) - { - m_Ghosts.Remove(ghost); - Destroy(ghost); - continue; - } - } - } - - void DrawGhost() - { - for(int i = 0; i < m_Ghosts.Count; ++ i) - { - GhostSnapshot ghost = m_Ghosts[i]; - int start = 0, end = ghost.mesh.subMeshCount - 1; - if(UseRangedSubmesh) - { - start = SubmeshRange.x; - end = SubmeshRange.y; - } - for (int j = start; j <= end; ++j) - { - Material material; - if (SubmeshShareMaterial) - material = Materials[0]; - else - material = Materials[j - start]; - Graphics.DrawMesh(ghost.mesh, ghost.matrix, material, gameObject.layer, null, j); - } - } - } -} - -class GhostSnapshot : Object -{ - public Mesh mesh; - public Matrix4x4 matrix; - public float startTime; - public float lifeTime; - - public GhostSnapshot(Mesh mesh, Matrix4x4 mat, float startTime, float lifeTime) - { - this.mesh = mesh; - this.matrix = mat; - this.startTime = startTime; - this.lifeTime = lifeTime; - } -} diff --git a/Assets/Scripts/Effects/CharacterGhostEffect.cs.meta b/Assets/Scripts/Effects/CharacterGhostEffect.cs.meta deleted file mode 100644 index 9a1f3a3a..00000000 --- a/Assets/Scripts/Effects/CharacterGhostEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 76b355b49906df24cac5ccfb0de69331 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/Effect.cs b/Assets/Scripts/Effects/Effect.cs deleted file mode 100644 index a8f0d37f..00000000 --- a/Assets/Scripts/Effects/Effect.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Effect : MonoBehaviour
-{
- public string Name;
- public float LifeTime;
-
- private float time;
-
- private void Awake()
- {
- }
-
- private void OnEnable()
- {
- time = 0;
- }
-
- private void Update()
- {
- time += Time.deltaTime;
- if(time > LifeTime)
- {
- EffectsManager.Instance.CycleEffect(this);
- }
- }
-
-}
diff --git a/Assets/Scripts/Effects/Effect.cs.meta b/Assets/Scripts/Effects/Effect.cs.meta deleted file mode 100644 index ea99b00a..00000000 --- a/Assets/Scripts/Effects/Effect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a0f48b3d527ef6c49999e8a4b9892cd9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/EffectHandler.cs b/Assets/Scripts/Effects/EffectHandler.cs deleted file mode 100644 index 265a1001..00000000 --- a/Assets/Scripts/Effects/EffectHandler.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class EffectHandler : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Effects/EffectHandler.cs.meta b/Assets/Scripts/Effects/EffectHandler.cs.meta deleted file mode 100644 index 81ee0c34..00000000 --- a/Assets/Scripts/Effects/EffectHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 83576b34fc8f74048a5c050c30ab463f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/EffectsManager.cs b/Assets/Scripts/Effects/EffectsManager.cs deleted file mode 100644 index f62b0bdb..00000000 --- a/Assets/Scripts/Effects/EffectsManager.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using System;
-
-public class EffectsManager : MonoBehaviour
-{
- public static EffectsManager Instance;
-
- public Effect[] EffectTemplates;
-
- public Transform Root_Pool;
-
- List<Effect> m_Pool = new List<Effect>();
-
- private void Awake()
- {
- Instance = this;
- }
-
- Effect GetEffectTemplate(string name)
- {
- foreach(var effect in EffectTemplates)
- {
- if(effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- Effect RecycleEffect(string name)
- {
- foreach(var effect in m_Pool)
- {
- if (effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- public void PlayEffect(string name, Vector3 position, Vector3 rotation, Vector3 scale)
- {
- Effect effect = RecycleEffect(name);
- if(effect == null)
- {
- Effect temp = GetEffectTemplate(name);
- effect = UnityEngine.Object.Instantiate(temp);
- }
- else
- {
- m_Pool.Remove(effect);
- }
-
- effect.transform.position = position;
- effect.transform.rotation = Quaternion.Euler(rotation);
- effect.transform.localScale = scale;
- effect.transform.SetParent(this.transform);
- effect.gameObject.SetActive(true);
- }
-
- // 回收特效
- public void CycleEffect(Effect effect)
- {
- effect.gameObject.SetActive(false);
- effect.transform.SetParent(Root_Pool);
- m_Pool.Add(effect);
- }
-
-}
diff --git a/Assets/Scripts/Effects/EffectsManager.cs.meta b/Assets/Scripts/Effects/EffectsManager.cs.meta deleted file mode 100644 index b8dd8f96..00000000 --- a/Assets/Scripts/Effects/EffectsManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: db461c57209f8a241a28d33730ad12ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/FxClear.cs b/Assets/Scripts/Effects/FxClear.cs deleted file mode 100644 index af3a7003..00000000 --- a/Assets/Scripts/Effects/FxClear.cs +++ /dev/null @@ -1,167 +0,0 @@ -using UnityEngine;
-using UnityEngine.Events;
-using System.Collections;
-using System.Collections.Generic;
-
-public enum EffectPlayTypes
-{ - None = 0, - Oneshot, - Loop, -} - -public static class TransformEx
-{
-
- public static void DoRecursively(this Transform root, System.Action<Transform> action, bool containMe = true)
- {
- if (containMe)
- action(root);
- foreach (Transform child in root)
- child.DoRecursively(action);
- } -
-} - -public struct PlayEffectInfo
-{ - public string path { get; set; } - public Transform rootTr { get; set; } - public bool bAttached { get; set; } - public Vector3 posOffset { get; set; } - public Vector3 rot { get; set; } - public Vector3 scale { get; set; } - public EffectPlayTypes playEffectType { get; set; } -}
-
-public class FxClear : MonoBehaviour
-{
- [SerializeField]
- public float ClearTime = 2f;
-
- private EffectPlayTypes m_EffectPlayType = EffectPlayTypes.None;
-
- private Transform m_Root = null; //根节点,可以是角色或者某个骨骼,如果是空,代表是世界空间
- private bool m_Attached = false; // 跟随根节点运动 - - private Vector3 m_Offset = Vector3.zero; - private Vector3 m_Rotation = Vector3.zero; - private Vector3 m_Scale = Vector3.one;
-
- private Quaternion m_RootRot = Quaternion.identity;
- private Vector3 m_RootPos = Vector3.zero;
-
-#if UNITY_EDITOR
- private double m_PrevTime = 0.0f;
- private float m_RemoveWaitTime = 0.0f;
- private bool m_DestroyRequested = false;
-#endif -
- private float m_CurTime = 0.0f; - public float time { get { return m_CurTime; } }
- - private void Awake()
- {
- if (ClearTime <= float.Epsilon)
- m_EffectPlayType = EffectPlayTypes.Loop;
- } -
- private void Start()
- {
- }
-
- private void OnDestroy()
- {
- Release();
- }
- - public void Initialize(PlayEffectInfo info)
- {
- m_EffectPlayType = info.playEffectType;
- m_Root = info.rootTr;
- m_CurTime = 0.0f;
- m_Offset = info.posOffset;
- m_Rotation = info.rot;
- m_Scale = info.scale;
- m_Attached = info.bAttached;
-
- if(info.rootTr != null)
- {
- m_RootPos = info.rootTr.transform.position;
- m_RootRot = info.rootTr.transform.rotation;
- }
-
- SyncTr();
- gameObject.SetActive(true);
- }
-
- public void Release()
- {
- m_Root = null;
- m_CurTime = 0.0f;
- m_Attached = false;
- m_Offset = Vector3.zero;
- m_Rotation = Vector3.zero;
- m_Scale = Vector3.zero;
- } - - // 同步特效的缩放、旋转和位置 - private void SyncTr()
- {
- if (transform == null || transform.gameObject == null)
- return;
-
- if (m_Scale != Vector3.zero)
- {
- transform.localScale = m_Scale;
- }
-
- if (m_Root == null) // 世界空间
- {
- transform.position = m_Offset;
- transform.rotation = Quaternion.Euler(m_Rotation);
- }
- else
- {
- if (m_Attached)
- {
- if(m_Root)
- {
- transform.rotation = m_Root.rotation * Quaternion.Euler(m_Rotation);
- transform.position = m_Root.TransformPoint(m_Offset);
- }
- else
- {
- transform.rotation = m_RootRot * Quaternion.Euler(m_Rotation);
- transform.position = m_RootPos + (m_RootRot * m_Offset);
- }
- }
- else
- {
- transform.rotation = m_RootRot * Quaternion.Euler(m_Rotation);
- transform.position = m_RootPos + (m_RootRot * m_Offset);
- }
- }
- } - - public void Restore()
- {
- DestroyImmediate(this.gameObject);
- }
-
- public void UpdateFunc(float dt)
- {
- m_CurTime += dt;
- SyncTr();
- if (m_EffectPlayType != EffectPlayTypes.Loop && m_CurTime >= ClearTime)
- {
- Restore();
- return;
- }
- }
-
- private void Update()
- {
- UpdateFunc(Time.unscaledDeltaTime);
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Effects/FxClear.cs.meta b/Assets/Scripts/Effects/FxClear.cs.meta deleted file mode 100644 index 2d25b100..00000000 --- a/Assets/Scripts/Effects/FxClear.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fe3f4700e4af0b34b82b4ff79b1d8fec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/HairAssignMaterials.cs b/Assets/Scripts/Effects/HairAssignMaterials.cs deleted file mode 100644 index d2b42d05..00000000 --- a/Assets/Scripts/Effects/HairAssignMaterials.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[ExecuteInEditMode] -public class HairAssignMaterials : MonoBehaviour -{ - public Material material; - - public SkinnedMeshRenderer renderer; - - public int count; - - public void OnEnable() - { - if (renderer == null) - return; - Material[] materials = new Material[count]; - for(int i = 0; i < count;++i) - { - materials[i] = material; - } - renderer.sharedMaterials = materials; - } - -} diff --git a/Assets/Scripts/Effects/HairAssignMaterials.cs.meta b/Assets/Scripts/Effects/HairAssignMaterials.cs.meta deleted file mode 100644 index a4a2c636..00000000 --- a/Assets/Scripts/Effects/HairAssignMaterials.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 06f8e7dbd5d25034ab87247a8458ed28 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs b/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs deleted file mode 100644 index 65a36d9d..00000000 --- a/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs +++ /dev/null @@ -1,124 +0,0 @@ -using UnityEngine;
-using System.Collections;
-
-public class ShurikenBakedMeshEmitter : MonoBehaviour
-{
- [Tooltip("パーティクルで使用したいメッシュ")]
- public SkinnedMeshRenderer skin;
- //使用するメッシュの現在の形を保存
- Mesh baked;
- //再生に使用するパーティクルシステム
- ParticleSystem particle;
- ParticleSystemRenderer render;
- [Tooltip("パーティクルの再生/停止")]
- public bool emit;
- [Tooltip("パーティクルを放出する間隔(秒)")]
- public float coolDown = 0.5f;
- //現在の待機時間
- float interval = 0;
-
- // Use this for initialization
- void Start()
- {
- //元となるメッシュが指定されていなければ本スクリプトを停止
- if (!skin)
- this.enabled = false;
- //使用するパーティクルシステムへのアクセス
- particle = GetComponent<ParticleSystem>();
- render = GetComponent<ParticleSystemRenderer>();
- }
-
- // Update is called once per frame
- void Update()
- {
- //emitが[true]なら...
- if (emit)
- {
- //待機時間の計算
- interval -= Time.deltaTime;
- //必要分の待機時間が経過したなら...
- if (interval < 0)
- {
- //シーンに新たなGameObjectを再生(本GameObjectのコピー)
- GameObject newEmitter = Instantiate(gameObject, transform.position, transform.rotation) as GameObject;
- //再生したGameObjectにEmitMesh()を指示
- newEmitter.GetComponent<ShurikenBakedMeshEmitter>().EmitMesh();
- //待機時間のリセット
- interval = coolDown;
- }
- //emitが[false]なら...
- }
- else
- {
- //待機時間のリセット
- interval = coolDown;
- }
- }
-
- //外部からのアクセスでパーティクルの再生をさせる
- public void EmitMesh()
- {
- //Update ()させない為に[false]
- emit = false;
- //メッシュの型をリセット
- baked = new Mesh();
- //使用するメッシュの現在の形を保存
- skin.BakeMesh(baked);
-
- //自身のパーティクルシステムへのアクセス
- particle = GetComponent<ParticleSystem>();
- render = GetComponent<ParticleSystemRenderer>();
-
- Mesh mainMesh = baked;
- Mesh meshToCopy = new Mesh();
- meshToCopy.vertices = mainMesh.vertices;
- meshToCopy.triangles = mainMesh.triangles;
- meshToCopy.normals = mainMesh.normals;
- meshToCopy.uv = mainMesh.uv;
- int amount = 8;
- Matrix4x4[] matrix = new Matrix4x4[amount];
- for (int i = 0; i < amount; i++)
- {
- matrix[i].SetTRS(new Vector3(i * 10, 0, 0), Quaternion.Euler(new Vector3(Random.Range(-5, 5), Random.Range(0, 360), Random.Range(-5, 5))), Vector3.one);
- }
-
- CombineInstance[] ci = new CombineInstance[amount];
- for (int i = 0; i < amount; i++)
- {
- ci[i] = new CombineInstance();
- ci[i].mesh = meshToCopy;
- ci[i].transform = matrix[i];
- }
-
- Mesh batchedMesh = gameObject.AddComponent<MeshFilter>().mesh = new Mesh();
- batchedMesh.CombineMeshes(ci);
-
- int[] mainSubTri;
- int[] newSubTri;
- batchedMesh.subMeshCount = mainMesh.subMeshCount;
-
- for (int i = 0; i < mainMesh.subMeshCount; i++)
- {
- mainSubTri = mainMesh.GetTriangles(i);
-
- newSubTri = new int[mainSubTri.Length * amount];
-
- for (int ii = 0; ii < amount; ii++)
- {
- for (int iii = 0; iii < mainSubTri.Length; iii++)
- {
- newSubTri[(ii * mainSubTri.Length) + iii] = mainSubTri[iii] + (ii * mainMesh.vertexCount);
- }
- }
- batchedMesh.SetTriangles(newSubTri, i);
- }
-
-
- //パーティクルシステムで使用するメッシュを指定
- render.mesh = meshToCopy;
- //パーティクルの再生
- particle.Play();
- //本GameObjectの破棄の指示
- Destroy(gameObject, particle.duration);
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs.meta b/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs.meta deleted file mode 100644 index b39edab1..00000000 --- a/Assets/Scripts/Effects/ShurikenBakedMeshEmitter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9bd02b95bf27c724ea9bb26806323053 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/Spark.cs b/Assets/Scripts/Effects/Spark.cs deleted file mode 100644 index 5f8856c4..00000000 --- a/Assets/Scripts/Effects/Spark.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Spark : MonoBehaviour
-{
- public string Name;
- public float LifeTime;
-
- private float time;
-
- public Transform Host;
-
- private void Awake()
- {
- }
-
- private void OnEnable()
- {
- time = 0;
- }
-
- private void Update()
- {
- time += Time.deltaTime;
- if(time > LifeTime)
- {
- SparksManager.Instance.CycleSpark(this);
- }
- if (Host != null)
- {
- transform.position = Host.position;
- }
- }
-
-}
diff --git a/Assets/Scripts/Effects/Spark.cs.meta b/Assets/Scripts/Effects/Spark.cs.meta deleted file mode 100644 index c1c05447..00000000 --- a/Assets/Scripts/Effects/Spark.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 35fa504215dc5194a944721d5cc378af -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Effects/SparksManager.cs b/Assets/Scripts/Effects/SparksManager.cs deleted file mode 100644 index 6825f615..00000000 --- a/Assets/Scripts/Effects/SparksManager.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using System;
-
-public class SparksManager : MonoBehaviour
-{
- public static SparksManager Instance;
-
- public Spark[] SparkTemplates;
-
- public Transform Root_Pool;
-
- List<Spark> m_Pool = new List<Spark>();
-
- private void Awake()
- {
- Instance = this;
- }
-
- Spark GetSparkTemplate(string name)
- {
- foreach (var effect in SparkTemplates)
- {
- if (effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- Spark RecycleSpark(string name)
- {
- foreach (var effect in m_Pool)
- {
- if (effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- public void PlaySpark(string name, Vector3 position)
- {
- Spark effect = RecycleSpark(name);
- if (effect == null)
- {
- Spark temp = GetSparkTemplate(name);
- effect = UnityEngine.Object.Instantiate(temp);
- }
- else
- {
- m_Pool.Remove(effect);
- }
-
- effect.Host = null;
- effect.transform.position = position;
- effect.transform.SetParent(this.transform);
- effect.gameObject.SetActive(true);
- }
-
-
- public void PlaySpark(string name, Transform host)
- {
- Spark effect = RecycleSpark(name);
- if (effect == null)
- {
- Spark temp = GetSparkTemplate(name);
- effect = UnityEngine.Object.Instantiate(temp);
- }
- else
- {
- m_Pool.Remove(effect);
- }
- effect.Host = host;
- effect.transform.position = host.position;
- effect.transform.SetParent(this.transform);
- effect.gameObject.SetActive(true);
- }
-
- // 回收特效
- public void CycleSpark(Spark effect)
- {
- effect.gameObject.SetActive(false);
- effect.transform.SetParent(Root_Pool);
- m_Pool.Add(effect);
- }
-
-}
diff --git a/Assets/Scripts/Effects/SparksManager.cs.meta b/Assets/Scripts/Effects/SparksManager.cs.meta deleted file mode 100644 index 84d3b608..00000000 --- a/Assets/Scripts/Effects/SparksManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c1cf80a321371944a9a3e8dfbe7e5134 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/GUI.meta b/Assets/Scripts/GUI.meta deleted file mode 100644 index 649b12c1..00000000 --- a/Assets/Scripts/GUI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 452d3a87e77cbe642b89b8cdd976ddaf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/GUI/UIPanelBase.cs b/Assets/Scripts/GUI/UIPanelBase.cs deleted file mode 100644 index e31f1a3b..00000000 --- a/Assets/Scripts/GUI/UIPanelBase.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class UIPanelBase : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/GUI/UIPanelBase.cs.meta b/Assets/Scripts/GUI/UIPanelBase.cs.meta deleted file mode 100644 index 6f7c86e5..00000000 --- a/Assets/Scripts/GUI/UIPanelBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 07956c631b2d31d43bc087c82ecc0b55 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Input.meta b/Assets/Scripts/Input.meta deleted file mode 100644 index a2be21ee..00000000 --- a/Assets/Scripts/Input.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fb96fc16498194f4193cd4430c82574e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Input/Command.cs b/Assets/Scripts/Input/Command.cs deleted file mode 100644 index 7ef6c9eb..00000000 --- a/Assets/Scripts/Input/Command.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - - -public enum GamepadButton -{ - Blank, - - // 方向键 - Left, - Right, - Up, - Down, - - // 操作键 - Triangle, // △ - Cross, // × - Square, // □ - Circle, // ○ -} - -public struct Command -{ - public GamepadButton code; // 指令码 - public float time; // 触发时间 - public int id; - - public static Command Blank = new Command(GamepadButton.Blank, 0); - - public Command(GamepadButton code, float time) - { - this.code = code; - this.time = time; - this.id = UIDManager.Acquire(); - } -} - diff --git a/Assets/Scripts/Input/Command.cs.meta b/Assets/Scripts/Input/Command.cs.meta deleted file mode 100644 index f2802802..00000000 --- a/Assets/Scripts/Input/Command.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e105d6d96dd08e8499e6a4254d289e99 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Input/InputManager.cs b/Assets/Scripts/Input/InputManager.cs deleted file mode 100644 index 06e4f02f..00000000 --- a/Assets/Scripts/Input/InputManager.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public struct InputCommand
-{
- public KeyCode key;
- public float time;
-}
-
-// 处理输入逻辑,不涉及读取输入,只处理逻辑
-public class InputManager : SingletonMB<InputManager>
-{
-
- PCController _pc;
-
- List<InputCommand> m_CommandQueue = new List<InputCommand>();
-
- const float threshold = 3;
-
- PCController pc
- {
- get
- {
- if (_pc == null)
- _pc = PCController.instance;
- return _pc;
- }
- }
-
- public void OnUpdate()
- {
- foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode)))
- {
- if (Input.GetKeyDown(vKey))
- {
- InputCommand cmd = new InputCommand();
- cmd.key = vKey;
- cmd.time = Time.time;
- m_CommandQueue.Add(cmd);
-
- //Debug.Log(cmd.time);
- string cmdStr = "";
- m_CommandQueue.ForEach(s => cmdStr += s.key.ToString() + ",");
- Debug.Log(cmdStr);
- }
- }
- float curTime = Time.time;
- int removeCount = 0;
- for(int i = 0; i < m_CommandQueue.Count; ++i)
- {
- if(curTime - m_CommandQueue[i].time > threshold)
- {
- removeCount++;
- }
- }
- m_CommandQueue.RemoveRange(0, removeCount);
- }
-
- public bool TryCommand(float interval = 0.5f, params KeyCode[] keys)
- {
- return TryCommand(interval, true, keys);
-
- }
-
- public bool TryCommand(float interval = 0.5f, bool checkInput = false, params KeyCode[] keys)
- {
- if (keys.Length > m_CommandQueue.Count)
- return false;
- if (checkInput && !Input.GetKey(keys[keys.Length - 1]))
- return false;
- int count = m_CommandQueue.Count;
- float preTime = m_CommandQueue[count - keys.Length].time;
- for (int i = 0; i < keys.Length; ++i)
- {
- if (keys[i] == m_CommandQueue[i + count - keys.Length].key)
- {
- if (m_CommandQueue[i + count - keys.Length].time - preTime > interval)
- {
- return false;
- }
- preTime = m_CommandQueue[i + count - keys.Length].time;
- }
- else
- {
- return false;
- }
- }
- //m_CommandQueue.RemoveRange(count - keys.Length, keys.Length);
- m_CommandQueue.Clear(); // 清理
- return true;
- }
-
- public void ClearCommand()
- {
- m_CommandQueue.Clear();
- }
-
-}
diff --git a/Assets/Scripts/Input/InputManager.cs.meta b/Assets/Scripts/Input/InputManager.cs.meta deleted file mode 100644 index c426b3c5..00000000 --- a/Assets/Scripts/Input/InputManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 16f7a980b8509a146971d6ad5133b63a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Input/_InputManager.cs b/Assets/Scripts/Input/_InputManager.cs deleted file mode 100644 index a9d120e4..00000000 --- a/Assets/Scripts/Input/_InputManager.cs +++ /dev/null @@ -1,164 +0,0 @@ -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 deleted file mode 100644 index 234b6d17..00000000 --- a/Assets/Scripts/Input/_InputManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 26195ae7cb9459e498256c387da7273e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Line3D.meta b/Assets/Scripts/Line3D.meta deleted file mode 100644 index 7ca25728..00000000 --- a/Assets/Scripts/Line3D.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: df7762b0e9f4ea643822227dc54aa423 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Line3D/Line3DRenderer.cs b/Assets/Scripts/Line3D/Line3DRenderer.cs deleted file mode 100644 index d16916cb..00000000 --- a/Assets/Scripts/Line3D/Line3DRenderer.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Line3DRenderer : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Line3D/Line3DRenderer.cs.meta b/Assets/Scripts/Line3D/Line3DRenderer.cs.meta deleted file mode 100644 index ad2c4500..00000000 --- a/Assets/Scripts/Line3D/Line3DRenderer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f4af360e8a036c74499160090bb71ff7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers.meta b/Assets/Scripts/Managers.meta deleted file mode 100644 index 42a571fb..00000000 --- a/Assets/Scripts/Managers.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ffa677f9a3f3e5a49be1487a5a522911 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/AvatarManager.cs b/Assets/Scripts/Managers/AvatarManager.cs deleted file mode 100644 index 6ccac62a..00000000 --- a/Assets/Scripts/Managers/AvatarManager.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class AvatarManager : Singleton<AvatarManager>
-{
- private List<Avatar> m_Avatars = new List<Avatar>();
-
- public void AddAvatar(Avatar avatar)
- {
- m_Avatars.Add(avatar);
- }
-
- public void OnUpdate()
- {
- foreach (var avatar in m_Avatars)
- {
- avatar.OnUpdate();
- }
- }
-
- public void OnPhysicsUpdate()
- {
- foreach(var avatar in m_Avatars)
- {
- avatar.OnPhysicsUpdate();
- }
- }
-
-}
diff --git a/Assets/Scripts/Managers/AvatarManager.cs.meta b/Assets/Scripts/Managers/AvatarManager.cs.meta deleted file mode 100644 index a130d1a3..00000000 --- a/Assets/Scripts/Managers/AvatarManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: be28f7eef9edbed4ea13fd6f474cacb8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/BattleManager.cs b/Assets/Scripts/Managers/BattleManager.cs deleted file mode 100644 index 967f5c4d..00000000 --- a/Assets/Scripts/Managers/BattleManager.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class BattleManager : Singleton<BattleManager>
-{
- public void OnHitOccur()
- {
-
- }
-
-}
diff --git a/Assets/Scripts/Managers/BattleManager.cs.meta b/Assets/Scripts/Managers/BattleManager.cs.meta deleted file mode 100644 index ce0cee41..00000000 --- a/Assets/Scripts/Managers/BattleManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1131367ba4b66ec4493a09bdeb570943 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/HitManager.cs b/Assets/Scripts/Managers/HitManager.cs deleted file mode 100644 index d16a462c..00000000 --- a/Assets/Scripts/Managers/HitManager.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public struct HitInfo
-{
- public HitDefination hitDef;
- public Hitbox hitbox;
- public Hurtbox hurtbox;
- public Vector3 contact;
- public Vector3 size;
-}
-
-public struct HurtInfo
-{
- public HitDefination hitDef;
- public Hitbox hitbox;
- public Hurtbox hurtbox;
- public Vector3 contact;
- public Vector3 size;
-}
-
-public class HitManager : Singleton<HitManager>
-{
- private List<Hitbox> m_HitBoxes = new List<Hitbox>();
- private List<Hurtbox> m_HurtBoxes = new List<Hurtbox>();
-
- public void AddHitBox(Hitbox hitbox)
- {
- m_HitBoxes.Add(hitbox);
- }
-
- public void AddHurtBox(Hurtbox hurtbox)
- {
- m_HurtBoxes.Add(hurtbox);
- }
-
- public void RemoveHitBox(Hitbox hitbox)
- {
- m_HitBoxes.Remove(hitbox);
- }
-
- public void RemoveHurtBox(Hurtbox hurtbox)
- {
- m_HurtBoxes.Remove(hurtbox);
- }
-
- /// <summary>
- /// 根据碰撞结果产生击中信息
- /// </summary>
- public void OnPhysicsUpdate()
- {
- for(int i = 0;i < m_HitBoxes.Count; ++i)
- {
- Hitbox hitbox = m_HitBoxes[i];
- if (hitbox == null)
- return;
- for (int j = 0; j < PhysicsWorld.Instance.Collisions.Count; ++j)
- {
- PhysicsCollisionInfo info = PhysicsWorld.Instance.Collisions[j];
- PhysicsPrimitive collider;
- if(info.prim1 == hitbox.Collider)
- {
- collider = info.prim2;
- }
- else if(info.prim2 == hitbox.Collider)
- {
- collider = info.prim1;
- }
- else
- {
- continue;
- }
-
- Hurtbox hurtbox = GetHurtboxByCollider(collider);
- if(hurtbox == null)
- {
- Debug.LogError("没有找到hurtbox");
- continue;
- }
-
- HitDefination hitDef = null;
-
- if (hitbox.Host is Avatar)
- {
- Avatar attacker = hitbox.Host as Avatar;
- Hit hit = attacker.GetHit();
- if(hit == null)
- continue;
- if (hit.HasRecord(hurtbox.Host))
- continue;
- hit.AddRecord(hurtbox.Host);
- hitDef = hit.defination;
- }
-
- // 发送击中消息
- HitInfo hitInfo = new HitInfo ();
- hitInfo.hitbox = hitbox;
- hitInfo.hurtbox = hurtbox;
- hitInfo.contact = info.contact;
- hitInfo.size = info.size;
- hitInfo.hitDef = hitDef;
-
- hitbox.Host.OnHit(hitInfo);
-
- // 发送受击消息
- HurtInfo hurtInfo = new HurtInfo();
- hurtInfo.hitbox = hitbox;
- hurtInfo.hurtbox = hurtbox;
- hurtInfo.contact = info.contact;
- hurtInfo.size = info.size;
- hurtInfo.hitDef = hitDef;
-
- hurtbox.Host.OnHurt(hurtInfo);
-
- // 场景处理特效等
- BattleManager.Instance.OnHitOccur();
- }
- }
- }
-
- Hurtbox GetHurtboxByCollider(PhysicsPrimitive collider)
- {
- foreach(var hurtbox in m_HurtBoxes)
- {
- if(hurtbox.Collider == collider)
- {
- return hurtbox;
- }
- }
- return null;
- }
-
-}
diff --git a/Assets/Scripts/Managers/HitManager.cs.meta b/Assets/Scripts/Managers/HitManager.cs.meta deleted file mode 100644 index dab849f7..00000000 --- a/Assets/Scripts/Managers/HitManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e99f64b7dd0fd8d4aa9d7cc0d8fa2165 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/Physics.meta b/Assets/Scripts/Managers/Physics.meta deleted file mode 100644 index 2296b3f8..00000000 --- a/Assets/Scripts/Managers/Physics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 603d4624aaedd794cb89497954a83f4a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/ResourceManager.cs b/Assets/Scripts/Managers/ResourceManager.cs deleted file mode 100644 index 974eb53a..00000000 --- a/Assets/Scripts/Managers/ResourceManager.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-public partial class ResourceManager : Singleton<ResourceManager>
-{
- Dictionary<string, Object> m_CachedObject = new Dictionary<string, Object>();
-
- public T LoadAsset<T>(string path) where T : UnityEngine.Object
- {
- if(m_CachedObject.ContainsKey(path))
- {
- return m_CachedObject[path] as T;
- }
-
-#if UNITY_EDITOR
- T obj = AssetDatabase.LoadAssetAtPath<T>(path);
- m_CachedObject.Add(path, obj);
-#else
-#endif
- return obj;
- }
-
-}
diff --git a/Assets/Scripts/Managers/ResourceManager.cs.meta b/Assets/Scripts/Managers/ResourceManager.cs.meta deleted file mode 100644 index 98c1315c..00000000 --- a/Assets/Scripts/Managers/ResourceManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 55ea2b1da79987e459caa3fbb6bd096a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/SceneManager.cs b/Assets/Scripts/Managers/SceneManager.cs deleted file mode 100644 index 182b662d..00000000 --- a/Assets/Scripts/Managers/SceneManager.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class SceneManager : Singleton<SceneManager>
-{
-
- public Camera mainCamera { get { return MainCamera.Instance.camera; } }
-
-}
diff --git a/Assets/Scripts/Managers/SceneManager.cs.meta b/Assets/Scripts/Managers/SceneManager.cs.meta deleted file mode 100644 index c8bbc8f8..00000000 --- a/Assets/Scripts/Managers/SceneManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fc495e12ea00bc248889c82ebc476f03 -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 deleted file mode 100644 index 920cbe9e..00000000 --- a/Assets/Scripts/Managers/UnitManager.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class UnitManager : Singleton<UnitManager>
-{
- public PCController pc { get; private set; }
-
- public List<MonsterController> monsters { get; private set; }
-
- private Dictionary<UnitController, List<UnitSnapshot>> m_Snapshots = new Dictionary<UnitController, List<UnitSnapshot>>();
-
- public void SetPlayerCharacter(PCController pc)
- {
- this.pc = pc;
- }
-
- public UnitSnapshot ClaimSnapshotSolo(UnitSnapshotInfo info)
- {
- UnitSnapshot snapshot = ClaimSnapshot(info.unit);
- snapshot.ApplySnapshot(info);
- return snapshot;
- }
-
- public UnitSnapshot ClaimSnapshot(UnitController unit)
- {
- List<UnitSnapshot> snapshots;
- UnitSnapshot snap = null;
- if (m_Snapshots.TryGetValue(unit, out snapshots) && snapshots.Count > 0)
- {
- snap = snapshots[snapshots.Count - 1];
- snapshots.RemoveAt(snapshots.Count - 1);
- return snap;
- }
- var obj = ResourceManager.Instance.LoadAsset<UnitSnapshot>(unit.unitDetail.snapshotAvatarPath);
- if(obj)
- {
- snap = Object.Instantiate<UnitSnapshot>(obj);
- //snap.gameObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSave;
- snap.Initialize(unit);
- snap.active = false;
- }
- return snap;
- }
-
- public void ReleaseSnapshot(ref UnitSnapshot snap)
- {
- List<UnitSnapshot> snapshots;
- if (!m_Snapshots.TryGetValue(snap.owner, out snapshots))
- {
- snapshots = new List<UnitSnapshot>();
- m_Snapshots.Add(snap.owner, snapshots);
- }
- snapshots.Add(snap);
- snap = null;
- }
-
-}
diff --git a/Assets/Scripts/Managers/UnitManager.cs.meta b/Assets/Scripts/Managers/UnitManager.cs.meta deleted file mode 100644 index 8f44e5ae..00000000 --- a/Assets/Scripts/Managers/UnitManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f38cf602494915748a234fd75081ea2e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics.meta b/Assets/Scripts/Physics.meta deleted file mode 100644 index 3c22ba05..00000000 --- a/Assets/Scripts/Physics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e488506fa2c3b1942a5d0b67811b9cfc -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsBall.cs b/Assets/Scripts/Physics/PhysicsBall.cs deleted file mode 100644 index 5baceeb8..00000000 --- a/Assets/Scripts/Physics/PhysicsBall.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 碰撞球
-/// </summary>
-public class PhysicsBall : PhysicsPrimitive
-{
- public override PrimitiveType Type
- {
- get
- {
- return PrimitiveType.Ball;
- }
- }
-
- [SerializeField]
- private float m_Radius;
-
- public float Radius
- {
- get
- {
- return m_Radius;
- }
- }
-
- public void OnDrawGizmos()
- {
- Gizmos.DrawSphere(m_Center, m_Radius);
- }
-
- void Start()
- {
- base.OnInit();
- }
-
-}
diff --git a/Assets/Scripts/Physics/PhysicsBall.cs.meta b/Assets/Scripts/Physics/PhysicsBall.cs.meta deleted file mode 100644 index 39ba3e3f..00000000 --- a/Assets/Scripts/Physics/PhysicsBall.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04071fd85519f204fb0d0dc080c41bae -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsBody.cs b/Assets/Scripts/Physics/PhysicsBody.cs deleted file mode 100644 index 80026962..00000000 --- a/Assets/Scripts/Physics/PhysicsBody.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 需要受物理系统托管的动作:
-// 跳跃上升
-// 跳跃下降
-// 空中受击
-//
-//
-// 不会受物理系统托管的动作:
-// 单个招式
-// 空中连击
-//
-//
-// 一般来说启用物理是被动的
-
-/// <summary>
-/// 刚体
-/// </summary>
-public sealed class PhysicsBody : MonoBehaviour
-{
-
- // 是否朝向右侧(正向)
- public bool IsFaceRight
- {
- get
- {
- float rotY = Quaternion.ToEulerAngles(transform.rotation).y;
- rotY = Mathf.Rad2Deg * rotY;
- bool right = rotY >= 0 && rotY <= 180;
- return right;
- }
- }
-
- // 全局速度,以世界为参考系
- [SerializeField]
- public Vector3 Velocity
- {
- get
- {
- Vector3 vel = m_LocalVelocity;
- if (!IsFaceRight)
- vel.x = -vel.x;
- return vel;
- }
- set
- {
- if (IsFaceRight)
- m_LocalVelocity = value;
- else
- m_LocalVelocity = new Vector3(-value.x, value.y, value.z);
- }
- }
-
- // 以自身为参考系的速度,x>0向前,x<0向后,y>0向上,y<0向下。默认情况下以右为正方向
- // 设置速度应该以local velocity为准
- [SerializeField]
- private Vector3 m_LocalVelocity;
-
- public Vector3 LocalVelocity
- {
- get
- {
- return m_LocalVelocity;
- }
- set
- {
- m_LocalVelocity = value;
- }
- }
-
- [SerializeField]
- private float m_Weight;
- public float Weight
- {
- get
- {
- return m_Weight;
- }
- }
-
- [Tooltip("ignore gravity?")]
- [SerializeField]
- private bool m_UseGravity;
- public bool UseGravity
- {
- get
- {
- return m_UseGravity;
- }
- set
- {
- m_UseGravity = value;
- }
- }
-
- [SerializeField]
- private Vector3 m_Accelaration;
- public Vector3 Accelaration
- {
- get
- {
- return m_Accelaration;
- }
- }
-
- [Tooltip("地面摩擦系数")]
- [SerializeField]
- private float m_Frication;
- public float GroundFriction
- {
- get { return m_Frication; }
- }
-
- [Tooltip("空气摩擦力")]
- [SerializeField]
- private float m_AirFriction;
- public float AirFriction
- {
- get { return m_AirFriction; }
- }
-
- [Tooltip("力")]
- [SerializeField]
- private Vector3 m_Force;
- public Vector3 Force
- {
- get
- {
- return m_Force;
- }
- }
-
- [SerializeField]
- private PhysicsPrimitive m_Primitive;
-
-
- public void AddForce(Vector3 force)
- {
- m_Force += force;
- }
-
- public void AddLocalForce(Vector3 localForce)
- {
- m_Force += localToWorldDir(localForce);
- }
-
- public void SetForce(Vector3 force)
- {
- m_Force = force;
- }
-
- public void SetLocalForce(Vector3 localForce)
- {
- m_Force = localToWorldDir(localForce);
- }
-
- public Vector3 localToWorldDir(Vector3 local)
- {
- if (IsFaceRight)
- return local;
- else
- return new Vector3(-local.x, local.y, local.z);
- }
-
-}
diff --git a/Assets/Scripts/Physics/PhysicsBody.cs.meta b/Assets/Scripts/Physics/PhysicsBody.cs.meta deleted file mode 100644 index a80b9d50..00000000 --- a/Assets/Scripts/Physics/PhysicsBody.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cd65b198d10c5b441b5c40b05c8f3d41 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsBox.cs b/Assets/Scripts/Physics/PhysicsBox.cs deleted file mode 100644 index f8b4fee4..00000000 --- a/Assets/Scripts/Physics/PhysicsBox.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// AABB碰撞盒
-/// </summary>
-public class PhysicsBox : PhysicsPrimitive
-{
- public override PrimitiveType Type
- {
- get
- {
- return PrimitiveType.Box;
- }
- }
-
- [SerializeField]
- private Vector3 m_Size;
- public Vector3 Size
- {
- get
- {
- return m_Size;
- }
- }
-
- public float Long { get { return m_Size.x; } }
- public float Wide { get { return m_Size.z; } }
- public float Height { get { return m_Size.y; } }
-
- public bool m_DrawGizmo = true;
-
- public float Top
- {
- get
- {
- return Position.y + Height / 2f;
- }
- }
-
- public float Left
- {
- get
- {
- return Position.x - Long / 2f;
- }
- }
-
- public float Right
- {
- get
- {
- return Position.x + Long / 2f;
- }
- }
-
- public float Bottom
- {
- get
- {
- return Position.y - Height / 2f;
- }
- }
-
- public void OnDrawGizmos()
- {
- if (!m_IsActive || !m_DrawGizmo)
- return;
- Vector3 pos = Position;
- Gizmos.color = m_HintColor;
- Gizmos.DrawCube(pos, m_Size);
- //Gizmos.color = Color.blue;
- //Gizmos.DrawSphere(pos, 0.1f);
- }
-
- private void Start()
- {
- base.OnInit();
- }
-
-}
diff --git a/Assets/Scripts/Physics/PhysicsBox.cs.meta b/Assets/Scripts/Physics/PhysicsBox.cs.meta deleted file mode 100644 index 528c7474..00000000 --- a/Assets/Scripts/Physics/PhysicsBox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 637138a0ba30abc498c5c9dcf6bb5d78 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsHelper.cs b/Assets/Scripts/Physics/PhysicsHelper.cs deleted file mode 100644 index 44bf513e..00000000 --- a/Assets/Scripts/Physics/PhysicsHelper.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public enum CollisionType
-{
- BallvsBall = 1,
- BallvsBox,
- BoxvsBox
-}
-
-
-/// <summary>
-/// 碰撞的信息
-/// </summary>
-public struct PhysicsCollisionInfo
-{
- public CollisionType type;
- public PhysicsPrimitive prim1;
- public PhysicsPrimitive prim2;
- public Vector3 contact;
- public Vector3 size;
-}
-
-public sealed class PhysicsHelper
-{
-
- public static bool BallContains(PhysicsBall ball, Vector3 point)
- {
- return false;
- }
-
- public static bool BallContains(PhysicsBall ball, Vector2 point)
- {
- return false;
- }
-
- public static bool BoxContains(PhysicsBox box, Vector3 point)
- {
- return false;
- }
-
- public static bool BoxContains(PhysicsBox box, Vector2 point)
- {
- return false;
- }
-
- public static bool BallvsBall2D(PhysicsBall ball1, PhysicsBall ball2, ref PhysicsCollisionInfo info)
- {
-
- return true;
- }
-
- public static bool BoxvsBox2D(PhysicsBox box1, PhysicsBox box2, ref PhysicsCollisionInfo info)
- {
- if(box1.Left < box2.Right && box1.Right > box2.Left && box1.Bottom < box2.Top && box1.Top > box2.Bottom)
- {
- info.type = CollisionType.BoxvsBox;
- info.prim1 = box1;
- info.prim2 = box2;
-
- float left = Mathf.Max(box1.Left, box2.Left);
- float right = Mathf.Min(box1.Right, box2.Right);
- float top = Mathf.Min(box1.Top, box2.Top);
- float bottom = Mathf.Max(box1.Bottom, box2.Bottom);
- info.contact = new Vector3((left + right )/2f, (top + bottom)/2f, 0 );
- info.size = new Vector3(right - left, top - bottom, 1);
-
- return true;
- }
- return false;
- }
-
- public static bool BallvsBox2D(PhysicsBall ball, PhysicsBox box, ref PhysicsCollisionInfo info)
- {
- return true;
- }
-
- public static bool BallvsRay(PhysicsBall ball, Vector3 ray)
- {
- return false;
- }
-
- public static bool BoxvsRay(PhysicsBox box, Vector3 ray)
- {
- return false;
- }
-
- public static bool RayvsRay(Vector3 ray1, Vector3 ray2)
- {
- return false;
- }
-
- public static bool PrimvsPrim(PhysicsPrimitive prim1, PhysicsPrimitive prim2, ref PhysicsCollisionInfo info)
- {
- if(prim1.Type == PrimitiveType.Ball)
- {
- if (prim2.Type == PrimitiveType.Ball)
- return BallvsBall2D(prim1 as PhysicsBall, prim2 as PhysicsBall, ref info);
- else
- return BallvsBox2D(prim1 as PhysicsBall, prim2 as PhysicsBox, ref info);
- }
- else
- {
- if (prim2.Type == PrimitiveType.Ball)
- return BallvsBox2D(prim2 as PhysicsBall, prim1 as PhysicsBox, ref info);
- else
- return BoxvsBox2D(prim1 as PhysicsBox, prim2 as PhysicsBox, ref info);
- }
- }
-
-}
diff --git a/Assets/Scripts/Physics/PhysicsHelper.cs.meta b/Assets/Scripts/Physics/PhysicsHelper.cs.meta deleted file mode 100644 index 6259c4db..00000000 --- a/Assets/Scripts/Physics/PhysicsHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5feab7ce586a9aa468329f97b89a69a3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsPrimGroup.cs b/Assets/Scripts/Physics/PhysicsPrimGroup.cs deleted file mode 100644 index 0a79eeff..00000000 --- a/Assets/Scripts/Physics/PhysicsPrimGroup.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class PhysicsPrimGroup : MonoBehaviour
-{
-
- [SerializeField]
- private PhysicsPrimitive[] m_Primitives;
-
- public PhysicsPrimitive[] Primitives
- {
- get
- {
- return m_Primitives;
- }
- }
-
-}
diff --git a/Assets/Scripts/Physics/PhysicsPrimGroup.cs.meta b/Assets/Scripts/Physics/PhysicsPrimGroup.cs.meta deleted file mode 100644 index 48e8ed4e..00000000 --- a/Assets/Scripts/Physics/PhysicsPrimGroup.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1f05f73c4d0805e4ba5dd659c305c91c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsPrimitive.cs b/Assets/Scripts/Physics/PhysicsPrimitive.cs deleted file mode 100644 index fde705fd..00000000 --- a/Assets/Scripts/Physics/PhysicsPrimitive.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public enum PrimitiveType
-{
- None,
- Ball,
- Box
-}
-
-/// <summary>
-/// 物理碰撞体基类
-/// 对于格斗游戏来说只需要Box和Ball两种
-/// </summary>
-public abstract class PhysicsPrimitive : MonoBehaviour
-{
- public virtual PrimitiveType Type
- {
- get
- {
- return PrimitiveType.None;
- }
- }
-
- /// <summary>
- /// 世界坐标,物理模拟是在世界空间,本地坐标没有意义
- /// </summary>
- public Vector3 Position
- {
- get
- {
- Vector3 euler = Quaternion.ToEulerAngles(transform.rotation);
- euler.y = Mathf.Rad2Deg * euler.y;
- Vector3 res = m_Center;
- res.x = (euler.y > 0 && euler.y <= 180) ? -res.x : res.x;
- res = transform.position + res;
- return res;
- }
- }
-
- [SerializeField]
- /// <summary>
- /// 这个primitive是否参与物理计算,用来快速给物体取消和恢复重力影响
- /// </summary>
- protected bool m_IsActive;
- public bool IsActive
- {
- get
- {
- return m_IsActive;
- }
- }
-
- /// <summary>
- /// 唯一ID
- /// </summary>
- protected int m_ID;
- public int ID
- {
- get
- {
- return m_ID;
- }
- }
-
- [Tooltip("给primitive分组,决定大组和大组之间是否有碰撞检测")]
- [SerializeField]
- protected PhysicsGroup m_Group;
- public PhysicsGroup Group
- {
- get
- {
- return m_Group;
- }
- }
-
- [Tooltip("给primitive一个标记,表明它的从属关系。帮助做hitbox和hurtbox")]
- [SerializeField]
- protected PhysicsTag m_Tag;
- public PhysicsTag Tag
- {
- get
- {
- return m_Tag;
- }
- }
-
- [Tooltip("同一个标签的没有碰撞检测")]
- [SerializeField]
- protected string m_Label;
- public string Label
- {
- get
- {
- return m_Label;
- }
- }
-
- [Tooltip("单个碰撞体的描述(名称),作为标识用来识别")]
- [SerializeField]
- protected string m_Title;
- public string Title
- {
- get
- {
- return m_Title;
- }
- }
-
- [SerializeField]
- protected string m_Desc;
- public string Desc
- {
- get
- {
- return m_Desc;
- }
- }
-
- /// <summary>
- /// 初始化,设置一些公共数据
- /// </summary>
- protected void OnInit()
- {
- m_ID = UIDManager.Acquire();
- PhysicsWorld.Instance.AddPrimitive(this);
- }
-
- protected Color Color_Green = new Color(0, 1, 0, 0.5f);
-
- [SerializeField]
- protected Color m_HintColor = new Color(0, 0, 0, 0.5f);
-
- [Tooltip("Physics body, leave blank and primitive will be static.")]
- [SerializeField]
- protected PhysicsBody m_Body;
-
- public PhysicsBody Body
- {
- get
- {
- return m_Body;
- }
- }
-
- /// <summary>
- /// 中心点在本地空间的位置
- /// </summary>
- public Vector3 m_Center;
-
- /// <summary>
- /// 边界:左、右、上、下
- /// </summary>
- public Vector4 Bound
- {
- get
- {
- Vector4 bound = new Vector4();
- if(this is PhysicsBox)
- {
- PhysicsBox box = this as PhysicsBox;
- bound.x = box.Left;
- bound.y = box.Right;
- bound.z = box.Top;
- bound.w = box.Bottom;
- }
- else if(this is PhysicsBall)
- {
- PhysicsBall ball = this as PhysicsBall;
- bound.x = ball.Position.x - ball.Radius;
- bound.y = ball.Position.x + ball.Radius;
- bound.z = ball.Position.y + ball.Radius;
- bound.w = ball.Position.y - ball.Radius;
- }
- return bound;
- }
- }
-
- public bool IsOnGround
- {
- get
- {
- if (Mathf.Approximately(Bound.w, PhysicsWorld.Ground))
- return true;
- return Bound.w <= PhysicsWorld.Ground;
- }
- }
-
- public bool IsInAir
- {
- get
- {
- //return Bound.w > PhysicsWorld.Ground;
- return !IsOnGround;
- }
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Physics/PhysicsPrimitive.cs.meta b/Assets/Scripts/Physics/PhysicsPrimitive.cs.meta deleted file mode 100644 index 725a8459..00000000 --- a/Assets/Scripts/Physics/PhysicsPrimitive.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bf2b8ac8c3958a449891e20d634a76de -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Physics/PhysicsWorld.cs b/Assets/Scripts/Physics/PhysicsWorld.cs deleted file mode 100644 index 7b7787d4..00000000 --- a/Assets/Scripts/Physics/PhysicsWorld.cs +++ /dev/null @@ -1,356 +0,0 @@ - using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// primitive分类
-/// </summary>
-public enum PhysicsGroup
-{
- Character, // 角色
- Prop, // 物体
- Ground, // 地面
- Wall, // 墙面
-
- HitBox, // hitbox
- HurtBox, // hurtbox
-
- GroupCount,
-}
-
-/// <summary>
-/// primitive标记
-/// </summary>
-public enum PhysicsTag
-{
- Null = 0,
- Player = 1, // 从属于玩家
- Oponent = 1 << 1, // 从属于对手
-}
-
-/// <summary>
-/// 物理子系统
-/// </summary>
-public class PhysicsWorld : Singleton<PhysicsWorld>
-{
- public delegate void Callback();
-
- public Callback onBeforeUpdate;
- public Callback onUpdate;
-
- private int m_UpdateRate = 60;
- // 重力加速度
- private readonly Vector3 m_Gravity = new Vector3(0, -30f, 0);
- // 当前管理的碰撞体
- private List<PhysicsPrimitive> m_Primitives = new List<PhysicsPrimitive>();
- private float m_TimeCount;
-
- private const int _ = 0;
- private readonly int[] m_CollisionTable = {
- // hurtbox hitBox wall ground prop character
-/*character*/ 0, 0, 1, 1, 1, 1,
-/*prop */ 0, 0, 1, 1, 0, _,
-/*ground */ 0, 0, 0, 0, _, _,
-/*wall */ 0, 0, 0, _, _, _,
-/*hitbox */ 1, 0, _, _, _, _,
-/*hurtbox */ 0, _, _, _, _, _,
- };
-
- private List<Animator> m_Animators = new List<Animator>();
-#if UNITY_EDITOR
- private List<Vector3> m_Contacts = new List<Vector3>();
-#endif
-
- private List<PhysicsCollisionInfo> m_CollisionInfo = new List<PhysicsCollisionInfo>();
-
- public const float Ground = 0.1f;
-
- // 所有碰撞
- public List<PhysicsCollisionInfo> Collisions
- {
- get
- {
- return m_CollisionInfo;
- }
- }
-
- public void Init()
- {
- m_TimeCount = Time.time;
- }
-
- public void AddPrimitive(PhysicsPrimitive prim)
- {
- if (prim == null)
- return;
- if(m_Primitives.Contains(prim))
- {
- Debug.LogError("PhysicsWorld已经存在此碰撞体,ID=" + prim.ID + ", 类型=" + prim.Tag);
- return;
- }
- m_Primitives.Add(prim);
- }
-
- public void RemovePrimitive(PhysicsPrimitive prim)
- {
- if (prim == null)
- return;
- m_Primitives.Remove(prim);
- }
-
- public void AddAnimator(Animator animator)
- {
- if (m_Animators.Contains(animator))
- return;
- m_Animators.Add(animator);
- }
-
- public void RemoveAnimator(Animator animator)
- {
- if (m_Animators.Contains(animator))
- m_Animators.Remove(animator);
- }
-
- /// <summary>
- /// 物理系统以稳定的逻辑帧率执行
- /// </summary>
- public void Update()
- {
- float preTime = m_TimeCount;
- m_TimeCount = Time.time;
- float deltaTime = m_TimeCount - preTime;
- while (deltaTime > 1f / m_UpdateRate)
- {
- BeforeTick();
- onBeforeUpdate?.Invoke();
- Tick();
- onUpdate?.Invoke();
- deltaTime -= 1f / m_UpdateRate;
- }
- m_TimeCount -= deltaTime;
- }
-
- // 更新之前
- private void BeforeTick()
- {
- m_CollisionInfo.Clear();
- }
-
- public void DrawGizmos()
- {
-#if UNITY_EDITOR
- if (m_Contacts.Count == 0)
- return;
-
- for(int i = 0; i < m_Contacts.Count; ++i)
- {
- Vector3 center = m_Contacts[i];
- Gizmos.DrawSphere(center, 0.05f);
- }
-#endif
- }
-
-
- void Tick()
- {
- float deltaTime = 1f / m_UpdateRate;
- // animator -> OnAnimatorMove() -> physics
- //UpdateAnimator(deltaTime);
- UpdatePrimitives(deltaTime);
- }
-
- // 更新动画,并处理OnAnimatorMove()
- void UpdateAnimator(float deltaTime)
- {
- for (int i = 0; i < m_Animators.Count; ++i)
- {
- Animator animator = m_Animators[i];
- animator.speed = 1;
- animator.Update(deltaTime);
- animator.speed = 0;
- }
- }
-
- // 更新物理系统
- void UpdatePrimitives(float deltaTime)
- {
-#if UNITY_EDITOR
- m_Contacts.Clear();
-#endif
-
- PhysicsCollisionInfo info = new PhysicsCollisionInfo();
-
- // 1) 处理刚体的动力学
- for (int i = 0; i < m_Primitives.Count; ++i)
- {
- PhysicsPrimitive prim = m_Primitives[i];
- PhysicsBody body = prim.Body;
- if (body == null)
- continue;
- HandleDynamics(prim, deltaTime);
- }
-
- // 2) 处理碰撞
- for (int i = 0; i < m_Primitives.Count; ++i)
- {
- PhysicsPrimitive prim1 = m_Primitives[i];
- if (!prim1.IsActive)
- continue;
-
- for (int j = i + 1; j < m_Primitives.Count; ++j)
- {
- PhysicsPrimitive prim2 = m_Primitives[j];
-
- int minGroup = Mathf.Min((int)prim1.Group, (int)prim2.Group);
- int maxGroup = Mathf.Max((int)prim1.Group, (int)prim2.Group);
- int index = minGroup * (int)PhysicsGroup.GroupCount + (int)PhysicsGroup.GroupCount - maxGroup - 1;
- if (m_CollisionTable[index] == 0)
- continue;
-
- if (prim1.Label == prim2.Label)
- continue;
-
- if (PhysicsHelper.PrimvsPrim(prim1, prim2, ref info))
- {
- SolveCollision(prim1, info, deltaTime);
- SolveCollision(prim2, info, deltaTime);
- m_CollisionInfo.Add(info);
-
-#if UNITY_EDITOR
- m_Contacts.Add(info.contact);
-#endif
- }
- }
- }
-
- // 3) 处理刚体的约束,必须在最后处理
- for (int i = 0; i < m_Primitives.Count; ++i)
- {
- PhysicsPrimitive prim = m_Primitives[i];
- PhysicsBody body = prim.Body;
- if (body == null)
- continue;
- HandleConstrain(prim, deltaTime);
- }
-
- }
-
- /// <summary>
- /// 处理动力学
- /// </summary>
- /// <param name="prim"></param>
- /// <param name="deltaTime"></param>
- void HandleDynamics(PhysicsPrimitive prim, float deltaTime)
- {
- PhysicsBody body = prim.Body;
- if (body == null)
- return;
-
- Vector3 position = body.transform.position;
- Vector3 velocity = body.Velocity;
-
- // 重力
- if(body.UseGravity)
- {
- velocity += m_Gravity * deltaTime;
- }
-
- // 受力(冲量)
- Vector3 impluse = body.Force * deltaTime;
- Vector3 deltaV = impluse / body.Weight;
- velocity += deltaV;
-
- if (prim.IsOnGround)
- {
- // 地面摩擦力
- if (body.Velocity.x != 0 && body.GroundFriction != 0)
- {
- float dv = body.GroundFriction * deltaTime;
- dv = Mathf.Min(dv, Mathf.Abs(body.Velocity.x));
- dv = body.Velocity.x > 0 ? -dv : dv;
- velocity.x += dv;
- }
- }
-
- if (prim.IsInAir)
- {
- // 空气阻力
- if(body.Velocity.x != 0 && body.AirFriction != 0)
- {
- float dv = body.AirFriction * deltaTime;
- dv = Mathf.Min(dv, Mathf.Abs(body.Velocity.x));
- dv = body.Velocity.x > 0 ? -dv : dv;
- velocity.x += dv;
- }
- }
-
- position += velocity * deltaTime;
-
- body.Velocity = velocity;
- body.transform.position = position;
- body.SetForce(Vector3.zero);
- }
-
- /// <summary>
- /// 处理物体的环境(地面、墙体)约束
- /// </summary>
- /// <param name="prim"></param>
- /// <param name="deltaTime"></param>
- void HandleConstrain(PhysicsPrimitive prim, float deltaTime)
- {
- PhysicsBody body = prim.Body;
- if (body == null)
- return;
-
- Vector3 position = body.transform.position;
- Vector3 velocity = body.Velocity;
-
- if (prim.IsOnGround)
- {
- position.y = PhysicsWorld.Ground;
- velocity.y = 0;
- }
-
- body.transform.position = position;
- body.Velocity = velocity;
- }
-
- void SolveCollision(PhysicsPrimitive prim, PhysicsCollisionInfo collision, float deltaTime)
- {
- PhysicsPrimitive other = collision.prim1 == prim ? collision.prim2 : collision.prim1;
-
- // 1. 对于刚体,根据碰撞对位置进行约束
- if(prim.Body != null)
- {
- Vector3 pos = prim.Body.transform.position;
- if(collision.size.x <= collision.size.y)
- {
- float offsetX = Mathf.Min(collision.size.x / 2f, 0.8f);
- pos.x += prim.Position.x > collision.contact.x ? offsetX : -offsetX;
- }
- else
- {
- float offsetY = Mathf.Min(collision.size.y / 2f, 0.1f);
- pos.y += prim.Position.y > collision.contact.y ? offsetY : -offsetY;
- }
- prim.Body.transform.position = pos;
- }
-
- return;
- }
-
- // prim在当前帧是否有碰撞
- public bool HasCollision(PhysicsPrimitive prim)
- {
- for(int i = 0; i < m_CollisionInfo.Count; ++i)
- {
- PhysicsCollisionInfo info = m_CollisionInfo[i];
- if(info.prim1 == prim || info.prim2 == prim)
- {
- return true;
- }
- }
- return false;
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Physics/PhysicsWorld.cs.meta b/Assets/Scripts/Physics/PhysicsWorld.cs.meta deleted file mode 100644 index febf844d..00000000 --- a/Assets/Scripts/Physics/PhysicsWorld.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 35e8dc39af163994ba23b57f51d397f2 -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 deleted file mode 100644 index 77d7b251..00000000 --- a/Assets/Scripts/Projectile.meta +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index ba325302..00000000 --- a/Assets/Scripts/Projectile/Projectile.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public struct ProjectileInfo
-{
- public string name;
- public string tag;
- public EventProjectile.EMoveType moveType;
- public UnitController owner;
- public Vector3 position;
- public Vector3 rotation;
- public Vector3 scale;
- public Vector3 velocity;
- public Vector3 acceleration;
- public bool towardDirection;
- public float lifetime;
- public bool useGravity;
- public string sparkPath;
-}
-
-public class Projectile : MonoBehaviour
-{
- public enum EBoxType
- {
- Single = 0,
- Multiple = 1,
- Grid = 2,
- }
-
- #region 序列化数据
- public EBoxType type;
-
- public Box collider;
-
- public List<Box> colliders;
-
- public Box colliderGrid;
- public Vector3 slice;
- #endregion
-
- //名字,可以用来识别这个projectile
- public new string name;
-
- //标签,可以用来做一些标记
- public new string tag;
-
- public EventProjectile.EMoveType moveType;
-
- [HideInInspector]
- public UnitController owner;
-
- [HideInInspector]
- public bool isActive;
-
- [HideInInspector]
- public Vector3 velocity; // 初始速度
-
- [HideInInspector]
- public Vector3 acceleration; // 加速度
-
- [HideInInspector]
- public bool towardDirection; // foward朝向运动的方向
-
- [HideInInspector]
- public float lifetime;
-
- public string sparkPath;
-
- private List<int> m_Hitmask;
-
- public float time;
-
- private bool markDestroy;
-
- public void Initialize(ProjectileInfo info)
- {
- this.name = info.name;
- this.tag = info.tag;
- this.moveType = info.moveType;
- this.owner = info.owner;
- this.transform.rotation = Quaternion.Euler(info.rotation);
- this.transform.position = info.position;
- this.transform.localScale.Scale(info.scale);
- this.velocity = info.velocity;
- this.acceleration = info.acceleration;
- this.lifetime = info.lifetime;
- this.sparkPath = info.sparkPath;
-
- markDestroy = false;
-
- time = 0;
-
- m_Hitmask = new List<int>();
- }
-
- void OnEnable()
- {
- ColliderRegistry.Instance.AddProjectile(this);
- }
-
- public void Update()
- {
- Update(Time.deltaTime);
- }
-
- public void Update(float deltaTime)
- {
- if(moveType == EventProjectile.EMoveType.Kinematic)
- {
- this.velocity += this.acceleration * deltaTime;
- this.transform.position += this.velocity * deltaTime;
- }
- time += deltaTime;
- if (time > this.lifetime || markDestroy)
- {
- DestroyImmediate(this.gameObject);
- }
- }
-
- void OnDestroy()
- {
- ColliderRegistry.Instance.RemoveProjectile(this);
- }
-
- public IEnumerable GetCollidersInWorldSpace()
- {
- if(type == EBoxType.Single)
- {
- Box box = collider;
- box.center = transform.position + collider.center;
- yield return box;
- }
- else if(type == EBoxType.Multiple)
- {
- for(int i = 0; i < colliders.Count; ++i)
- {
- Box box = colliders[i];
- box.center = transform.position + box.center;
- yield return box;
- }
- }
- else if(type == EBoxType.Grid)
- {
- Vector3 lowerCornor = colliderGrid.center - colliderGrid.size / 2;
- Vector3 cellSize = Vector3.Scale(colliderGrid.size, new Vector3(1f / slice.x, 1f / slice.y, 1f / slice.z));
- for (int x = 0; x < slice.x; ++x)
- {
- for(int y = 0; y < slice.y; ++y)
- {
- for(int z = 0; z < slice.z; ++z)
- {
- Vector3 xyz = new Vector3(x, y, z);
- Box box = new Box();
- box.size = cellSize;
- box.center = lowerCornor + transform.position + Vector3.Scale(cellSize, xyz) + Vector3.Scale(cellSize, new Vector3(0.5f, 0.5f, 0.5f));
- yield return box;
- }
- }
- }
- }
- yield break;
- }
-
- private void OnDrawGizmos()
- {
- Gizmos.color = Color.red * 0.5f;
- foreach(var itor in GetCollidersInWorldSpace())
- {
- Box box = (Box)itor;
- Gizmos.DrawCube(box.center, box.size);
- }
- }
-
- public bool CanHit(int target)
- {
- return !m_Hitmask.Contains(target);
- }
-
- public void RecordTarget(int targethash)
- {
- m_Hitmask.Add(targethash);
- }
-
- public void OnShot(CollisionInfo collision)
- {
- GameObject spark = ResourceManager.Instance.LoadAsset<GameObject>(sparkPath);
- if (spark)
- {
- GameObject obj = GameObject.Instantiate(spark);
-#if UNITY_EDITOR
- obj.transform.SetParent(TimelineEventProxy.Root_Particles.transform);
-#endif
- obj.transform.position = collision.collidee.unitCollider.owner.center;
-
- markDestroy = true;
- }
- }
-
- public bool HasTag(string tag)
- {
- return this.tag != null && this.tag.Contains(tag);
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Projectile/Projectile.cs.meta b/Assets/Scripts/Projectile/Projectile.cs.meta deleted file mode 100644 index 62f134f1..00000000 --- a/Assets/Scripts/Projectile/Projectile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 8542b12f..00000000 --- a/Assets/Scripts/Projectile/ProjectileHook.cs +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 2fc67005..00000000 --- a/Assets/Scripts/Projectile/ProjectileHook.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05206e0405d80df41b7374518fba41a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Props.meta b/Assets/Scripts/Props.meta deleted file mode 100644 index bb96602e..00000000 --- a/Assets/Scripts/Props.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f299520ed9fcf4a45858ad4ef5a8d5d1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering.meta b/Assets/Scripts/Rendering.meta deleted file mode 100644 index b2cccc29..00000000 --- a/Assets/Scripts/Rendering.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b102672570dd0d946bb29c221b22f3f3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomLight.cs b/Assets/Scripts/Rendering/CustomLight.cs deleted file mode 100644 index 404dee12..00000000 --- a/Assets/Scripts/Rendering/CustomLight.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class CustomLight : MonoBehaviour -{ - // Start is called before the first frame update - void OnEnable() - { - CustomLightRegistry.Instance.Register(this); - } - - // Update is called once per frame - void OnDisable() - { - CustomLightRegistry.Instance.Unregister(this); - } -} - -public class CustomLightRegistry : Singleton<CustomLightRegistry> -{ - private List<CustomLight> m_Lights; - public List<CustomLight> lights - { - get - { - if (m_Lights == null) - m_Lights = new List<CustomLight>(); - return m_Lights; - } - } - - public void Register(CustomLight renderer) - { - if (!lights.Contains(renderer)) - { - lights.Add(renderer); - } - } - - public void Unregister(CustomLight renderer) - { - lights.Remove(renderer); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Rendering/CustomLight.cs.meta b/Assets/Scripts/Rendering/CustomLight.cs.meta deleted file mode 100644 index 51106c9d..00000000 --- a/Assets/Scripts/Rendering/CustomLight.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d07937a2b7582554e9ec6ba1fcf41504 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomLighting.cs b/Assets/Scripts/Rendering/CustomLighting.cs deleted file mode 100644 index 57597e21..00000000 --- a/Assets/Scripts/Rendering/CustomLighting.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class CustomLightingSystem : Singleton<CustomLightingSystem>
-{
-
-
-}
diff --git a/Assets/Scripts/Rendering/CustomLighting.cs.meta b/Assets/Scripts/Rendering/CustomLighting.cs.meta deleted file mode 100644 index c1f70391..00000000 --- a/Assets/Scripts/Rendering/CustomLighting.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 483db9507b5e5924a86daaffdf7e33cc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomRenderer.cs b/Assets/Scripts/Rendering/CustomRenderer.cs deleted file mode 100644 index 07c6ec7f..00000000 --- a/Assets/Scripts/Rendering/CustomRenderer.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-[RequireComponent(typeof(Renderer))]
-public class CustomRenderer : MonoBehaviour
-{
- public new Renderer renderer { get; private set; }
-
- void OnEnable()
- {
- renderer = GetComponent<Renderer>();
-
- CustomRendererRegistry.Instance.Register(this);
- }
-
- void OnDisable()
- {
- CustomRendererRegistry.Instance.Unregister(this);
- }
-
-}
-
-public class CustomRendererRegistry : Singleton<CustomRendererRegistry>
-{
- private List<CustomRenderer> m_Renderers;
- public List<CustomRenderer> renderers
- {
- get
- {
- if (m_Renderers == null)
- m_Renderers = new List<CustomRenderer>();
- return m_Renderers;
- }
- }
-
- public void Register(CustomRenderer renderer)
- {
- if(!renderers.Contains(renderer))
- {
- renderers.Add(renderer);
- }
- }
-
- public void Unregister(CustomRenderer renderer)
- {
- renderers.Remove(renderer);
- }
-
-}
diff --git a/Assets/Scripts/Rendering/CustomRenderer.cs.meta b/Assets/Scripts/Rendering/CustomRenderer.cs.meta deleted file mode 100644 index b9742494..00000000 --- a/Assets/Scripts/Rendering/CustomRenderer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c37c88af4ec59ad47ab867ec63cd0d76 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs b/Assets/Scripts/Rendering/CustomRenderingPipeline.cs deleted file mode 100644 index befeed87..00000000 --- a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -// 相机的自定义管线 -// 混合延迟渲染和前向渲染 -[RequireComponent(typeof(MainCamera))] -public class CustomRenderingPipeline : MonoBehaviour -{
- [Tooltip("开启自定义延迟渲染")]
- public bool enableDeferredRender;
-
- public delegate void RenderEventHandler();
- // UnitPreprocessing, UnitLensEffect, etc
- public event RenderEventHandler onPreCull;
- public event RenderEventHandler onPreRender;
- public event RenderEventHandler onPostRender;
-
- Camera m_Camera;
-
- // command buffers
- CommandBuffer m_CommandBufferAfterDepth;
-
- RenderTargetIdentifier[] m_GBuffer = new RenderTargetIdentifier[2];
- RenderTargetIdentifier m_DepthBuffer;
- RenderTexture m_GBufferTextureNormal;
- RenderTexture m_GBufferTexturePosition;
-
- void OnEnable()
- {
- m_Camera = GetComponent<Camera>();
-
- // command buffers
- m_CommandBufferAfterDepth = new CommandBuffer();
- m_CommandBufferAfterDepth.name = "Custom RenderPipeline GBuffer";
- m_Camera.AddCommandBuffer(CameraEvent.AfterDepthTexture, m_CommandBufferAfterDepth);
-
- // render targets
- int width = m_Camera.pixelWidth, height = m_Camera.pixelHeight;
- m_GBufferTextureNormal = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
- m_GBufferTexturePosition = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
- m_GBuffer[0] = m_GBufferTextureNormal.colorBuffer;
- m_GBuffer[1] = m_GBufferTexturePosition.colorBuffer;
- m_DepthBuffer = m_GBufferTextureNormal.depthBuffer;
- } - - void OnDisable()
- {
- m_Camera.RemoveAllCommandBuffers();
- } -
- void OnPreCull()
- {
- m_CommandBufferAfterDepth.Clear();
-
- RenderGBuffer();
-
- onPreCull?.Invoke();
- }
-
- void OnPreRender()
- {
- onPreRender?.Invoke();
- }
-
- void OnPostRender()
- {
- onPostRender?.Invoke();
- }
-
- void RenderGBuffer()
- {
- CommandBuffer cb = m_CommandBufferAfterDepth;
- cb.SetRenderTarget(m_GBuffer, m_DepthBuffer);
- cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
- List<CustomRenderer> renderers = CustomRendererRegistry.Instance.renderers;
- Material mat = new Material(Shader.Find(StaticDefine.shaders[EShader.GBuffer].name));
- for(int i = 0; i < renderers.Count; ++i)
- {
- CustomRenderer renderer = renderers[i];
- if (renderer == null)
- continue;
- cb.DrawRenderer(renderer.renderer, mat);
- }
- } -
-}
\ No newline at end of file diff --git a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs.meta b/Assets/Scripts/Rendering/CustomRenderingPipeline.cs.meta deleted file mode 100644 index 1a3cac2c..00000000 --- a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aaca34c56e4ce4f41a13d30db14959aa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/RenderingUtility.cs b/Assets/Scripts/Rendering/RenderingUtility.cs deleted file mode 100644 index 5313f59d..00000000 --- a/Assets/Scripts/Rendering/RenderingUtility.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Rendering; -
-// https://docs.unity3d.com/Manual/GraphicsCommandBuffers.html
-// https://docs.unity3d.com/ScriptReference/Rendering.CameraEvent.html
-
-// 前向渲染的camera events
-// * DepthTexture
-// * DepthNormalTexture
-// * ForwardOpaque
-// * ImageEffectsOpaque
-// * Skybox
-// * ForwardAlpha
-// * ImageEffects
-// * Everything
- -[Flags] -public enum ERenderingEvent
-{
- None = 0,
- BeforeDepthTexture = 1,
- BeforeDepthNormalsTexture = 1 << 1,
- BeforeForwardOpaque = 1 << 2,
- BeforeImageEffectsOpaque = 1 << 3,
- BeforeSkybox = 1 << 4,
- BeforeForwardAlpha = 1 << 5,
- BeforeImageEffects = 1 << 6,
- //BeforeEverything = 1 << 7,
- AfterDepthTexture = 1 << 8,
- AfterDepthNormalsTexture = 1 << 9,
- AfterForwardOpaque = 1 << 10,
- AfterImageEffectsOpaque = 1 << 11,
- AfterSkybox = 1 << 12,
- AfterForwardAlpha = 1 << 13,
- AfterImageEffects = 1 << 14,
- AfterEverything = 1 << 15,
-} -
-public static class RenderingUtility -{
- public static Dictionary<ERenderingEvent, CameraEvent> renderingEventToCameraEventDic = new Dictionary<ERenderingEvent, CameraEvent> {
- {ERenderingEvent.BeforeDepthTexture, CameraEvent.BeforeDepthTexture },
- {ERenderingEvent.BeforeDepthNormalsTexture, CameraEvent.BeforeDepthNormalsTexture },
- {ERenderingEvent.BeforeForwardOpaque, CameraEvent.BeforeForwardOpaque },
- {ERenderingEvent.BeforeImageEffectsOpaque, CameraEvent.BeforeImageEffectsOpaque },
- {ERenderingEvent.BeforeSkybox, CameraEvent.BeforeSkybox },
- {ERenderingEvent.BeforeForwardAlpha, CameraEvent.BeforeForwardAlpha },
- {ERenderingEvent.BeforeImageEffects, CameraEvent.BeforeImageEffects },
- {ERenderingEvent.AfterDepthTexture, CameraEvent.AfterDepthTexture },
- {ERenderingEvent.AfterDepthNormalsTexture, CameraEvent.AfterDepthNormalsTexture },
- {ERenderingEvent.AfterForwardOpaque, CameraEvent.AfterForwardOpaque },
- {ERenderingEvent.AfterImageEffectsOpaque, CameraEvent.AfterImageEffectsOpaque },
- {ERenderingEvent.AfterSkybox, CameraEvent.AfterSkybox },
- {ERenderingEvent.AfterForwardAlpha, CameraEvent.AfterForwardAlpha },
- {ERenderingEvent.AfterImageEffects, CameraEvent.AfterImageEffects },
- {ERenderingEvent.AfterEverything, CameraEvent.AfterEverything },
- };
- - public static CameraEvent ToCameraEvent(this ERenderingEvent e)
- {
- return renderingEventToCameraEventDic[e];
- } - - /// <summary>
- /// 计算在rt里面的区域
- /// </summary>
- /// <param name="camera">相机</param>
- /// <param name="worldPos">世界空间坐标</param>
- /// <param name="size">异体矩形(billboard)的相机空间大小</param>
- /// <returns></returns> - public static Vector4 GetTillingOffset(Camera camera, Vector3 worldPos, float sizeInCameraSpace)
- {
- Vector4 tileOffset = new Vector4(1,1,0,0);
- Vector3 camPos = camera.WorldToCameraSpace(worldPos);
-
- Vector3 bottomLeft = new Vector3(camPos.x - sizeInCameraSpace / 2, camPos.y - sizeInCameraSpace / 2, camPos.z);
- Vector3 topRight = new Vector3(camPos.x + sizeInCameraSpace / 2, camPos.y + sizeInCameraSpace / 2, camPos.z);
- Vector2 blViewPos = camera.CameraToViewportSpace(bottomLeft);
- Vector2 trViewPos = camera.CameraToViewportSpace(topRight);
- float width = trViewPos.x - blViewPos.x;
- float height = trViewPos.y - blViewPos.y;
-
- tileOffset.x = width;
- tileOffset.y = height;
- tileOffset.z = blViewPos.x;
- tileOffset.w = blViewPos.y;
- return tileOffset;
- } - -} diff --git a/Assets/Scripts/Rendering/RenderingUtility.cs.meta b/Assets/Scripts/Rendering/RenderingUtility.cs.meta deleted file mode 100644 index 83570ebb..00000000 --- a/Assets/Scripts/Rendering/RenderingUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bc9ab0eb4b2a0754e9bb9ec7a2f945c4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Robot.meta b/Assets/Scripts/Robot.meta deleted file mode 100644 index 0b5a087e..00000000 --- a/Assets/Scripts/Robot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7c09ca1609552d24bbe697d1516f8aa9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test 1.meta b/Assets/Scripts/Test 1.meta deleted file mode 100644 index ef660dbc..00000000 --- a/Assets/Scripts/Test 1.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 02d40347e569d05489e932435bcb84ef -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test 1/TestErika.cs b/Assets/Scripts/Test 1/TestErika.cs deleted file mode 100644 index 4ae41d78..00000000 --- a/Assets/Scripts/Test 1/TestErika.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[Serializable] -public class UnitSetUp
-{
- public UnitActionData actionData; // 动作配置
-
- public GameObject unitControllerPrefab;
-
- public GameObject unitPrefab;
-
- public RuntimeAnimatorController animController;
-
- public string unitFolder;
-
- [HideInInspector]
- public GameObject unit;
-
- [HideInInspector]
- public GameObject unitController; - - [HideInInspector]
- public UnitController owner; -} - -public class TestErika : SingletonMB<TestErika> -{ - public UnitSetUp erika; - public UnitSetUp monster;
- public GameObject unitEffect;
-
- protected override void Awake() - { - base.Awake(); - SetupErika(); - SetupMonster(); - UnitImageEffect.effectPlane = unitEffect; - } - - private void Update()
- {
- if (Input.GetKeyDown("r"))
- {
- erika.unitController.transform.position = Vector3.zero;
- erika.unitController.transform.rotation = Quaternion.identity;
-
- monster.unitController.transform.position = new Vector3(2, 0, 0);
- monster.unitController.transform.rotation = Quaternion.Euler(0, 180, 0);
- }
- } - - void SetupErika()
- {
- erika.unitController = GameObject.Instantiate(erika.unitControllerPrefab);
- erika.unitController.transform.position = Vector3.zero;
- erika.unitController.transform.rotation = Quaternion.identity;
-
- erika.unit = GameObject.Instantiate(erika.unitPrefab);
- erika.unit.transform.position = Vector3.zero;
- erika.unit.transform.rotation = Quaternion.Euler(0, 90, 0);
- erika.unit.transform.SetParent(erika.unitController.transform);
-
- UnitController unitCtr = erika.unitController.GetOrAddComponent<UnitController>();
- unitCtr.Initialize(erika.unit, erika.unitFolder);
-
- UnitRootMotion unitRootMotion = unitCtr.unitRootMotion;
-
- RootMotionProxy rootMotionProxy = erika.unit.GetOrAddComponent<RootMotionProxy>();
-
- Animator animator = erika.unit.GetComponent<Animator>();
- //AnimatorOverrideController animCtr = new AnimatorOverrideController(erika.animController);
- //animCtr.name = erika.unitPrefab.name + " Override Controller";
- //foreach(var anim in erika.actionData.actions)
- //{
- // animCtr[anim.Key] = anim.Value;
- //}
- animator.runtimeAnimatorController = erika.animController;
-
- Debug.Assert(animator.runtimeAnimatorController is AnimatorOverrideController);
-
- unitCtr.pcState.ChangeState(PCState.EUnitState.Idle, new PCState.IdleParam(), true);
-
- ////////////////////////////////
-
- UnitManager.Instance.SetPlayerCharacter(unitCtr as PCController);
- } - - void SetupMonster()
- {
- monster.unitController = GameObject.Instantiate(monster.unitControllerPrefab);
- monster.unitController.transform.position = Vector3.zero;
- monster.unitController.transform.rotation = Quaternion.identity;
-
- monster.unit = GameObject.Instantiate(monster.unitPrefab);
- monster.unit.transform.rotation = Quaternion.Euler(0, 90, 0);
- monster.unit.transform.SetParent(monster.unitController.transform);
-
- UnitController unitCtr = monster.unitController.GetOrAddComponent<UnitController>();
- unitCtr.Initialize(monster.unit, monster.unitFolder);
-
- UnitRootMotion unitRootMotion = unitCtr.unitRootMotion;
-
- RootMotionProxy rootMotionProxy = monster.unit.GetOrAddComponent<RootMotionProxy>();
-
- Animator animator = monster.unit.GetComponent<Animator>();
- AnimatorOverrideController animCtr = new AnimatorOverrideController(monster.animController);
- animCtr.name = monster.unitPrefab.name + " Override Controller";
- animator.runtimeAnimatorController = animCtr;
-
- unitCtr.monsterState.ChangeState(MonsterState.EUnitState.Idle, new MonsterState.IdleParam(), true);
-
- monster.unitController.transform.position = new Vector3(2, 0, 0);
- monster.unitController.transform.rotation *= Quaternion.Euler(0, 180, 0);
-
- monster.owner = unitCtr;
- } - -} diff --git a/Assets/Scripts/Test 1/TestErika.cs.meta b/Assets/Scripts/Test 1/TestErika.cs.meta deleted file mode 100644 index 53aeb6eb..00000000 --- a/Assets/Scripts/Test 1/TestErika.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7e8dd0fc77853444395ec5d0f8acdc25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test 1/TestInput.cs b/Assets/Scripts/Test 1/TestInput.cs deleted file mode 100644 index 1a43f108..00000000 --- a/Assets/Scripts/Test 1/TestInput.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestInput : MonoBehaviour -{ - - private void Update() - { - InputManager.Instance.OnUpdate(); - } - -} diff --git a/Assets/Scripts/Test 1/TestInput.cs.meta b/Assets/Scripts/Test 1/TestInput.cs.meta deleted file mode 100644 index aeb1587e..00000000 --- a/Assets/Scripts/Test 1/TestInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 78d3bc54e34721e468d0541fb5c0c839 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test.meta b/Assets/Scripts/Test.meta deleted file mode 100644 index 621e777a..00000000 --- a/Assets/Scripts/Test.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 906e343a27f8821469540ac2c34f2a1c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/AimTest.cs b/Assets/Scripts/Test/AimTest.cs deleted file mode 100644 index d69c4a41..00000000 --- a/Assets/Scripts/Test/AimTest.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class AimTest : MonoBehaviour
-{
- public GameObject Go_ConstainObj;
-
- public GameObject Go_AimTarget;
-
- public void LateUpdate()
- {
- Go_ConstainObj.transform.LookAt(Go_AimTarget.transform);
- }
-
-}
diff --git a/Assets/Scripts/Test/AimTest.cs.meta b/Assets/Scripts/Test/AimTest.cs.meta deleted file mode 100644 index 8ce108cb..00000000 --- a/Assets/Scripts/Test/AimTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 14b31a10863e5634bb77b3ab2ad9941b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/ArmorSoldierScript.cs b/Assets/Scripts/Test/ArmorSoldierScript.cs deleted file mode 100644 index c86ca009..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class ArmorSoldierScript : Avatar, IInteractable -{ - public Animator m_Animator; - - void Awake()
- {
- m_Animator = GetComponent<Animator>();
- } - - private void Start()
- {
- base.Init();
-
- SetupAnim();
- SetupStates();
- }
-
- private void OnAnimatorMove() - { - Animator animator = GetComponent<Animator>();
-
- AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
-
- // animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果
- // 在后面做一个硬性约束z=0,将角色限制在z=0平面上
- if (stateInfo.IsTag("IgnoreRootMotion"))
- {
- // ignore root motion
- //Debug.Log("ignore root motion ");
- }
- else
- { - Vector3 position = transform.position; - position.x += animator.deltaPosition.x; - position.y += animator.deltaPosition.y; - transform.position = position; - - // animation clip导入设置旋转一般上设置为baked inpose,不需要手动限制 - transform.rotation *= animator.deltaRotation; - } - } - - public void Hurt()
- {
- } - - public override void OnHurt(HurtInfo hurtInfo)
- {
- base.OnHurt(hurtInfo);
- Hurt();
- } - -} diff --git a/Assets/Scripts/Test/ArmorSoldierScript.cs.meta b/Assets/Scripts/Test/ArmorSoldierScript.cs.meta deleted file mode 100644 index eeb0f056..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c58b0c0555555e4c9fbd344b5162103 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs b/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs deleted file mode 100644 index fd632ab7..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class ArmorSoldierScript : Avatar, IInteractable -{ - int Anim_Idle; - - int Anim_HurtFront; - - int Anim_LightHurt; - int Anim_MidiumHurt; - int Anim_HeavyHurt; - int Anim_GroundHurt; - int Anim_AirHurt;
-
- int Anim_GetUp; - - - void SetupAnim() - { - Anim_Idle = Animator.StringToHash("Idle"); - - Anim_HurtFront = Animator.StringToHash("Hurt_Front"); - Anim_LightHurt = Animator.StringToHash("Hurt_Light"); - Anim_MidiumHurt = Animator.StringToHash("Hurt_Midium"); - Anim_HeavyHurt = Animator.StringToHash("Hurt_Heavy"); - Anim_GroundHurt = Animator.StringToHash("Hurt_Ground"); - Anim_AirHurt = Animator.StringToHash("Hurt_Air"); - - Anim_GetUp = Animator.StringToHash("GetUp"); -
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs.meta b/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs.meta deleted file mode 100644 index 212feda4..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript_Anim.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5ff0f58fdd1c9834e858aa0dda2b0ff8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/ArmorSoldierScript_States.cs b/Assets/Scripts/Test/ArmorSoldierScript_States.cs deleted file mode 100644 index 3df583f2..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript_States.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class ArmorSoldierScript : Avatar, IInteractable -{ - - void SetupStates() - { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // states - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - IdleState idle = new IdleState(m_Animator, Anim_Idle); - - HurtState lightHurt = new HurtState(m_Animator, Anim_LightHurt); - HurtState midiumHurt = new HurtState(m_Animator, Anim_MidiumHurt); - HurtState heavyHurt = new HurtState(m_Animator, Anim_HeavyHurt); - HurtState groundHurt = new HurtState(m_Animator, Anim_GroundHurt); - HurtState airHurt = new HurtState(m_Animator, Anim_AirHurt); - m_StateLightHurt = lightHurt; - m_StateMidiumHurt = midiumHurt; - m_StateHeavyHurt = heavyHurt; - m_StateGroundHurt = groundHurt; - m_StateAirHurt = airHurt; - - HurtState getUp = new HurtState(m_Animator, Anim_GetUp); -
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // conditions
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ConditionInAir condInAir = new ConditionInAir(m_BodyCollider); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // actions - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ActionSwitchState switchToIdle = new ActionSwitchState(m_StateController, idle); - ActionSwitchState switchToGetUp = new ActionSwitchState(m_StateController, getUp); - - Trigger trigger = null;
-
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // state setup
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- // light hurt
- ConditionMotionAtEnd lightHurtAtEnd = new ConditionMotionAtEnd(m_Animator, Anim_LightHurt);
- trigger = new Trigger(lightHurtAtEnd, switchToIdle); - lightHurt.AddTrigger(trigger); -
- // air hurt
- ConditionMotionAtEnd airAtEnd = new ConditionMotionAtEnd(m_Animator, Anim_AirHurt); - trigger = new Trigger(And(airAtEnd, Not(condInAir)), switchToGetUp); - airHurt.AddTrigger(trigger); - - // getup - ConditionMotionAtEnd getUpEnd = new ConditionMotionAtEnd(m_Animator, Anim_GetUp); - trigger = new Trigger(getUpEnd, switchToIdle); - getUp.AddTrigger(trigger); - - m_StateController.ForceStart(idle); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Test/ArmorSoldierScript_States.cs.meta b/Assets/Scripts/Test/ArmorSoldierScript_States.cs.meta deleted file mode 100644 index 02336b68..00000000 --- a/Assets/Scripts/Test/ArmorSoldierScript_States.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f146c570f99fe2e4aad5f1312524413c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/CentreTest.cs b/Assets/Scripts/Test/CentreTest.cs deleted file mode 100644 index b921cc59..00000000 --- a/Assets/Scripts/Test/CentreTest.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class CentreTest : MonoBehaviour
-{
-
- public Transform Trans_Saionji_Left;
- public Transform Trans_Saionji_Right;
-
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
- transform.position = (Trans_Saionji_Left.position + Trans_Saionji_Right.position ) / 2;
- }
-}
diff --git a/Assets/Scripts/Test/CentreTest.cs.meta b/Assets/Scripts/Test/CentreTest.cs.meta deleted file mode 100644 index 26344c97..00000000 --- a/Assets/Scripts/Test/CentreTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eaed63c01c9585646a42db13922e420a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/FootIKTest.cs b/Assets/Scripts/Test/FootIKTest.cs deleted file mode 100644 index 5b939619..00000000 --- a/Assets/Scripts/Test/FootIKTest.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class FootIKTest : MonoBehaviour
-{
-
- Animator anim;
-
- public LayerMask layerMask;
-
- [Range(0, 1f)]
- public float DistanceToGround;
-
- private void Start()
- {
-
- anim = GetComponent<Animator>();
-
- }
-
- private void OnAnimatorIK(int layerIndex)
- {
-
- if (anim)
- {
-
- anim.SetIKPositionWeight(AvatarIKGoal.LeftFoot, anim.GetFloat("IKLeftFootWeight"));
- anim.SetIKRotationWeight(AvatarIKGoal.LeftFoot, anim.GetFloat("IKLeftFootWeight"));
- anim.SetIKPositionWeight(AvatarIKGoal.RightFoot, anim.GetFloat("IKRightFootWeight"));
- anim.SetIKRotationWeight(AvatarIKGoal.RightFoot, anim.GetFloat("IKRightFootWeight"));
-
- // Left Foot
- RaycastHit hit;
- Ray ray = new Ray(anim.GetIKPosition(AvatarIKGoal.LeftFoot) + Vector3.up, Vector3.down);
- if (Physics.Raycast(ray, out hit, DistanceToGround + 1f, layerMask))
- {
- if (hit.transform.tag == "Walkable")
- {
- Vector3 footOriginForward = anim.GetBoneTransform(HumanBodyBones.LeftFoot).forward;
- Vector3 footPosition = hit.point;
- footPosition.y += DistanceToGround;
- anim.SetIKPosition(AvatarIKGoal.LeftFoot, footPosition);
- anim.SetIKRotation(AvatarIKGoal.LeftFoot, Quaternion.LookRotation(footOriginForward - Vector3.Dot(footOriginForward, hit.normal) *(hit.normal), hit.normal));
- }
- }
-
- // Right Foot
- ray = new Ray(anim.GetIKPosition(AvatarIKGoal.RightFoot) + Vector3.up, Vector3.down);
- if (Physics.Raycast(ray, out hit, DistanceToGround + 1f, layerMask))
- {
-
- if (hit.transform.tag == "Walkable")
- {
- Vector3 footOriginForward = anim.GetBoneTransform(HumanBodyBones.RightFoot).forward;
- Vector3 footPosition = hit.point;
- footPosition.y += DistanceToGround;
- anim.SetIKPosition(AvatarIKGoal.RightFoot, footPosition);
- anim.SetIKRotation(AvatarIKGoal.RightFoot, Quaternion.LookRotation(footOriginForward - Vector3.Dot(footOriginForward, hit.normal) * (hit.normal), hit.normal));
- }
-
- }
-
-
- }
-
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Test/FootIKTest.cs.meta b/Assets/Scripts/Test/FootIKTest.cs.meta deleted file mode 100644 index 7810f3e2..00000000 --- a/Assets/Scripts/Test/FootIKTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 085a845c7a7e3fe48baa79d4cda91183 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/HitBoxTest.cs b/Assets/Scripts/Test/HitBoxTest.cs deleted file mode 100644 index 139ec287..00000000 --- a/Assets/Scripts/Test/HitBoxTest.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// AABB hitbox
-public class HitBoxTest : MonoBehaviour
-{
- public bool DrawGizmo;
-
- [SerializeField]
- private bool m_IsActive;
-
- [SerializeField]
- private Vector3 m_TopLeft, m_RightBottom;
-
- private void OnDrawGizmos()
- {
- if (!DrawGizmo) return;
- Gizmos.color = Color.green;
- Vector3 topleft = transform.position + m_TopLeft;
- Vector3 rightbottom = transform.position + m_RightBottom;
- Gizmos.DrawCube((topleft + rightbottom) / 2, rightbottom - topleft);
- }
-
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Test/HitBoxTest.cs.meta b/Assets/Scripts/Test/HitBoxTest.cs.meta deleted file mode 100644 index 2d7fb88b..00000000 --- a/Assets/Scripts/Test/HitBoxTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 78c38f462ec6a5b43a2e1e8194924c93 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/IKTest.cs b/Assets/Scripts/Test/IKTest.cs deleted file mode 100644 index fdc5c2a3..00000000 --- a/Assets/Scripts/Test/IKTest.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class IKTest : MonoBehaviour
-{
- public GameObject Go_FootIK;
- [Range(0,1)]
- public float IKWeight;
-
- private Animator animator;
-
- private void Start()
- {
-
- }
-
- private void OnAnimatorIK(int layerIndex)
- {
- if(animator == null)
- {
- animator = GetComponent<Animator>();
- }
-
- animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, IKWeight);
- animator.SetIKPosition(AvatarIKGoal.LeftFoot, Go_FootIK.transform.position);
-
- animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, IKWeight);
- animator.SetIKRotation(AvatarIKGoal.LeftFoot, Go_FootIK.transform.rotation);
-
- }
-
-}
diff --git a/Assets/Scripts/Test/IKTest.cs.meta b/Assets/Scripts/Test/IKTest.cs.meta deleted file mode 100644 index f0cee3c6..00000000 --- a/Assets/Scripts/Test/IKTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d08e197d3e6d2340a4866f2bf7a8447 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/PhysicsWorldTest.cs b/Assets/Scripts/Test/PhysicsWorldTest.cs deleted file mode 100644 index d1c240a5..00000000 --- a/Assets/Scripts/Test/PhysicsWorldTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class PhysicsWorldTest : MonoBehaviour
-{
-
-
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-}
diff --git a/Assets/Scripts/Test/PhysicsWorldTest.cs.meta b/Assets/Scripts/Test/PhysicsWorldTest.cs.meta deleted file mode 100644 index 6e113c78..00000000 --- a/Assets/Scripts/Test/PhysicsWorldTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bef3db5279f15c347a57f806171eaa33 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/RootConstainTest.cs b/Assets/Scripts/Test/RootConstainTest.cs deleted file mode 100644 index 7936fd25..00000000 --- a/Assets/Scripts/Test/RootConstainTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class RootConstainTest : MonoBehaviour
-{
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
-
- private void OnAnimatorMove()
- {
- Animator animator = GetComponent<Animator>();
-
- // 约束z=0
- if (animator)
- {
- Vector3 position = transform.position;
- position.x += animator.deltaPosition.x;
- position.y += animator.deltaPosition.y;
-
- transform.position = position;
-
- transform.rotation *= animator.deltaRotation;
-
- //transform.forward = animator.deltaRotation * transform.forward;
- //Vector3 euler = animator.deltaRotation.ToEuler();
- //euler.x = euler.z = euler.y = 0;
- //transform.rotation *= Quaternion.Euler(euler);
- }
- }
-
-}
diff --git a/Assets/Scripts/Test/RootConstainTest.cs.meta b/Assets/Scripts/Test/RootConstainTest.cs.meta deleted file mode 100644 index c21abeab..00000000 --- a/Assets/Scripts/Test/RootConstainTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c5984537089789644b0e8e326ae83aad -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiCloneScript.cs b/Assets/Scripts/Test/SaionjiCloneScript.cs deleted file mode 100644 index d6ddba86..00000000 --- a/Assets/Scripts/Test/SaionjiCloneScript.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class SaionjiCloneScript : MonoBehaviour -{ - public Animator m_Animator; - - public void OnEnable() - { - int Anim_Idle; - Anim_Idle = Animator.StringToHash("Idle_Fight2"); - m_Animator.CrossFade(Anim_Idle, 0); - } - - public void Update() - { - } - -} diff --git a/Assets/Scripts/Test/SaionjiCloneScript.cs.meta b/Assets/Scripts/Test/SaionjiCloneScript.cs.meta deleted file mode 100644 index 64a58ee0..00000000 --- a/Assets/Scripts/Test/SaionjiCloneScript.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 92d46c9d136abdc46bb8fc83c650891f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript.cs b/Assets/Scripts/Test/SaionjiScript.cs deleted file mode 100644 index 1178b42a..00000000 --- a/Assets/Scripts/Test/SaionjiScript.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class SaionjiScript : Avatar
-{
- public enum Weapon
- {
- Pistol,
- Blade,
- Reaper,
- LongSword,
- }
-
- HitBoxTest hitbox;
- Animator animator;
-
- public GameObject Go_PistolL;
- public GameObject Go_PistolR;
- public GameObject Go_Blade;
- public GameObject Go_Reaper;
- public GameObject Go_LongSword;
-
- [SerializeField]
- private Weapon m_Weapon;
-
- public bool EnableStateController;
-
- public EffectHandler[] Effects;
-
- void Start()
- {
- base.Init();
-
- animator = GetComponent<Animator>();
- //animator.speed = 0;
- PhysicsWorld.Instance.AddAnimator(animator);
-
- Go_PistolL.SetActive(m_Weapon == Weapon.Pistol);
- Go_PistolR.SetActive(m_Weapon == Weapon.Pistol);
- Go_Blade.SetActive(m_Weapon == Weapon.Blade);
- Go_Reaper.SetActive(m_Weapon == Weapon.Reaper);
- Go_LongSword.SetActive(m_Weapon == Weapon.LongSword);
-
- GetAnimHash();
-
- if (EnableStateController)
- SetupStates();
- }
-
- //private void Update()
- //{
- // //if (EnableStateController)
- // // m_StateController.OnUpdate();
- //}
-
- // 更新顺序:
- // internal animator update -> OnAnimatorMove() -> physics
- // 角色最后的位置以物理系统为准(如果加入物理系统的话)
- // 如果后续有物理处理,会重写transform
- // 对于后续不受物理管理的动作,不需要修改transform
- void OnAnimatorMove()
- {
- Animator animator = GetComponent<Animator>();
- if (animator == null)
- return;
-
- AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
-
- if(stateInfo.IsTag("IgnoreRootMotion"))
- {
- // ignore root motion
- //Debug.Log("ignore root motion ");
- }
- else if(stateInfo.IsTag("IgnoreRootMotionY"))
- {
- Vector3 position = transform.position;
- position.x += animator.deltaPosition.x;
- transform.position = position;
-
- transform.rotation *= animator.deltaRotation;
- }
- else
- {
- // animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果
- // 在后面做一个硬性约束z=0,将角色限制在z=0平面上
- Vector3 position = transform.position;
- position.x += animator.deltaPosition.x;
- position.y += animator.deltaPosition.y;
- transform.position = position;
-
- // animation clip导入设置旋转一般上设置为baked inpose,不需要手动限制
- transform.rotation *= animator.deltaRotation;
- }
- }
-
- public override void OnHit(HitInfo hitInfo)
- {
- base.OnHit(hitInfo);
- }
-
- public override void OnHurt(HurtInfo hurtInfo)
- {
- base.OnHurt(hurtInfo);
- }
-
-}
diff --git a/Assets/Scripts/Test/SaionjiScript.cs.meta b/Assets/Scripts/Test/SaionjiScript.cs.meta deleted file mode 100644 index e2123888..00000000 --- a/Assets/Scripts/Test/SaionjiScript.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c2788004f7d291b40a1ac1c11c3bdc3d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript_Anim.cs b/Assets/Scripts/Test/SaionjiScript_Anim.cs deleted file mode 100644 index f5543823..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Anim.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class SaionjiScript : Avatar -{ - int Anim_Idle; - int Anim_Run; - int Anim_RunStop; - int Anim_LightAttack1; - int Anim_LightAttack2; - int Anim_LightAttack3; - int Anim_LightAttack4; - int Anim_LightAttack5; - int Anim_LightAttackRush; - int Anim_SideKick; - int Anim_SideKickRush; - int Anim_DashWithSword; - int Anim_SuperKick; - int Anim_Gun1; - int Anim_Gun2; - int Anim_Gun3; - int Anim_Gun4; - - int Anim_JumpStart;
- int Anim_JumpUp;
- int Anim_JumpDown;
- int Anim_JumpEnd; - - int Anim_AirDash; - int Anim_AirAttack1; - - void GetAnimHash() - { - //Anim_Idle = Animator.StringToHash("Idle_Gun"); - //Anim_Idle = Animator.StringToHash("Idle_Fight"); - //Anim_Idle = Animator.StringToHash("Idle_Fight2"); - Anim_Idle = Animator.StringToHash("Idle_Relax"); - Anim_Idle = Animator.StringToHash("Idle_Stand"); - Anim_Run = Animator.StringToHash("Run_Sword_Fast"); - - Anim_LightAttack1 = Animator.StringToHash("Light_Attk_1"); - Anim_LightAttack2 = Animator.StringToHash("Light_Attk_2"); - Anim_LightAttack3 = Animator.StringToHash("Light_Attk_3"); - Anim_LightAttack4 = Animator.StringToHash("Light_Attk_4"); - Anim_LightAttack5 = Animator.StringToHash("Light_Attk_5"); - Anim_LightAttackRush = Animator.StringToHash("Heavy_Attk_Rush_Third"); - - Anim_SideKick = Animator.StringToHash("SideKick"); - Anim_SideKickRush = Animator.StringToHash("SideKickRush"); - Anim_SuperKick = Animator.StringToHash("SuperKickCombo"); - - Anim_DashWithSword = Animator.StringToHash("Dash_With_Sword"); - - Anim_Gun1 = Animator.StringToHash("Gun01"); - Anim_Gun2 = Animator.StringToHash("Gun02"); - Anim_Gun3 = Animator.StringToHash("Gun03"); - Anim_Gun4 = Animator.StringToHash("Gun04"); - - Anim_JumpStart = Animator.StringToHash("Jump_Start"); - Anim_JumpUp = Animator.StringToHash("Jump_Up"); - Anim_JumpDown = Animator.StringToHash("Jump_Down"); - Anim_JumpEnd = Animator.StringToHash("Jump_End"); - - Anim_AirDash = Animator.StringToHash("Air_Dash"); - Anim_AirAttack1 = Animator.StringToHash("Air_Attk_1"); - } - -} diff --git a/Assets/Scripts/Test/SaionjiScript_Anim.cs.meta b/Assets/Scripts/Test/SaionjiScript_Anim.cs.meta deleted file mode 100644 index 4b9e51ec..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Anim.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8f9ceb597e2e03c45a350f0f607c3d59 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript_Effect.cs b/Assets/Scripts/Test/SaionjiScript_Effect.cs deleted file mode 100644 index 54de744e..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Effect.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class SaionjiScript : Avatar -{ - public override Vector3 GetEffectPosition()
- {
- return m_Hips.position;
- } -} diff --git a/Assets/Scripts/Test/SaionjiScript_Effect.cs.meta b/Assets/Scripts/Test/SaionjiScript_Effect.cs.meta deleted file mode 100644 index d24fd6f2..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Effect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69ccf56f65f14b84a89682dbe0cdb58e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript_Physics.cs b/Assets/Scripts/Test/SaionjiScript_Physics.cs deleted file mode 100644 index b6fcb393..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Physics.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class SaionjiScript : Avatar -{ - -} diff --git a/Assets/Scripts/Test/SaionjiScript_Physics.cs.meta b/Assets/Scripts/Test/SaionjiScript_Physics.cs.meta deleted file mode 100644 index 6dec949e..00000000 --- a/Assets/Scripts/Test/SaionjiScript_Physics.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8efe5825ad2d8454f9bbbeefdd4333f0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript_States.cs b/Assets/Scripts/Test/SaionjiScript_States.cs deleted file mode 100644 index 0ed8eef2..00000000 --- a/Assets/Scripts/Test/SaionjiScript_States.cs +++ /dev/null @@ -1,391 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class SaionjiScript : Avatar -{ - - /// <summary> - /// 设置states - /// </summary> - void SetupStates() - { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // states - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - IdleState idle = new IdleState(animator, Anim_Idle); - - MoveState move = new MoveState(animator, Anim_Run); - MoveState dash = new MoveState(animator, Anim_DashWithSword); - - JumpStateConfig jumpConfig = new JumpStateConfig - { - animator = animator, - collider = m_BodyCollider, - body = m_Body, - neutralJumpSpeedY = 13f, - fowardJumpSpeedX = 5f, - backwardJumpSpeedX = -5f, - animJump = Anim_JumpStart, - animJumpEnd = Anim_JumpEnd, - animNU = Anim_JumpUp, - animND = Anim_JumpDown, - animFU = Anim_JumpUp, - animFD = Anim_JumpDown, - animBU = Anim_JumpUp, - animBD = Anim_JumpDown, - skipStart = true, - }; - JumpState jump = new JumpState(jumpConfig); - - AttackState airDash = new AttackState(animator, Anim_AirDash, m_Body); - - AttackStateConfig config;
-
- //招式会绑定一个motion
- HitDefination hitDef = new HitDefination
- {
- type = HitType.Air, - hurtAddForce = new Vector3(0, 20000, 0),
- sparkName = "Bullet_WhiteSpark",
- sparkHostType = HitSparkHost.Center
- }; - AttackState attk1 = new AttackState(animator, Anim_LightAttack1, m_Body); - attk1.AddHitDefination(hitDef); - AttackState attk2 = new AttackState(animator, Anim_LightAttack2, m_Body); - attk2.AddHitDefination(hitDef); - AttackState attk3 = new AttackState(animator, Anim_LightAttack3, m_Body); - attk3.AddHitDefination(hitDef); - AttackState attk4 = new AttackState(animator, Anim_LightAttack4, m_Body); - attk4.AddHitDefination(hitDef); - AttackState attk5 = new AttackState(animator, Anim_LightAttack5, m_Body); - attk5.AddHitDefination(hitDef); - AttackState attkRush = new AttackState(animator, Anim_LightAttackRush, m_Body); - - config = new AttackStateConfig() { - animator = this.animator, - body = this.m_Body, - motion = Anim_SideKick, - velocity = new Vector3(20, 1.5f, 0) - }; - AttackState sideKick = new AttackState(config); - - AttackState sideKickRush = new AttackState(animator, Anim_SideKickRush, m_Body); - AttackState superKick = new AttackState(animator, Anim_SuperKick, m_Body); - AttackState gun1 = new AttackState(animator, Anim_Gun1, m_Body); - AttackState gun2 = new AttackState(animator, Anim_Gun2, m_Body); - AttackState gun3 = new AttackState(animator, Anim_Gun3, m_Body); - AttackState gun4 = new AttackState(animator, Anim_Gun4, m_Body); - - AttackState airAttk1 = new AttackState(animator, Anim_AirAttack1, m_Body); - hitDef = new HitDefination - { - type = HitType.Air, - hurtAddForce = new Vector3(0,10000,0),
- sparkName = "Bullet_WhiteSpark",
- sparkHostType = HitSparkHost.Center - }; - airAttk1.AddHitDefination(hitDef); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // actions - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ActionTurn180 turn180 = new ActionTurn180(this.transform); - ActionTowardLeft towardLeft = new ActionTowardLeft(this.transform); - ActionTowardRight towardRight = new ActionTowardRight(this.transform); - - ActionJump toJump = new ActionJump(m_StateController, jump); - ActionJumpForward toJumpForward = new ActionJumpForward(m_StateController, jump); - - ActionSwitchState switchToMove = new ActionSwitchState(m_StateController, move); - ActionSwitchState switchToIdle = new ActionSwitchState(m_StateController, idle); - ActionSwitchState switchToAttk1 = new ActionSwitchState(m_StateController, attk1); - ActionSwitchState switchToAttk2 = new ActionSwitchState(m_StateController, attk2); - ActionSwitchState switchToAttk3 = new ActionSwitchState(m_StateController, attk3); - ActionSwitchState switchToAttk4 = new ActionSwitchState(m_StateController, attk4); - ActionSwitchState switchToAttk5 = new ActionSwitchState(m_StateController, attk5); - ActionSwitchState switchToAttkRush = new ActionSwitchState(m_StateController, attkRush); - ActionSwitchState switchToSideKick = new ActionSwitchState(m_StateController, sideKick); - ActionSwitchState switchToSideKickRush = new ActionSwitchState(m_StateController, sideKickRush); - ActionSwitchState switchToDash = new ActionSwitchState(m_StateController, dash); - ActionSwitchState switchToSuperKick = new ActionSwitchState(m_StateController, superKick); - ActionSwitchState switchToGun1 = new ActionSwitchState(m_StateController, gun1); - ActionSwitchState switchToGun2 = new ActionSwitchState(m_StateController, gun2); - ActionSwitchState switchToGun3 = new ActionSwitchState(m_StateController, gun3); - ActionSwitchState switchToGun4 = new ActionSwitchState(m_StateController, gun4); - - ActionSwitchState switchToAirDash = new ActionSwitchState(m_StateController, airDash); - ActionSwitchState switchToAirAttk1 = new ActionSwitchState(m_StateController, airAttk1); - - ActionWipeCmdRecord wipeCmdRecord = new ActionWipeCmdRecord(); - - ActionEffectGhost enableGhost = new ActionEffectGhost(Effects[0] as CharacterGhostEffect); - ActionDisableGhost disableGhost = new ActionDisableGhost(Effects[0] as CharacterGhostEffect); - - ActionActivateAfterImage enableAfterImage = new ActionActivateAfterImage(true); - ActionActivateAfterImage disaleAfterImage = new ActionActivateAfterImage(false); - ActionAfterImageInterval smallAfterImageInterval = new ActionAfterImageInterval(2); - ActionAfterImageInterval midiumAfterImageInterval = new ActionAfterImageInterval(5); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // conditions - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ConditionCommand condLeftCmd = new ConditionCommand(GamepadButton.Left); - ConditionCommand condRightCmd = new ConditionCommand(GamepadButton.Right); - ConditionNoMoveButtonHold condNoMoveButtonHold = new ConditionNoMoveButtonHold(); - ConditionButtonHold condRightButtonHold = new ConditionButtonHold(GamepadButton.Right); - ConditionButtonHold condLeftButtonHold = new ConditionButtonHold(GamepadButton.Left); - ConditionCommand condUpCmd = new ConditionCommand(GamepadButton.Up); - ConditionCommand condTriangleCmd = new ConditionCommand(GamepadButton.Triangle); - ConditionCommand condCircleCmd = new ConditionCommand(GamepadButton.Circle); - ConditionCommand condCrossCmd = new ConditionCommand(GamepadButton.Cross); - ConditionCommand condSquareCmd = new ConditionCommand(GamepadButton.Square); - ConditionTowardLeft condTowardLeft = new ConditionTowardLeft(this.transform); - ConditionTowardRight condTowardRight = new ConditionTowardRight(this.transform); - ConditionCommandSeq condRight2Cmd = new ConditionCommandSeq(new List<GamepadButton>{GamepadButton.Right, GamepadButton.Right }, 0.8f); - ConditionCommandSeq condLeft2Cmd = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Left, GamepadButton.Left }, 0.8f); - ConditionCommandSeq condDRC = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Right, GamepadButton.Circle}, 1f); - ConditionCommandSeq condDLC = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Left, GamepadButton.Circle }, 1f);
- ConditionCommandSeq condDR = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Right}, 1f); - ConditionCommandSeq condDL = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Left}, 1f);
- - ConditionHit condIsHit = new ConditionHit(this); - - ConditionJumpDone condJumpDone = new ConditionJumpDone(jump); - ConditionJumpOnGround condJumpOnGround = new ConditionJumpOnGround(jump); - - ConditionInAir condInAir = new ConditionInAir(m_BodyCollider); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // common triggers - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Trigger triggerTurnRight = new Trigger(And(condRightCmd, Not(condTowardRight)), towardRight); - Trigger triggerTurnLeft = new Trigger(And(condLeftCmd, Not(condTowardLeft)), towardLeft); - - Trigger trigger = null; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // state setup - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // idle state - trigger = new Trigger(condTriangleCmd, toJump) ; - idle.AddTrigger(trigger); - trigger = new Trigger(And(condTowardRight, condDRC), new List<ActionBase> { wipeCmdRecord, switchToSuperKick }); - idle.AddTrigger(trigger); - trigger = new Trigger(And(condTowardLeft, condDLC), new List<ActionBase> { wipeCmdRecord, switchToSuperKick }); - idle.AddTrigger(trigger); - trigger = new Trigger(And(condTowardRight, And(condRightCmd, condRight2Cmd)), new List<ActionBase> { wipeCmdRecord , switchToDash }); - idle.AddTrigger(trigger); - trigger = new Trigger(And(condTowardLeft, And(condLeftCmd, condLeft2Cmd)), new List<ActionBase> { wipeCmdRecord , switchToDash }); - idle.AddTrigger(trigger); - trigger = new Trigger(And(condRightButtonHold, Not(condDR)), new List<ActionBase> { switchToMove, towardRight }); - idle.AddTrigger(trigger); - trigger = new Trigger(And(condLeftButtonHold, Not(condDL)), new List<ActionBase> { switchToMove, towardLeft }); - idle.AddTrigger(trigger); - trigger = new Trigger(condCircleCmd, switchToAttk1); - idle.AddTrigger(trigger); - trigger = new Trigger(condCrossCmd, switchToSideKick); - idle.AddTrigger(trigger); - trigger = new Trigger(condSquareCmd, switchToGun1); - idle.AddTrigger(trigger); - idle.AddTrigger(triggerTurnRight); - idle.AddTrigger(triggerTurnLeft); - - // move state - //trigger = new Trigger(Or(Ands(condRightButtonHold, condTowardRight, condTriangleCmd), Ands(condLeftButtonHold, condTowardLeft, condTriangleCmd)), toJumpForward); - //move.AddTrigger(trigger); - trigger = new Trigger(condTriangleCmd, toJump); - move.AddTrigger(trigger); - trigger = new Trigger(And(condTowardRight, And(condRightCmd, condRight2Cmd)), new List<ActionBase> { wipeCmdRecord, switchToDash, }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condTowardLeft, And(condLeftCmd, condLeft2Cmd)), new List<ActionBase> { wipeCmdRecord, switchToDash }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condRightButtonHold, condCircleCmd), new List<ActionBase> { towardRight, switchToAttkRush }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condLeftButtonHold, condCircleCmd), new List<ActionBase> { towardLeft, switchToAttkRush }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condRightButtonHold, condCrossCmd), new List<ActionBase> { towardRight, switchToSideKickRush }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condLeftButtonHold, condCrossCmd), new List<ActionBase> { towardLeft, switchToSideKickRush }); - move.AddTrigger(trigger); - trigger = new Trigger(And(condTowardRight, Not(condRightButtonHold)), switchToIdle); - move.AddTrigger(trigger); - trigger = new Trigger(And(condTowardLeft, Not(condLeftButtonHold)), switchToIdle); - move.AddTrigger(trigger); - trigger = new Trigger(condCircleCmd, switchToAttk1); - move.AddTrigger(trigger); - trigger = new Trigger(condCrossCmd, switchToSideKick); - move.AddTrigger(trigger); - - // jump state - trigger = new Trigger(condJumpOnGround, new ActionSetVelocity(m_Body, Vector3.zero), TriggerOnlyOnce.On, TriggerSwallow.Off); - jump.AddTrigger(trigger); - trigger = new Trigger(Ands(condInAir, condRightCmd, condRight2Cmd), new List<ActionBase> { towardRight, switchToAirDash, new ActionSetVelocity(m_Body, new Vector3(25, 0, 0)), new ActionDontUseGravity(m_Body), enableAfterImage, midiumAfterImageInterval}); - jump.AddTrigger(trigger); - trigger = new Trigger(Ands(condInAir, condLeftCmd, condLeft2Cmd), new List<ActionBase> { towardLeft, switchToAirDash, new ActionSetVelocity(m_Body, new Vector3(-25, 0, 0)), new ActionDontUseGravity(m_Body), enableAfterImage, midiumAfterImageInterval }); - jump.AddTrigger(trigger); - trigger = new Trigger(Ands(condInAir, condCircleCmd), new List<ActionBase> { switchToAirAttk1, new ActionSetLocalVelocity(m_Body, new Vector3(0, 0, 0)), new ActionDontUseGravity(m_Body), enableAfterImage, smallAfterImageInterval}); - jump.AddTrigger(trigger); - ConditionCheckJumpState condCheckJump = new ConditionCheckJumpState(jump, JumpState.Stage.None, JumpState.Direction.Neutral); - trigger = new Trigger(And(condRightButtonHold, condCheckJump), new List<ActionBase> { towardRight, new ActionSetVelocityX(m_Body, 4)}, TriggerOnlyOnce.Off, TriggerSwallow.Off); - jump.AddTrigger(trigger); - trigger = new Trigger(And(condLeftButtonHold, condCheckJump), new List<ActionBase> { towardLeft, new ActionSetVelocityX(m_Body,-4) }, TriggerOnlyOnce.Off, TriggerSwallow.Off); - jump.AddTrigger(trigger); - //trigger = new Trigger(Ands(condCheckJump, Not(condRightButtonHold), Not(condLeftButtonHold)), new ActionSetVelocityX(m_Body, 0), TriggerOnlyOnce.Off, TriggerSwallow.Off); - //jump.AddTrigger(trigger); - trigger = new Trigger(Ands(new ConditionJumpDone(jump, 0.4f), condJumpOnGround, Or(condRightButtonHold, condLeftButtonHold)), switchToMove); - jump.AddTrigger(trigger); - trigger = new Trigger(condJumpDone, switchToIdle); - jump.AddTrigger(trigger); - - // dash state - trigger = new Trigger(And(new ConditionMotionRange(animator, 0.5f, 1.0f), condCircleCmd), switchToAttk1); - dash.AddTrigger(trigger); - trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_DashWithSword), switchToIdle); - dash.AddTrigger(trigger); - - // attack states - float expireTime = 0.3f; - - // sword normal attack - ConditionMotionAtEnd condAttk1AtEnd = new ConditionMotionAtEnd(animator, Anim_LightAttack1); - trigger = new Trigger(And(condAttk1AtEnd, condCircleCmd), switchToAttk2); - attk1.AddTrigger(trigger); - ConditionAttkExpireTime condAttk1ExpireTime = new ConditionAttkExpireTime(attk1, expireTime); - trigger = new Trigger(condAttk1ExpireTime, switchToIdle); - attk1.AddTrigger(trigger); - attk1.AddTrigger(triggerTurnRight); - attk1.AddTrigger(triggerTurnLeft); - //trigger = new Trigger(condIsHit, new ActionLog("hit!!!")); - //attk1.AddLateTrigger(trigger); - - //ConditionMotionRange condAttkRushGhostRange = new ConditionMotionRange(animator, 0f, 0.8f); - //trigger = new Trigger(condAttkRushGhostRange, enableGhost, false); - //attkRush.AddTrigger(trigger); - //ConditionMotionRange condAttkRushGhostDisableRange = new ConditionMotionRange(animator, 0.8f, 10f); - //trigger = new Trigger(condAttkRushGhostDisableRange, disableGhost, false); - //attkRush.AddTrigger(trigger); - ConditionMotionRange condAttkRushAtRange = new ConditionMotionRange(animator, 0.5f, 1f); - trigger = new Trigger(And(condAttkRushAtRange, condCircleCmd), switchToAttk2); - attkRush.AddTrigger(trigger); - //trigger = new Trigger(And(And(condAttkRushAtRange, condTowardRight), condRightCmd), switchToAttkRush); - //attkRush.AddTrigger(trigger); - //trigger = new Trigger(And(And(condAttkRushAtRange, condTowardLeft), condLeftCmd), switchToAttkRush); - //attkRush.AddTrigger(trigger); - ConditionAttkExpireTime condAttkRushExpireTime = new ConditionAttkExpireTime(attkRush, expireTime); - trigger = new Trigger(condAttkRushExpireTime, switchToIdle); - attkRush.AddTrigger(trigger); - //attkRush.AddTrigger(triggerTurnRight); - //attkRush.AddTrigger(triggerTurnLeft); - - ConditionMotionAtEnd condAttk2AtEnd = new ConditionMotionAtEnd(animator, Anim_LightAttack2); - trigger = new Trigger(And(condAttk2AtEnd, condCircleCmd), switchToAttk3); - attk2.AddTrigger(trigger); - ConditionAttkExpireTime condAttk2ExpireTime = new ConditionAttkExpireTime(attk2, expireTime); - trigger = new Trigger(condAttk2ExpireTime, switchToIdle); - attk2.AddTrigger(trigger); - attk2.AddTrigger(triggerTurnRight); - attk2.AddTrigger(triggerTurnLeft); - - ConditionMotionAtEnd condAttk3AtEnd = new ConditionMotionAtEnd(animator, Anim_LightAttack3); - trigger = new Trigger(And(condAttk3AtEnd, condCircleCmd), switchToAttk4); - attk3.AddTrigger(trigger); - ConditionAttkExpireTime condAttk3ExpireTime = new ConditionAttkExpireTime(attk3, expireTime); - trigger = new Trigger(condAttk3ExpireTime, switchToIdle); - attk3.AddTrigger(trigger); - attk3.AddTrigger(triggerTurnRight); - attk3.AddTrigger(triggerTurnLeft); - - ConditionMotionAtEnd condAttk4AtEnd = new ConditionMotionAtEnd(animator, Anim_LightAttack4); - trigger = new Trigger(And(condAttk4AtEnd, condCircleCmd), switchToAttk5); - attk4.AddTrigger(trigger); - ConditionAttkExpireTime condAttk4ExpireTime = new ConditionAttkExpireTime(attk4, expireTime); - trigger = new Trigger(condAttk4ExpireTime, switchToIdle); - attk4.AddTrigger(trigger); - attk4.AddTrigger(triggerTurnRight); - attk4.AddTrigger(triggerTurnLeft); - - ConditionMotionAtEnd condAttk5AtEnd = new ConditionMotionAtEnd(animator, Anim_LightAttack5); - trigger = new Trigger(condAttk5AtEnd, switchToIdle); - attk5.AddTrigger(trigger); - ConditionAttkExpireTime condAttk5ExpireTime = new ConditionAttkExpireTime(attk5, expireTime); - trigger = new Trigger(condAttk5ExpireTime, switchToIdle); - attk5.AddTrigger(trigger); - attk5.AddTrigger(triggerTurnRight); - attk5.AddTrigger(triggerTurnLeft); - - // side kick normal - ConditionMotionAtEnd condKickMotionEnd = new ConditionMotionAtEnd(animator, Anim_SideKick); - trigger = new Trigger(condKickMotionEnd, new ActionSetVelocity(m_Body, Vector3.zero), TriggerOnlyOnce.On, TriggerSwallow.Off); - sideKick.AddTrigger(trigger); - ConditionAttkExpireTime condSideKickExpireTime = new ConditionAttkExpireTime(sideKick, expireTime); - trigger = new Trigger(condSideKickExpireTime, switchToIdle); - sideKick.AddTrigger(trigger); - - // side kick rush - ConditionAttkExpireTime condSideKickRushExpireTime = new ConditionAttkExpireTime(sideKickRush, expireTime); - trigger = new Trigger(condSideKickRushExpireTime, switchToIdle); - sideKickRush.AddTrigger(trigger); - ConditionMotionRange condSideKickRushMotionRange = new ConditionMotionRange(animator, 0.5f, 10f); - trigger = new Trigger(And(condSideKickRushMotionRange, And(condRightButtonHold, condCircleCmd)), new List<ActionBase> { towardRight, switchToAttkRush }); - sideKickRush.AddTrigger(trigger); - trigger = new Trigger(And(condSideKickRushMotionRange, And(condLeftButtonHold, condCircleCmd)), new List<ActionBase> { towardLeft, switchToAttkRush }); - sideKickRush.AddTrigger(trigger);
-
- // super kick combo
- ConditionMotionRange condSuperKickComboBegin = new ConditionMotionRange(animator, 0f, 1f); - trigger = new Trigger(condSuperKickComboBegin, new ActionDontUseGravity(m_Body)); - superKick.AddTrigger(trigger); - ConditionAttkExpireTime condSuperKickExpireTime = new ConditionAttkExpireTime(superKick, expireTime); - trigger = new Trigger(condSuperKickExpireTime, new List < ActionBase >() { switchToIdle , new ActionUseGravity(m_Body) }); - superKick.AddTrigger(trigger); - - // gun normal - ConditionMotionAtEnd condGun1AtEnd = new ConditionMotionAtEnd(animator, Anim_Gun1); - trigger = new Trigger(And(condGun1AtEnd, condSquareCmd), switchToGun2); - gun1.AddTrigger(trigger); - ConditionAttkExpireTime condGun1ExpireTime = new ConditionAttkExpireTime(gun1, expireTime); - trigger = new Trigger(condGun1ExpireTime, switchToIdle); - gun1.AddTrigger(trigger); - - ConditionMotionAtEnd condGun2AtEnd = new ConditionMotionAtEnd(animator, Anim_Gun2); - trigger = new Trigger(And(condGun2AtEnd, condSquareCmd), switchToGun3); - gun2.AddTrigger(trigger); - ConditionAttkExpireTime condGun2ExpireTime = new ConditionAttkExpireTime(gun2, expireTime); - trigger = new Trigger(condGun2ExpireTime, switchToIdle); - gun2.AddTrigger(trigger); - - ConditionMotionAtEnd condGun3AtEnd = new ConditionMotionAtEnd(animator, Anim_Gun3); - trigger = new Trigger(And(condGun3AtEnd, condSquareCmd), switchToGun4); - gun3.AddTrigger(trigger); - ConditionAttkExpireTime condGun3ExpireTime = new ConditionAttkExpireTime(gun3, expireTime); - trigger = new Trigger(condGun3ExpireTime, switchToIdle); - gun3.AddTrigger(trigger); - - ConditionAttkExpireTime condGun4ExpireTime = new ConditionAttkExpireTime(gun4, expireTime); - trigger = new Trigger(condGun4ExpireTime, switchToIdle); - gun4.AddTrigger(trigger); - ConditionMotionRange condGun4MotionRange = new ConditionMotionRange(animator, 0.6f, 1f); - trigger = new Trigger(And(condGun4MotionRange, condRight2Cmd), new List<ActionBase> { switchToDash, towardRight }); - gun4.AddTrigger(trigger); - trigger = new Trigger(And(condGun4MotionRange, condLeft2Cmd), new List<ActionBase> { switchToDash, towardLeft }); - gun4.AddTrigger(trigger); - - // air dash - trigger = new Trigger(new ConditionMotionRange(animator, 0.8f, 1f), disaleAfterImage, TriggerOnlyOnce.On, TriggerSwallow.Off); - airDash.AddTrigger(trigger); - trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirDash), new List<ActionBase> { new ActionSetVelocity(m_Body, Vector3.zero), new ActionUseGravity(m_Body), toJump }); - airDash.AddTrigger(trigger); - - trigger = new Trigger(new ConditionMotionRange(animator, 0.18f, 1f), new ActionPlayEffect("Air_Attk1", this, new Vector3(-136.805f, 0, 0), new Vector3(0.8f, 0.8f, 0.8f)), TriggerOnlyOnce.On, TriggerSwallow.Off); - airAttk1.AddTrigger(trigger); - trigger = new Trigger(new ConditionMotionRange(animator, 0.6f,1f), disaleAfterImage, TriggerOnlyOnce.On, TriggerSwallow.Off); - airAttk1.AddTrigger(trigger); - trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirAttack1), new List<ActionBase> { new ActionSetVelocity(m_Body, Vector3.zero), new ActionUseGravity(m_Body), toJump}); - airAttk1.AddTrigger(trigger); - - m_StateController.ForceStart(idle); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Test/SaionjiScript_States.cs.meta b/Assets/Scripts/Test/SaionjiScript_States.cs.meta deleted file mode 100644 index 10e51e09..00000000 --- a/Assets/Scripts/Test/SaionjiScript_States.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1421bbd1c6a776d4b9dd2340b37d9a8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiUberAbility.cs b/Assets/Scripts/Test/SaionjiUberAbility.cs deleted file mode 100644 index a058b4a6..00000000 --- a/Assets/Scripts/Test/SaionjiUberAbility.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class SaionjiUberState : UberState
-{
- Avatar m_Avatar;
- StateController m_StateController;
-
- public SaionjiUberState(Avatar avatar, StateController system)
- {
- m_Avatar = avatar;
- m_StateController = system;
- }
-
- public override void OnUpdate()
- {
- }
-
- public override void OnPhysicsUpdate()
- {
- }
-
-}
diff --git a/Assets/Scripts/Test/SaionjiUberAbility.cs.meta b/Assets/Scripts/Test/SaionjiUberAbility.cs.meta deleted file mode 100644 index 54511638..00000000 --- a/Assets/Scripts/Test/SaionjiUberAbility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 518687ee23ab1a8408e58ab11d3f5885 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Tween.meta b/Assets/Scripts/Tween.meta deleted file mode 100644 index bd3ad2fe..00000000 --- a/Assets/Scripts/Tween.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9519f0da0d097b546af6c24571fc2065 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Tween/TweenAlongYAxis.cs b/Assets/Scripts/Tween/TweenAlongYAxis.cs deleted file mode 100644 index d5748245..00000000 --- a/Assets/Scripts/Tween/TweenAlongYAxis.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TweenAlongYAxis : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/Tween/TweenAlongYAxis.cs.meta b/Assets/Scripts/Tween/TweenAlongYAxis.cs.meta deleted file mode 100644 index 8789d8c7..00000000 --- a/Assets/Scripts/Tween/TweenAlongYAxis.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0f1644ad01699774c8462c74fdfeb484 -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 deleted file mode 100644 index 8fdbc7d9..00000000 --- a/Assets/Scripts/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c1ad0a008a9c3cd4cb20cec962a3f7fb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AI.meta b/Assets/Scripts/Unit/AI.meta deleted file mode 100644 index e64e1ff9..00000000 --- a/Assets/Scripts/Unit/AI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5167b72d3e56949419ac4e7b10def160 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AI/Actions.meta b/Assets/Scripts/Unit/AI/Actions.meta deleted file mode 100644 index 9b4ad463..00000000 --- a/Assets/Scripts/Unit/AI/Actions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 971e9d55b8bc0894eb6a110fb962000b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AI/Conditionals.meta b/Assets/Scripts/Unit/AI/Conditionals.meta deleted file mode 100644 index 70a86da5..00000000 --- a/Assets/Scripts/Unit/AI/Conditionals.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 85b7e0c7ed1d12f42a5178bfbf3d934c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Action.meta b/Assets/Scripts/Unit/Action.meta deleted file mode 100644 index 0efb2bf1..00000000 --- a/Assets/Scripts/Unit/Action.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5350e9767900c074d87314281414977b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs b/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs deleted file mode 100644 index 771e946b..00000000 --- a/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class WaitForActionReachEnd : IEnumerator -{ - UnitAnimation m_UnitAnimation; - int m_Layer;
-
- public WaitForActionReachEnd(UnitAnimation unitAnim, int layer = 0) - { - m_UnitAnimation = unitAnim; - m_Layer = layer; - } - - public object Current => null; - - public bool MoveNext() - { - var layer = m_UnitAnimation.layers[m_Layer]; - return layer.playbackNormalizedTime < 1f; - } - - public void Reset() - { - } -} diff --git a/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs.meta b/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs.meta deleted file mode 100644 index d687ea23..00000000 --- a/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b4bf8dd0e94ed6543a91f6d3563d6dcb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Action/WaitForLanding.cs b/Assets/Scripts/Unit/Action/WaitForLanding.cs deleted file mode 100644 index 5c9736ac..00000000 --- a/Assets/Scripts/Unit/Action/WaitForLanding.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class WaitForLanding : IEnumerator -{
- UnitController controller;
-
- public WaitForLanding(UnitController controller)
- {
- this.controller = controller;
- }
-
- public object Current => null;
-
- public bool MoveNext()
- { - return controller.isInAir;
- }
-
- public void Reset()
- {
- } -} diff --git a/Assets/Scripts/Unit/Action/WaitForLanding.cs.meta b/Assets/Scripts/Unit/Action/WaitForLanding.cs.meta deleted file mode 100644 index 5098bc64..00000000 --- a/Assets/Scripts/Unit/Action/WaitForLanding.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a8352853e3875584bb29bdcff4d9a586 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs b/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs deleted file mode 100644 index 82f3e792..00000000 --- a/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class WaitForTransitionDone : IEnumerator -{
- UnitAnimation m_UnitAnimation;
-
- public WaitForTransitionDone(UnitAnimation unitAnim)
- {
- m_UnitAnimation = unitAnim;
- }
-
- public object Current => null;
-
- public bool MoveNext()
- { - return m_UnitAnimation.isInTransition;
- }
-
- public void Reset()
- {
- } -} diff --git a/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs.meta b/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs.meta deleted file mode 100644 index 54f35f87..00000000 --- a/Assets/Scripts/Unit/Action/WaitForTransitionDone.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1729935affb1cc14c839545a43360dcb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AfterImage.meta b/Assets/Scripts/Unit/AfterImage.meta deleted file mode 100644 index 952c1fde..00000000 --- a/Assets/Scripts/Unit/AfterImage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9153d0fdbafce2244b1c761816e5f9c0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs b/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs deleted file mode 100644 index ec04f3be..00000000 --- a/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 单个残影的参数 -public struct AfterImageAvatarInfo
-{
-
-} - -public class AfterImageAvatar : MonoBehaviour -{
- #region inspector - public Renderer[] renderers; - - public Animator animator;
- #endregion - - float m_CurTime;
-
- float m_LifeTime;
-
- public void Initialize(AfterImageAvatarInfo info)
- {
-
- } - - public void Initialize(UnitController prototype) - { - transform.position = prototype.transform.position; - - animator.runtimeAnimatorController = prototype.unitAnimation.animator.runtimeAnimatorController; - animator.Play(prototype.unitAnimation.baseLayer.stateHash, 0, prototype.unitAnimation.baseLayer.playbackNormalizedTime); - animator.speed = 0.02f;
- animator.Update(1 / 60f);
-
- m_LifeTime = 0.2f; - } - - public void Update()
- {
- m_CurTime += Time.deltaTime;
- if (m_CurTime > m_LifeTime)
- {
- GameObject.Destroy(this.gameObject);
- }
- } - -} diff --git a/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs.meta b/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs.meta deleted file mode 100644 index 85c289bb..00000000 --- a/Assets/Scripts/Unit/AfterImage/AfterImageAvatar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 89864711140932040a5827c91d9e5adc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AnimationData.cs b/Assets/Scripts/Unit/AnimationData.cs deleted file mode 100644 index 9af3d51c..00000000 --- a/Assets/Scripts/Unit/AnimationData.cs +++ /dev/null @@ -1,526 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-// 不要修改枚举的顺序,只能在后面新加,不能删除
-
-public enum EAnimationToogle
-{
- Combo = 0, // 连击
- SuperArmor = 1, // 霸体
- Break = 2, // 打断
-}
-
-[Serializable]
-public struct FromTo
-{
- [SerializeField] public float from;
- [SerializeField] public float to;
- public Vector2 fromTo
- {
- get
- {
- return new Vector2(from, to);
- }
- set
- {
- from = value.x;
- to = value.y;
- }
- }
- public FromTo(float from, float to)
- {
- this.from = from;
- this.to = to;
- }
- public FromTo(Vector2 fromTo)
- {
- this.from = fromTo.x;
- this.to = fromTo.y;
- }
-}
-
-[Serializable]
-public class ToggleTimeDictionary : SerializableDictionary<EAnimationToogle, FromTo> { }
-
-public enum EAnimationCurve
-{
- TimeScale = 0, //
- RootMotionScale = 1,
-}
-
-[Serializable]
-public class CurveDictionary : SerializableDictionary<EAnimationCurve, AnimationCurve> { }
-
-[Serializable]
-public struct AnimationParameter
-{
- [Serializable]
- public struct Setter
- {
- [SerializeField] public float normalizedTime;
- [SerializeField] public float value;
- }
- [SerializeField] public List<Setter> setters;
-}
-
-public enum EAnimationParameter
-{
- Visibility = 0,
-}
-
-[Serializable]
-public class ParameterDictionary : SerializableDictionary<EAnimationParameter, AnimationParameter> { }
-
-// 动画属性
-public enum EAnimationProperty
-{
- ComboTimeOffset = 1, // 如果是连击跳转过来,动作开始的时间偏移
- IgnoreY = 2, // 忽略roomotion在y轴的变化
- TransitionInDuration = 3, // 过渡到这个动作的时间
- TransitionOutDuration = 4, // 过渡到下一个动作的时间
- CanBeInterrupted = 5, // 是否可以被打断
- ORMEnforcement = 6, // 限制Y坐标的rootmotion不能小于0,仅限override rootmotion
- Endpoint = 7, // 结束点,范围[0-1],如果只截取动作的一部分,用这个属性设置
- Startpoint = 8, // 类似endpoint
-}
-
-[Serializable]
-public class PropertyDictionary : SerializableDictionary<EAnimationProperty, float> { }
-
-[Serializable]
-public class RootMotionOverrideData
-{
- [Serializable]
- public class PosData
- {
- [SerializeField] public Vector3 position;
- [SerializeField] public int frame;
- public PosData(int frame, Vector3 pos)
- {
- this.frame = frame;
- this.position = pos;
- }
- }
- [SerializeField] public List<PosData> positions;
- public RootMotionOverrideData()
- {
- positions = new List<PosData>();
- }
- public Vector3 GetPosition(float frame)
- {
- if (positions == null || positions.Count == 0)
- return Vector3.zero;
- positions.Sort((p1, p2) => {
- if (p1.frame < p2.frame)
- return -1;
- if (p1.frame > p2.frame)
- return 1;
- return 0;
- });
- int prev = 0;
- int next = 0;
- for(int i = 0;i < positions.Count; ++i)
- {
- if(positions[i].frame > frame)
- {
- break;
- }
- prev = i;
- next = Mathf.Clamp(i + 1, 0, positions.Count - 1);
- }
- float t = 0;
- if(prev != next)
- {
- t = (frame - positions[prev].frame) / (positions[next].frame - positions[prev].frame);
- }
- Vector3 pos = Vector3.Lerp(positions[prev].position, positions[next].position, t);
- return pos;
- }
-
- public Vector3 GetRootMotionDistance(float prevFrame, float curFrame)
- {
- Vector3 p1 = GetPosition(prevFrame);
- Vector3 p2 = GetPosition(curFrame);
- return p2 - p1;
- }
-
- public void SetPosition(int frame, Vector3 position)
- {
- if(positions == null)
- {
- positions = new List<PosData>();
- }
- PosData pd = positions.Find(s => s.frame == frame);
- if(pd != null)
- {
- pd.position = position;
- }
- else
- {
- positions.Add(new PosData(frame, position));
- }
- }
-
- public void RemovePositionAtFrame(float frame)
- {
- if (positions == null)
- return;
- PosData pd = positions.Find(s => s.frame == frame);
- if(pd != null)
- {
- positions.Remove(pd);
- }
- }
-}
-
-// 某个动画的数据,包括帧事件、碰撞盒、速度曲线
-[CreateAssetMenu(fileName = "Animation Data")]
-public class AnimationData : ScriptableObject
-{
- public string animationName;
- public string animationPath;
-
- public string note;
-
- public List<AnimationEventBase> animationEvents;
-
- public List<ColliderData> hurtBoxes;
- public List<ColliderData> hitBoxes;
- public List<ColliderData> throwBoxes;
- public List<ColliderData> blockBoxes;
- public List<ColliderData> defendBoxes;
-
- public bool overrideRootMotion;
- public RootMotionOverrideData rootMotionOverrideData;
-
- // 对应的进度的播放速度,默认是1
- [UnityEngine.Serialization.FormerlySerializedAs("curve")]
- public AnimationCurve speedCurve;
-
- public CurveDictionary curves;
-
- public ToggleTimeDictionary toggles;
-
- public ParameterDictionary parameters;
-
- public PropertyDictionary properties;
-
- public const int FPS = 30;
-
- public AnimationData()
- {
- Keyframe frame0 = new Keyframe(0, 1);
- Keyframe frame1 = new Keyframe(1, 1);
- speedCurve = new AnimationCurve(frame0, frame1);
- }
-
- public List<ColliderData> GetColliderBoxesByType(ColliderBox.EColliderType type)
- {
- switch (type)
- {
- case ColliderBox.EColliderType.HurtBox:
- return hurtBoxes;
- case ColliderBox.EColliderType.HitBox:
- return hitBoxes;
- case ColliderBox.EColliderType.BlockBox:
- return blockBoxes;
- case ColliderBox.EColliderType.ThrowBox:
- return throwBoxes;
- case ColliderBox.EColliderType.DefendBox:
- return defendBoxes;
- }
- return null;
- }
-
- public bool HasProperty(EAnimationProperty property)
- {
- if (!properties.ContainsKey(property))
- return false;
- return true;
- }
-
- public float GetProperty(EAnimationProperty property, float defaultValue = 0)
- {
- if (!HasProperty(property))
- return defaultValue;
- return properties[property];
- }
-
- public bool HasParameter(EAnimationParameter parameterName)
- {
- if (!parameters.ContainsKey(parameterName))
- return false;
- return true;
- }
-
- public float GetParameter(EAnimationParameter parameterName, float normalizedTime)
- {
- if (!parameters.ContainsKey(parameterName))
- return 0;
- var parameter = parameters[parameterName];
- parameter.setters.Sort((AnimationParameter.Setter a, AnimationParameter.Setter b) =>
- {
- return a.normalizedTime - b.normalizedTime < 0 ? -1 : 1;
- });
- float value = 0;
- for (int i = 0; i < parameter.setters.Count; ++i)
- {
- AnimationParameter.Setter setter = parameter.setters[i];
- if (setter.normalizedTime > normalizedTime)
- break;
- value = setter.value;
- }
- return value;
- }
-
- public bool HasCurve(EAnimationCurve curve)
- {
- return curves != null && curves.ContainsKey(curve);
- }
-
- public AnimationCurve GetCurve(EAnimationCurve curve)
- {
- if (!HasCurve(curve))
- return null;
- return curves[curve];
- }
-
- public bool HasToggle(EAnimationToogle toggle)
- {
- return toggles != null && toggles.ContainsKey(toggle);
- }
-
- public bool IsToggleOpen(EAnimationToogle toggle, float normalizedTime)
- {
- if (!HasToggle(toggle))
- {
- return false;
- }
- return toggles[toggle].to >= normalizedTime && normalizedTime >= toggles[toggle].from;
- }
-
- public ColliderInfo GetColliderInfo(ColliderBox.EColliderType type, int index, float playbackTime)
- {
- return GetColliderInfoByFrame(type, index, playbackTime * FPS);
- }
-
- public ColliderInfo GetColliderInfoByFrame(ColliderBox.EColliderType type, int index, float frame)
- {
- ColliderInfo info = new ColliderInfo();
- var colliders = GetColliderBoxesByType(type);
- if (colliders == null || colliders.Count <= index)
- return info; //info.isValid == false
- info = colliders[index].GetColliderInfo(frame);
- return info;
- }
-
- public ColliderInfo[] GetCollidersInfo(ColliderBox.EColliderType type, float playbackTime)
- {
- return GetCollidersInfoByFrame(type, playbackTime * FPS);
- }
-
- public ColliderInfo[] GetCollidersInfoByFrame(ColliderBox.EColliderType type, float frame)
- {
- var colliders = GetColliderBoxesByType(type);
- if (colliders == null || colliders.Count == 0)
- return null;
- ColliderInfo[] infos = new ColliderInfo[colliders.Count];
- for(int i = 0; i < colliders.Count; ++i)
- {
- infos[i] = colliders[i].GetColliderInfo(frame);
- }
- return infos;
- }
-
- public ColliderInfo[] GetActiveCollidersInfo(ColliderBox.EColliderType type, float playbackTime)
- {
- return GetActiveCollidersInfoByFrame(type , playbackTime * FPS);
- }
-
- public ColliderInfo[] GetActiveCollidersInfoByFrame(ColliderBox.EColliderType type, float frame)
- {
- var all = GetCollidersInfoByFrame(type, frame);
- if (all == null || all.Length == 0)
- return null;
- int activeCount = 0;
- foreach(var c in all)
- {
- if (c.active)
- activeCount++;
- }
- if (activeCount == 0)
- return null;
- ColliderInfo[] active = new ColliderInfo[activeCount];
- int i = 0;
- foreach(var c in all)
- {
- if(c.active)
- {
- active[i++] = c;
- }
- }
- return active;
- }
-
- public int GetBoxesCount()
- {
- int hurt = hurtBoxes != null ? hurtBoxes.Count : 0;
- int hit = hitBoxes != null ? hitBoxes.Count : 0;
- int thro = throwBoxes != null ? throwBoxes.Count : 0;
- int block = blockBoxes != null ? blockBoxes.Count : 0;
- int defend = defendBoxes != null ? defendBoxes.Count : 0;
- return hurt + hit + thro + block + defend;
- }
-
- public void AddBox(ref List<ColliderData> boxList, ColliderData box)
- {
- if (boxList == null)
- {
- boxList = new List<ColliderData>();
- return;
- }
- boxList.Add(box);
- }
-
- public void DeleteBox(ColliderData box)
- {
- if (hurtBoxes != null) hurtBoxes.Remove(box);
- if (hitBoxes != null) hitBoxes.Remove(box);
- if (throwBoxes != null) throwBoxes.Remove(box);
- if (blockBoxes != null) blockBoxes.Remove(box);
- if (defendBoxes != null) defendBoxes.Remove(box);
- }
-
- public ColliderData GetColliderByIndex(int index)
- {
- if (hurtBoxes != null && hurtBoxes.Count > index)
- return hurtBoxes[index];
- else
- index -= hurtBoxes.Count;
- if (hitBoxes != null && hitBoxes.Count > index)
- return hitBoxes[index];
- else
- index -= hitBoxes.Count;
- if (throwBoxes != null && throwBoxes.Count > index)
- return throwBoxes[index];
- else
- index -= throwBoxes.Count;
- if (blockBoxes != null && blockBoxes.Count > index)
- return blockBoxes[index];
- else
- index -= blockBoxes.Count;
- if (defendBoxes != null && defendBoxes.Count > index)
- return defendBoxes[index];
- else
- index -= defendBoxes.Count;
- return null;
- }
-
- public void AddEvent(AnimationEventBase animEvent)
- {
- if (this.animationEvents == null)
- this.animationEvents = new List<AnimationEventBase>();
- animationEvents.Add(animEvent);
- }
-
- public List<AnimationEventBase> GetAnimationEventsAtFrame(int frame)
- {
- if (animationEvents == null)
- return null;
-
- List<AnimationEventBase> events = ListPool<AnimationEventBase>.Get();
- events.Clear();
- foreach (var animeEvent in animationEvents)
- {
- if (animeEvent == null)
- continue;
- if(animeEvent.startFrame == frame)
- {
- events.Add(animeEvent);
- }
- }
- return events;
- }
-
- public int GetMaxAnimationEventsCount()
- {
- List<int> frames = GetAnimationEventFrameIndices();
- if(frames == null)
- {
- ListPool<int>.Release(frames);
- return 0;
- }
- int count = 0;
- for(int i = 0; i < frames.Count; ++i)
- {
- List<AnimationEventBase> events = GetAnimationEventsAtFrame(frames[i]);
- if (count < events.Count)
- {
- count = events.Count;
- }
- ListPool<AnimationEventBase>.Release(events);
- }
- ListPool<int>.Release(frames);
- return count;
- }
-
- public List<int> GetAnimationEventFrameIndices()
- {
- if (animationEvents == null)
- return null;
-
- List<int> frames = ListPool<int>.Get();
- frames.Clear();
- foreach (var animeEvent in animationEvents)
- {
- if (animeEvent == null)
- continue;
- if (!frames.Contains(animeEvent.startFrame))
- {
- frames.Add(animeEvent.startFrame);
- }
- }
- return frames;
- }
-
- public void DeleteEvent(AnimationEventBase animEvent)
- {
- if(animationEvents.Contains(animEvent))
- {
- animationEvents.Remove(animEvent);
- }
- }
-
- public void AddRootMotionOverriderData( )
- {
- this.overrideRootMotion = true;
- this.rootMotionOverrideData = new RootMotionOverrideData();
- }
-
- public void DeleteRootMotionOverrideData()
- {
- this.overrideRootMotion = false;
- this.rootMotionOverrideData = null;
- }
-
-#if UNITY_EDITOR
- public void OnSaveToDisk()
- {
- foreach(var animEvent in animationEvents)
- {
- if (animEvent == null)
- continue;
- if(!AssetDatabase.IsSubAsset(animEvent))
- {
- AssetDatabase.AddObjectToAsset(animEvent, this);
- }
- }
- }
-#endif
-
-}
diff --git a/Assets/Scripts/Unit/AnimationData.cs.meta b/Assets/Scripts/Unit/AnimationData.cs.meta deleted file mode 100644 index 3096f841..00000000 --- a/Assets/Scripts/Unit/AnimationData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 58f0c5a3..00000000 --- a/Assets/Scripts/Unit/Collider.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bdd24f4780cd7394c8591ad34d8938cf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderAttributes.cs b/Assets/Scripts/Unit/Collider/ColliderAttributes.cs deleted file mode 100644 index 27889441..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderAttributes.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ColliderTypeAttribute : Attribute -{ - public ColliderTypeAttribute(ColliderBox.EColliderType type) - { - this.type = type; - } - - public ColliderBox.EColliderType type; -} - - -public class IfAttribute : Attribute -{ - public IfAttribute(string name) - { - this.conditionName = name; - } - - public string conditionName; - -} - -public class IfNotAttribute : Attribute -{ - public IfNotAttribute(string name) - { - this.conditionName = name; - } - - public string conditionName; - -} - -public class WhenAttribute : Attribute -{ - public WhenAttribute(string name, object value) - { - this.conditionName = name; - this.value = (int)value; - } - - public WhenAttribute(string name, params object[] values)
- {
- this.conditionName = name;
- this.values = new List<float>();
- foreach(var v in values)
- {
- this.values.Add((float)v);
- }
- } - - public bool IsSatisfied(float v)
- {
- if (values != null)
- return values.Contains(v);
- return value == v;
- } - - public string conditionName; - public float value; - public List<float> values; -} - -public class AndWhenAttribute : Attribute -{ - public AndWhenAttribute(string name, object value) - { - this.conditionName = name;
- this.value = (int)value; - } - - public AndWhenAttribute(string name, params object[] values)
- {
- this.conditionName = name;
- this.values = new List<float>();
- foreach (var v in values)
- {
- this.values.Add((float)v);
- }
- } - - public bool IsSatisfied(float v)
- {
- if (values != null)
- return values.Contains(v);
- return value == v;
- } - - public string conditionName; - public float value; - public List<float> values; -} - -public class WhenNotAttribute : Attribute -{ - public WhenNotAttribute(string name, object value) - { - this.conditionName = name; - this.value = (int)value; - } - - public string conditionName; - public int value; -} - -public class CommentAttribute : Attribute -{ - public CommentAttribute(string comment, TextAnchor alignment = TextAnchor.MiddleLeft) - { - this.comment = comment; - this.alignment = alignment; - } - public string comment; - public TextAnchor alignment; -} - -public class FoldoutAttribute : Attribute -{
- public FoldoutAttribute(string title, int count)
- {
- this.title = title;
- this.count = count;
- }
- public string title; - public int count; // 下面的元素的个数 -} - - -public class HDRAttribute : Attribute
-{
-} diff --git a/Assets/Scripts/Unit/Collider/ColliderAttributes.cs.meta b/Assets/Scripts/Unit/Collider/ColliderAttributes.cs.meta deleted file mode 100644 index 9cdbeaf7..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderAttributes.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 618a95231c298694696513e29164d269 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderBox.cs b/Assets/Scripts/Unit/Collider/ColliderBox.cs deleted file mode 100644 index 24319ef2..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-[Serializable]
-public partial class ColliderBox
-{
- // pivot
- public enum Pivot
- {
- MiddleBottom = 0,
- MiddleCenter = 1,
- }
-
- // 分化为不同的collider类型
- public enum EColliderType
- {
- HitBox,
- HurtBox,
- ThrowBox,
- BlockBox,
- DefendBox,
- }
-
- [DisallowModifiyInGUI]
- [Tooltip("Collider类型")]
- public EColliderType type;
-
- [DisallowModifiyInGUI]
- [Tooltip("Collider原点")]
- public Pivot pivot;
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta b/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta deleted file mode 100644 index 439b4b67..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f8d463de484da614bb9cad410152198a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs b/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs deleted file mode 100644 index 9f1d629a..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs +++ /dev/null @@ -1,124 +0,0 @@ -using UnityEngine;
-
-// 打击感相关资料
-// https://gameinstitute.qq.com/community/detail/112371
-//
-
-public partial class ColliderBox -{
-
- public enum EColorDriftMode : int - { - None = 0, - UI = 1, - All = 2, - } - - public enum EBlurMode : int
- {
- None = 0,
- Gauß = 1,
- Radial = 2,
- } - - public enum ESparkAnchor : int - { - CenterOfIntersection = 0, // hitbox和hurtbox相交的矩形中心
- CenterOfOther = 1, // 被攻击的对象的几何中心
- PositionOfOther = 2, // 被攻击对象的原点 - CenterOfHitbox = 3, // hitbox的中心 - FrontOfHitbox = 4, // hitbox的前方 - }
-
- public enum EMeshEffect : int
- {
- None = 0,
- White = 1,
- Red = 2,
- }
-
- // 击中反馈
- public enum EHitResponse
- {
- Light = 0,
- Heavy = 1,
- HitAir = 2,
- HitGround = 3,
- HitInAir = 4,
- }
-
- [ColliderType(EColliderType.HitBox)]
- - [Tooltip("允许多次击中")] - public bool multiHit;
-
- public EHitResponse hitResponse;
-
- [Tooltip("击退距离")]
- public Vector3 hitBack; - - [Tooltip("击退曲线")]
- public AnimationCurve hitCurve; - - [Comment("[ 击中效果 ]", TextAnchor.MiddleCenter)]
-
- [Foldout("时间效果", 3)]
- [Tooltip("全局顿帧")]
- public float freezeGlobal;
- [Tooltip("自身顿帧")]
- public float freezeFramesSelf;
- //[WhenNot("freezeFramesSelf", 0)]
- //public AnimationCurve freezeFramesSelfCurve;
- [Tooltip("对方顿帧")]
- public float freezeFramesOther;
- //[WhenNot("freezeFramesOther", 0)]
- //public AnimationCurve freezeFramesOtherCurve;
-
- [Foldout("粒子效果", 10)]
- [Tooltip("击中后的粒子效果")] - public string sparkPath; - [Tooltip("粒子的锚点")] - public ESparkAnchor sparkAnchor = ESparkAnchor.CenterOfOther; - [Tooltip("击中后的粒子位置偏移")] - public Vector3 sparkOffset;
- [Tooltip("击中后的粒子大小")] - public Vector3 sparkScale = Vector3.one; - [Tooltip("多个粒子,最多支持3个")] - public bool multiSparks; - [If("multiSparks"), Tooltip("击中后的粒子效果")] - public string spark2Path; - [If("multiSparks"), Tooltip("粒子的锚点")] - public ESparkAnchor spark2Anchor = ESparkAnchor.CenterOfOther; - [If("multiSparks"), Tooltip("击中后的粒子位置偏移")] - public Vector3 spark2Offset;
- [If("multiSparks"), Tooltip("击中后的粒子效果")] - public string spark3Path; - [If("multiSparks"), Tooltip("粒子的锚点")] - public ESparkAnchor spark3Anchor = ESparkAnchor.CenterOfOther; - [If("multiSparks"), Tooltip("击中后的粒子位置偏移")] - public Vector3 spark3Offset;
-
- [Foldout("网格效果", 2)] - public EMeshEffect selfEffect; - public EMeshEffect otherEffect; - - [Foldout("相机效果", 4)] - [Tooltip("拉近相机")] - public bool zoomCamera;
- [Tooltip("是否震屏")] - public bool shakeScreen; - [If("shakeScreen"), Tooltip("是否震屏")] - public Vector2 shakeOffset; - [If("shakeScreen"), Tooltip("震屏力度")] - public float shakeStrength;
-
- [Foldout("屏幕效果", 2)] - [Tooltip("颜色漂移效果")]
- public EColorDriftMode colorDrift; - public EBlurMode blur;
-
- [Foldout("音效", 1)]
- [Tooltip("音效")]
- public string soundPath; - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs.meta b/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs.meta deleted file mode 100644 index 639f1fc5..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_Hitbox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ddd96c09da9d8ff468e34a19a4698555 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs b/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs deleted file mode 100644 index 788b457a..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs +++ /dev/null @@ -1,11 +0,0 @@ -using UnityEngine; - -public partial class ColliderBox -{ - - [ColliderType(EColliderType.HurtBox)]
-
- [Tooltip("是否开启重力")] - public bool useGravity; - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs.meta b/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs.meta deleted file mode 100644 index 607eaa13..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_Hurtbox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a6f3f28157915d4799d28475c61a11a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs b/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs deleted file mode 100644 index 932f1062..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class ColliderBox -{
- [ColliderType(EColliderType.ThrowBox)]
-
- [Tooltip("是否允许抓取多个")] - public bool multiple; - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs.meta b/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs.meta deleted file mode 100644 index 14bc67b2..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderBox_ThrowBox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 855e124ac6f58354a86276f0cda17fa1 -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 deleted file mode 100644 index 58743aff..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderData.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 用来返回某一时刻的碰撞盒几何数据
-public struct ColliderInfo
-{
- public bool active;
- public float frame;
- public Vector3 position;
- public Vector3 size;
- public ColliderBox.EColliderType type { get { return collider.type; } }
- public ColliderBox.Pivot pivot { get { return collider.pivot; } }
- public ColliderBox collider;
- public int colliderHash { get { return collider.GetHashCode(); } }
-
- public bool isValid { get { return collider != null; } } // 没有对应的数据时为false
-}
-
-// 某个碰撞盒的属性和帧数据,从属于animation data
-[Serializable]
-public class ColliderData
-{
- [Serializable]
- public class ColliderFrame
- {
- public int frame;
- public bool active;
- public Vector3 position;
- public Vector3 size;
- }
-
- public ColliderBox.EColliderType type { get { return collider.type; } }
- public ColliderBox.Pivot pivot { get { return collider.pivot; } }
-
- public ColliderBox collider;
-
- public List<ColliderFrame> frames;
-
- public ColliderData(ColliderBox.EColliderType type, ColliderBox.Pivot pivot)
- {
- this.frames = new List<ColliderFrame>();
- if (collider == null)
- collider = new ColliderBox();
- collider.type = type;
- collider.pivot = pivot;
- }
-
- public ColliderInfo GetColliderInfo(float frame)
- {
- ColliderInfo info = new ColliderInfo();
- info.active = false; // default
- info.collider = collider;
- info.frame = frame;
- int previous = 0;
- int end = -1;
- for (int i = 0; i < frames.Count; ++i)
- {
- if(frame >= frames[i].frame)
- {
- previous = frames[i].frame;
- }
- if(frames[i].frame > frame)
- {
- end = frames[i].frame;
- break;
- }
- }
- if(end == -1)
- {
- if(type == ColliderBox.EColliderType.HurtBox)
- {
- ColliderFrame pre = frames.Find(s => s.frame == previous);
- if (pre == null)
- return info;
- info.active = pre.active;
- info.position = pre.position;
- info.size = pre.size;
- }
- }
- else
- {
- ColliderFrame pre = frames.Find(s => s.frame == previous);
- ColliderFrame next = frames.Find(s => s.frame == end);
- if (pre == null || next == null)
- return info;
- info.active = pre.active;
- float t = (frame - previous) / (end - previous);
- info.position = Vector3.Lerp(pre.position, next.position, t);
- info.size = Vector3.Lerp(pre.size, next.size, t);
- }
- return info;
- }
-
- public ColliderFrame AddFrame(int frameIndex)
- {
- if (frames == null)
- frames = new List<ColliderFrame>();
- ColliderFrame frame = new ColliderFrame();
- frame.frame = frameIndex;
- frame.active = true;
- frame.position = Vector3.zero;
- frame.size = new Vector3(0.5f,1,1);
- frames.Add(frame);
- frames.Sort((a, b) => {
- if (a == null)
- return 1;
- if (b == null)
- return -1;
- if (a.frame < b.frame)
- return -1;
- if (a.frame > b.frame)
- return 1;
- return 0;
- });
- return frame;
- }
-
- public void DeleteFrame(int frameIndex)
- {
- if (frames == null)
- return;
- ColliderFrame frame = null;
- foreach(var f in frames)
- {
- if (f.frame == frameIndex)
- frame = f;
- }
- if(frame != null)
- {
- frames.Remove(frame);
- }
- }
-
-}
diff --git a/Assets/Scripts/Unit/Collider/ColliderData.cs.meta b/Assets/Scripts/Unit/Collider/ColliderData.cs.meta deleted file mode 100644 index c66d5502..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 80e8515ea336e6a4ca6ebadad243468f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/ColliderRegistry.cs b/Assets/Scripts/Unit/Collider/ColliderRegistry.cs deleted file mode 100644 index 408ce5a4..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderRegistry.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ColliderRegistry : Singleton<ColliderRegistry> -{ - public List<UnitCollider> colliders = new List<UnitCollider>(); - public List<Projectile> projectiles = new List<Projectile>(); - - public void AddCollider(UnitCollider collider) - { - if (!colliders.Contains(collider)) - colliders.Add(collider); - } - - public void RemoveCollider(UnitCollider collider) - { - if (colliders.Contains(collider)) - colliders.Remove(collider); - }
-
-
- public void AddProjectile(Projectile projectile)
- {
- if (!projectiles.Contains(projectile))
- projectiles.Add(projectile);
- }
-
- public void RemoveProjectile(Projectile projectile)
- {
- if (projectiles.Contains(projectile))
- projectiles.Remove(projectile);
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/ColliderRegistry.cs.meta b/Assets/Scripts/Unit/Collider/ColliderRegistry.cs.meta deleted file mode 100644 index 8007287c..00000000 --- a/Assets/Scripts/Unit/Collider/ColliderRegistry.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7787595f1b3721847aeca526a55446b9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Collider/CollisionSystem.cs b/Assets/Scripts/Unit/Collider/CollisionSystem.cs deleted file mode 100644 index 83052073..00000000 --- a/Assets/Scripts/Unit/Collider/CollisionSystem.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -public struct ColliderDescriptor -{ - public ColliderInfo colliderInfo; - public UnitCollider unitCollider; -} - -[Serializable] -public struct Box
-{
- [SerializeField] public Vector3 center;
- [SerializeField] public Vector3 size;
-} - -public struct CollisionInfo -{ - public ColliderDescriptor collider; // 主动
- public ColliderDescriptor collidee; // 从动 - public Box intersection; - public bool isCollision; -} - -public class CollisionSystem : SingletonMB<CollisionSystem> -{ - public delegate void StageHandle(); - - public StageHandle onSolveHit; - - [SerializeField] - private int m_UnitColliderCount; - - ColliderRegistry registry { get { return ColliderRegistry.Instance; } } - - private void Start() - { - } - - void Update() - { - m_UnitColliderCount = registry.colliders != null ? registry.colliders.Count : 0; - - SolveHit(); - SolveProjectile(); - } - - // hitbox <-> hurtbox - void SolveHit() - { - // collect all hit box - List<ColliderDescriptor> hitboxes = ListPool<ColliderDescriptor>.Get(); - foreach (var collider in registry.colliders) - { - ColliderInfo[] boxes = collider.GetCurrentBoxesInfoByType(ColliderBox.EColliderType.HitBox); - if (boxes == null || boxes.Length == 0) - continue; - for(int i = 0; i < boxes.Length; ++i) - { - ColliderDescriptor descriptor = new ColliderDescriptor(); - descriptor.colliderInfo = boxes[i]; - descriptor.unitCollider = collider; - hitboxes.Add(descriptor); - } - } - // collect all hurt box - List<ColliderDescriptor> hurtboxes = ListPool<ColliderDescriptor>.Get(); - foreach (var collider in registry.colliders) - { - ColliderInfo[] boxes = collider.GetCurrentBoxesInfoByType(ColliderBox.EColliderType.HurtBox); - if (boxes == null || boxes.Length == 0) - continue; - for (int i = 0; i < boxes.Length; ++i) - { - ColliderDescriptor descriptor = new ColliderDescriptor(); - descriptor.colliderInfo = boxes[i]; - descriptor.unitCollider = collider; - hurtboxes.Add(descriptor); - } - } - - // solve - for(int i = 0; i < hitboxes.Count; ++ i) - { - ColliderDescriptor hitbox = hitboxes[i]; - for (int j = 0; j < hurtboxes.Count; ++j) - { - ColliderDescriptor hurtbox = hurtboxes[j]; - if (hitbox.unitCollider == hurtbox.unitCollider) - continue;
- if (hitbox.unitCollider.owner.type == hurtbox.unitCollider.owner.type) - continue; - CollisionInfo collision = ColliderUtility.GetCollision(hitbox, hurtbox); - if (!collision.isCollision) - continue; - if (!hitbox.unitCollider.CanCollide(hitbox.colliderInfo.colliderHash, hurtbox.unitCollider.owner.GetHashCode())) - continue; - hitbox.unitCollider.RecordCollision(hitbox.colliderInfo.colliderHash, hurtbox.unitCollider.owner.GetHashCode()); - hitbox.unitCollider.owner.OnHit(collision); - hurtbox.unitCollider.owner.OnGetHit(collision); - } - } - - ListPool<ColliderDescriptor>.Release(hitboxes); - ListPool<ColliderDescriptor>.Release(hurtboxes); - }
-
- void SolveProjectile()
- {
- // collect all hurt box
- List<ColliderDescriptor> hurtboxes = ListPool<ColliderDescriptor>.Get();
- foreach (var collider in registry.colliders)
- {
- ColliderInfo[] boxes = collider.GetCurrentBoxesInfoByType(ColliderBox.EColliderType.HurtBox);
- if (boxes == null || boxes.Length == 0)
- continue;
- for (int i = 0; i < boxes.Length; ++i)
- {
- ColliderDescriptor descriptor = new ColliderDescriptor();
- descriptor.colliderInfo = boxes[i];
- descriptor.unitCollider = collider;
- hurtboxes.Add(descriptor);
- }
- } -
- foreach (var projectile in registry.projectiles)
- {
- if (projectile == null)
- continue;
- for(int i = 0; i < hurtboxes.Count; ++i)
- {
- ColliderDescriptor hurtCollider = hurtboxes[i];
- if (hurtCollider.unitCollider == null)
- continue;
- if (projectile.owner == null || hurtCollider.unitCollider.owner == null || projectile.owner.type == hurtCollider.unitCollider.owner.type)
- continue;
- Box hurtbox = ColliderUtility.GetColliderInWorldSpace(hurtCollider);
- foreach (var itor in projectile.GetCollidersInWorldSpace())
- {
- Box box = (Box)itor;
- Box intersection = ColliderUtility.GetIntersection(box, hurtbox);
- if (intersection.size.magnitude == 0)
- continue;
- if (!projectile.CanHit(hurtCollider.unitCollider.owner.GetHashCode()))
- continue;
- projectile.RecordTarget(hurtCollider.unitCollider.owner.GetHashCode());
-
- CollisionInfo collision = new CollisionInfo();
- collision.isCollision = true;
- collision.intersection = intersection;
- collision.collidee = hurtCollider;
- hurtCollider.unitCollider.owner.OnGetShot(collision);
- projectile.OnShot(collision);
-
- goto next;
- }
- }
- next:;
- }
- }
-
- // throwbox <-> hurtbox
- void SolveThrow() - { - - } - - // defendbox <-> hurtbox - void SolveDefend() - { - - } - - // blockbox <-> hitbox - void SolveBlock() - { - - } - - private void OnDrawGizmos()
- {
- } - -} - -public static class ColliderUtility
-{
- public static CollisionInfo GetCollision(ColliderDescriptor collider, ColliderDescriptor collidee)
- {
- CollisionInfo collision = new CollisionInfo();
- collision.collider = collider;
- collision.collidee = collidee;
- Box colliderBox = GetColliderInWorldSpace(collider);
- Box collideeBox = GetColliderInWorldSpace(collidee);
- Box intersection = GetIntersection(colliderBox, collideeBox);
- collision.intersection = intersection;
- collision.isCollision = intersection.size.magnitude != 0;
- return collision;
- }
-
- public static Box GetColliderInWorldSpace(ColliderDescriptor collider)
- {
- Box box = new Box();
- Vector3 fac = new Vector3(1, 1, collider.unitCollider.owner.transform.forward.normalized == Vector3.forward ? 1 : -1);
- Vector3 unitPos = collider.unitCollider.owner.transform.position;
- Vector3 pos = Vector3.zero; // gizmo位置
- Vector3 localPos = collider.unitCollider.owner.transform.rotation * collider.colliderInfo.position;
- Vector3 localSize = collider.colliderInfo.size;
- var pivot = collider.colliderInfo.pivot;
- switch (pivot)
- {
- case ColliderBox.Pivot.MiddleBottom:
- localPos.y += localSize.y / 2;
- break;
- }
- pos = unitPos + Vector3.Scale(localPos, fac);
- box.center = pos;
- box.size = localSize;
- return box;
- }
-
- public static Box GetIntersection(Box b1, Box b2)
- {
- bool isIntersection = true;
-
- float l1 = b1.center.x - b1.size.x / 2;
- float r1 = b1.center.x + b1.size.x / 2;
- float l2 = b2.center.x - b2.size.x / 2;
- float r2 = b2.center.x + b2.size.x / 2;
- isIntersection &= r1 >= l2 && l1 <= r2;
-
- float o1 = b1.center.y - b1.size.y / 2;
- float t1 = b1.center.y + b1.size.y / 2;
- float o2 = b2.center.y - b2.size.y / 2;
- float t2 = b2.center.y + b2.size.y / 2;
- isIntersection &= t1 >= o2 && o1 <= t2;
-
- float c1 = b1.center.z - b1.size.z / 2;
- float f1 = b1.center.z + b1.size.z / 2;
- float c2 = b2.center.z - b2.size.z / 2;
- float f2 = b2.center.z + b2.size.z / 2;
- isIntersection &= f1 >= c2 && c1 <= f2;
-
- if(!isIntersection)
- {
- return new Box();
- }
-
- Box box = new Box();
- float l = Mathf.Max(l1, l2);
- float r = Mathf.Min(r1, r2);
- float b = Mathf.Max(o1, o2);
- float t = Mathf.Min(t1, t2);
- float c = Mathf.Max(c1, c2);
- float f = Mathf.Max(f1, f2);
- box.center = new Vector3((l + r) / 2, (b + t) / 2, (c + f) / 2 );
- box.size = new Vector3(r - l, t - b, f - c);
- return box;
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Collider/CollisionSystem.cs.meta b/Assets/Scripts/Unit/Collider/CollisionSystem.cs.meta deleted file mode 100644 index 948c0ac7..00000000 --- a/Assets/Scripts/Unit/Collider/CollisionSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dc2cc9a83ab4066478ac795935406ee2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components.meta b/Assets/Scripts/Unit/Components.meta deleted file mode 100644 index 3d416e3a..00000000 --- a/Assets/Scripts/Unit/Components.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 98e1c36fe676e0b4f8ea933e9619db82 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAfterImage.cs b/Assets/Scripts/Unit/Components/UnitAfterImage.cs deleted file mode 100644 index 622e87ba..00000000 --- a/Assets/Scripts/Unit/Components/UnitAfterImage.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// Unit残影,通过复制avatar实现 - -public class AfterImageSpawner -{ - private float m_CurTime; - - private float m_Duration; - - public void OnUpdate() - { - float dt = Time.deltaTime; - m_CurTime += dt; - - - } - -} - -[DisallowMultipleComponent] -public class UnitAfterImage : UnitComponent -{ - - private List<AfterImageSpawner> m_Spawners; - - public override void OnUpdate() - { - base.OnUpdate(); - - if(m_Spawners != null) - { - for(int i = 0; i < m_Spawners.Count; ++i) - { - m_Spawners[i].OnUpdate(); - } - } - - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitAfterImage.cs.meta b/Assets/Scripts/Unit/Components/UnitAfterImage.cs.meta deleted file mode 100644 index 21cdf37f..00000000 --- a/Assets/Scripts/Unit/Components/UnitAfterImage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 567816c152acc834f9bd41efec9ee51c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation.meta b/Assets/Scripts/Unit/Components/UnitAnimation.meta deleted file mode 100644 index 580176c0..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 21e3b4128e398d745a22f45d6268b4c7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/DroneAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/DroneAnimation.cs deleted file mode 100644 index 29caab7b..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/DroneAnimation.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class DroneAnimation : 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/Components/UnitAnimation/DroneAnimation.cs.meta b/Assets/Scripts/Unit/Components/UnitAnimation/DroneAnimation.cs.meta deleted file mode 100644 index 219b76ff..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/DroneAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 352eb281e97bf67499a8a85ab013f0f0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs deleted file mode 100644 index ee111f73..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MonsterAnimation : UnitAnimation -{ - public enum ELayer - { - Basic = 0, - - Count, - } - - // 动作名,和animator里的state对应 - public enum EAnimState - { - // layer 0 - Idle = 0, - Move, - Jump, - - HitLight, - HitAir, - HitInAir, - HitBackHeavy, -
- Rise, - } - - public override void Initialize() - { - base.Initialize(); - - m_Animator = this.m_Owner.unitObj.GetComponent<Animator>(); - - m_Animator.speed = 0; - - m_LayerInfo = new AnimatorLayerInfo[2]; - m_LayerInfo[0] = new AnimatorLayerInfo(this, m_Animator, (int)ELayer.Basic); - //m_LayerInfo[1] = new AnimatorLayerInfo(this, m_Animator, ELayer.Attack); - - if (m_Animator == null) - { - LogHelper.LogError("没有挂Animator组件"); - } - - } - - public override void OnUpdate() - { - base.OnUpdate(); - - UpdateLayer(); - UpdateAnimation(); - UpdateRootMotion(); - } - - void UpdateLayer() - { - m_LayerInfo[0].OnUpdate(); - return; - for (int i = 0; i < m_LayerInfo.Length; ++i) - { - m_LayerInfo[i].OnUpdate(); - } - } - - void UpdateAnimation() - { - m_Animator.speed = 1; - m_Animator.Update(Time.deltaTime); - m_Animator.speed = 0; - } - - void UpdateRootMotion() - { - m_Owner.unitRootMotion.UpdateRootMotion(); - } - - public void AnimIdle() - { - this.CrossFade(EAnimState.Idle, 0.2f, 0); - } - - public void AnimHitLight() - { - this.Play(EAnimState.HitLight, 0, 0); - //m_Animator.CrossFade("HitLight", 0.05f, 0, 0, 0); - } - - public void AnimHitAir() - { - this.Play(EAnimState.HitAir, 0, 0); - //m_Animator.CrossFade("HitLight", 0.05f, 0, 0, 0); - } - - public void AnimHitInAir()
- {
- this.Play(EAnimState.HitInAir, 0, 0); - } - - public void AnimHitBackHeavy()
- {
- this.Play(EAnimState.HitBackHeavy, 0, 0); - } - - public void AnimRise() - { - this.CrossFade(EAnimState.Rise, 0); - } - - private void Play(EAnimState animState, int layerIndex = 0, float normalizedTime = float.NegativeInfinity) - { - AnimatorLayerInfo layer = this.layers[layerIndex]; - if (layer == null) - return; - layer.OnPlay(animState.ToString(), normalizedTime); - } - - public void CrossFade(EAnimState animState, float normalizedTransitionDuration, int layerIndex = 0, float normalizedTimeOffset = float.NegativeInfinity, float normalizedTransitionTime = 0.0f) - { - AnimatorLayerInfo layer = this.layers[layerIndex]; - if (layer == null) - return; - layer.OnCrossFade(animState.ToString(), normalizedTransitionDuration, normalizedTimeOffset, normalizedTransitionTime); - } - -} diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs.meta b/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs.meta deleted file mode 100644 index 448e6a1a..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/MonsterAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cfaa5c94122a41d4f8fa844112514102 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs deleted file mode 100644 index f80a8312..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs +++ /dev/null @@ -1,255 +0,0 @@ -#define ANIM_CROSS_FADE -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PCAnimation : UnitAnimation -{ - -#if !ANIM_CROSS_FADE - // 切换动画 - public enum ETrigger - { - ToIdle, - ToMove, - ToJump, - ToAttack, - ToAirAttack, - ToLanding, - } -#endif - - public enum ELayer - { - Basic = 0, - Attack, - SwordAttack, - GunAttack, - UpperBody, - LowerBody, - Count, - } - - - // 动作名,和animator里的state对应 - public enum EAnimState - { - // layer 0 - Idle = 0, - Move, - Jump, - Hit, - Attack, - Rise, - Stinger, - Turn, - Landing, - - Attack0, - Attack1, - Attack2, - Attack3,
-
- AttackToAir,
-
- AirAttack0, - AirAttack1, - AirAttack2, - AirAttack3,
- AirAttack4,
-
- AirDash, - - LandingGround, - } - - public override AnimatorLayerInfo baseLayer
- {
- get { return layers[(int)ELayer.Basic]; }
- } - - private UnitActionData m_ActionData; - - public bool applyRootMotion { get; set; } - public bool applyRootCurve { get; set; } // 程序生成的root motion - - public bool updateAnimationAuto { get; private set; } // 自动更新动画 - - private AnimatorOverrideController controller
- {
- get
- {
- Debug.Assert(owner.unitAnimation.animator.runtimeAnimatorController is AnimatorOverrideController);
- return owner.unitAnimation.animator.runtimeAnimatorController as AnimatorOverrideController;
- }
- } - - public override void Initialize() - { - base.Initialize(); - - m_Animator = this.m_Owner.unitObj.GetComponent<Animator>(); - - m_Animator.speed = 0; - - m_LayerInfo = new AnimatorLayerInfo[2]; - m_LayerInfo[0] = new AnimatorLayerInfo(this, m_Animator, (int)ELayer.Basic); - //m_LayerInfo[1] = new AnimatorLayerInfo(this, m_Animator, ELayer.Attack); - - if (m_Animator == null) - { - LogHelper.LogError("没有挂Animator组件"); - } - - applyRootMotion = true; - - updateAnimationAuto = true; - } - - public override void OnUpdate() - { - base.OnUpdate(); - - UpdateLayer(); - UpdateAnimation(); - UpdateRootMotion(); - UpdateRootCurve(); - } - - void UpdateLayer() - { - m_LayerInfo[0].OnUpdate(); - return; - for (int i = 0; i < m_LayerInfo.Length; ++i) - { - m_LayerInfo[i].OnUpdate(); - } - } - - void UpdateAnimation() - { - if(updateAnimationAuto)
- {
- m_Animator.speed = 1;
- m_Animator.Update(Time.deltaTime);
- m_Animator.speed = 0; - }
- } - - void UpdateRootMotion() - { - if (!applyRootMotion) - return; - - m_Owner.unitRootMotion.UpdateRootMotion(); - } - - void UpdateRootCurve() - { - if (!applyRootCurve) - return; - }
-
- AnimationData GetAnimationDataOfState(string name)
- {
- string animName = controller[name].name;
- string path = owner.folder + "AnimationData/" + animName + ".asset";
- AnimationData data = ResourceManager.Instance.LoadAsset<AnimationData>(path);
- return data;
- }
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void AnimIdle() - { - CrossFade(EAnimState.Idle, 0.2f, 0); - } - - public void AnimMove() - { - CrossFade(EAnimState.Move, 0.01f, 0); - } - - public void AnimJump() - { - CrossFade(EAnimState.Jump, 0.01f); - } - - public void AnimAirAttack(int id) - { - m_Owner.unitCollider.OnAnimationChange(); - EAnimState state = EAnimState.AirAttack0; - if (id == 1) state = EAnimState.AirAttack1; - else if (id == 2) state = EAnimState.AirAttack2; - else if (id == 3) state = EAnimState.AirAttack3;
- else if (id == 4) state = EAnimState.AirAttack4;
-
- AnimationData data = GetAnimationDataOfState(state.ToString());
- Debug.Assert(data != null);
- float offset = data.GetProperty(EAnimationProperty.ComboTimeOffset, 0);
- float duration = data.GetProperty(EAnimationProperty.TransitionInDuration, 0.1f);
- CrossFade(state, duration, offset); - } - - public void AnimAttackToAir(float offset)
- {
- m_Owner.unitCollider.OnAnimationChange();
- Play(EAnimState.AttackToAir, offset);
- } -
- public void AnimAttack(int id) - { - m_Owner.unitCollider.OnAnimationChange(); - switch (id) - { - case 0: - CrossFade(EAnimState.Attack0, 0.02f); - break; - case 1: - CrossFade(EAnimState.Attack1, 0.02f); - break; - case 2: - CrossFade(EAnimState.Attack2, 0.02f); - break; - case 3: - CrossFade(EAnimState.Attack3, 0.02f); - break; - } - } - - public void AnimAirDash() - { - AnimationData data = GetAnimationDataOfState(EAnimState.AirDash.ToString()); - if (baseLayer.stateInfo.IsName(EAnimState.AirDash.ToString())) - { - float offset = data.GetProperty(EAnimationProperty.ComboTimeOffset, 0); - this.Play(EAnimState.AirDash, offset); - } - else - { - CrossFade(EAnimState.AirDash, 0.02f); - } - } - - public void AnimLanding() - { - CrossFade(EAnimState.Landing, 0.05f); - } - - public void AnimLandingGround() - { - CrossFade(EAnimState.LandingGround, 0.00f); - } - - private void Play(EAnimState animState, float normalizedTime = float.NegativeInfinity, int layerIndex = 0) - { - base.Play(animState.ToString(), layerIndex, normalizedTime); - } - - private void CrossFade(EAnimState animState, float normalizedTransitionDuration, float normalizedTimeOffset = float.NegativeInfinity, float normalizedTransitionTime = 0.0f, int layerIndex = 0) - { - base.CrossFade(animState.ToString(), normalizedTransitionDuration, layerIndex, normalizedTimeOffset, normalizedTransitionTime); - } - -} diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs.meta b/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs.meta deleted file mode 100644 index 6999e268..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/PCAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f844378e1edf4b249b3b2f9a8e4a6842 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/RobotAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/RobotAnimation.cs deleted file mode 100644 index a25f453e..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/RobotAnimation.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RobotAnimation : 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/Components/UnitAnimation/RobotAnimation.cs.meta b/Assets/Scripts/Unit/Components/UnitAnimation/RobotAnimation.cs.meta deleted file mode 100644 index f1cbe366..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/RobotAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1f127e594317b84478999dccd109e5bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs b/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs deleted file mode 100644 index 1d407fc2..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs +++ /dev/null @@ -1,302 +0,0 @@ -#define ANIM_CROSS_FADE -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -#if UNITY_EDITOR -using UnityEditor; -#endif - -// 单独一层动画 -public class AnimatorLayerInfo -{ - public int layer; - - public int layerIndex { get { return (int)layer; } } - - public string name { get { return m_Animator.GetLayerName(layerIndex); } } - - public bool isBaseLayer { get { return layerIndex == 0; } } - - private Animator m_Animator; - - // 当前动作的animation data,如果是blendtree选第一个动作 - private AnimationData m_AnimationData; - public AnimationData animationData - { - get - { - AnimatorClipInfo[] clipInfos = clipsInfo; - if (clipInfos == null || clipInfos.Length == 0) - return null; - var clip = clipInfos[0]; //选第一个 - string folder = m_UnitAnimation.owner.folder; - string name = clip.clip.name; - if (m_AnimationData != null && m_AnimationData.animationName == name) - return m_AnimationData; - string path = folder + "AnimationData/" + name + ".asset" ; // 要注意这里使用名字区别的,因为最终每个角色的动画都会在一个目录下面 - m_AnimationData = ResourceManager.Instance.LoadAsset<AnimationData>(path); - return m_AnimationData; - } - } - - // 当前在播放的动作 - // 如果处于transition中,认为当前状态是transition的目标状态(和Animator规则不一样) - public AnimatorStateInfo stateInfo - { - get - { - AnimatorStateInfo stateInfo = m_Animator.GetCurrentAnimatorStateInfo(layerIndex); - if (isInTransition) // 过渡中的动作认为当前动作是下一个动作 - { - stateInfo = m_Animator.GetNextAnimatorStateInfo(layerIndex); - } - // Debug.Assert(stateInfo.IsName(layerName + "." + m_CurrentState)); - return stateInfo; - } - } - - private int preStateHash = -1; - - // 当前正在播放和融合的片段信息 - public AnimatorClipInfo[] clipsInfo - { - get - { - AnimatorClipInfo[] clips = null; - if (!isInTransition)
- {
- clips = m_Animator.GetCurrentAnimatorClipInfo(layerIndex);
- if (clips.Length == 0)
- {
- clips = m_Animator.GetNextAnimatorClipInfo(layerIndex);
- } - } - else // 过渡中的动作认为当前动作是下一个动作
- {
- clips = m_Animator.GetNextAnimatorClipInfo(layerIndex);
- } - return clips; - } - } - - public AnimatorClipInfo clipInfo
- {
- get
- {
- return clipsInfo[0];
- }
- } - - public int stateHash - { - get - { - return stateInfo.shortNameHash; - } - } - - // 并非准确的播放时间,只是逻辑时间,因为动画会加速减速 - public float playbackTimeInSeconds - { - get - { - return playbackNormalizedTime * clipInfo.clip.length; - } - } - - // 这个是真实世界的时间 - private float m_PlaybackRealTime; - public float playbackRealTimeInSeconds - { - get - { - return m_PlaybackRealTime; - } - } - - // 播放进度百分比,[0-1],是逻辑上的,如果动画不是loop,那么播放完后normalizedTime是1 - public float playbackNormalizedTime - { - get - { - AnimatorStateInfo state = stateInfo; - if (!state.loop && state.normalizedTime > 1) - return 1; - //if (state.IsName("Attack0"))
- //{
- // Debug.Log("normalizedTime=" + state.normalizedTime); - // Debug.Log("playbackTimeInSeconds=" + state.normalizedTime * clipInfo.clip.length); - //} - return state.normalizedTime % 1f; - } - } - - public float playbackSpeed - { - get - { - return m_Animator.GetFloat("PlaybackSpeed" + layerIndex); - } - set - { - float v = Mathf.Clamp(value, 0, 10); - m_Animator.SetFloat("PlaybackSpeed" + layerIndex, v); - } - } - - public float weight - { - get - { - return m_Animator.GetLayerWeight(layerIndex); - } - } - - public int nextStateHash - { - get - { - AnimatorStateInfo nextState = m_Animator.GetNextAnimatorStateInfo(layerIndex); - int hash = nextState.shortNameHash; // 如果不在过渡中,hash是0 - return hash; - } - } - - public bool isInTransition - { - get - { - return m_Animator.IsInTransition(layerIndex); - } - } - - public bool applySpeedCurve { get; set; } - - UnitAnimation m_UnitAnimation; - - Coroutine m_CalcPlaybackTimeCoroutine; - - TimelineEventProxy m_TimelineEventProxy; - - public string m_CurrentState; - - public AnimatorLayerInfo(UnitAnimation unitAnimation, Animator animator, int layer) - { - this.m_UnitAnimation = unitAnimation; - this.m_Animator = animator; - this.layer = layer; - m_CalcPlaybackTimeCoroutine = unitAnimation.StartCoroutine(CalcPlaybackRealTimeCoroutine()); - m_TimelineEventProxy = new TimelineEventProxy(unitAnimation.owner); - applySpeedCurve = true; - } - - IEnumerator CalcPlaybackRealTimeCoroutine() - { - while (true) - { - if(preStateHash != stateHash) - { - m_PlaybackRealTime = 0; - } - m_PlaybackRealTime += Time.deltaTime; - preStateHash = stateHash; - yield return null; - } - } - - public bool IsToggleOpen(EAnimationToogle toggle) - { - if (m_AnimationData == null) - return false; - return m_AnimationData.IsToggleOpen(toggle, playbackNormalizedTime); - } - - public void OnUpdate() - { - // 执行事件 - m_TimelineEventProxy.ExecuteAnimationEvents(animationData, playbackTimeInSeconds * TimelineEventProxy.FPS); - - // 播放速度控制 - if (applySpeedCurve && animationData != null && animationData.speedCurve != null) - { - playbackSpeed = animationData.speedCurve.Evaluate(playbackNormalizedTime); - } - } - - public void OnCrossFade(string animState, float normalizedTransitionDuration, float normalizedTimeOffset, float normalizedTransitionTime ) - { - m_CurrentState = animState;
- m_Animator.CrossFade(animState.ToString(), normalizedTransitionDuration, layerIndex, normalizedTimeOffset, normalizedTransitionTime);
- m_TimelineEventProxy.ResetPrevAnimationData();
-
- playbackSpeed = 1;
- }
-
- public void OnPlay(string animState, float normalizedTime) - { - m_CurrentState = animState; - m_Animator.Play(animState, layerIndex, normalizedTime); - m_TimelineEventProxy.ResetPrevAnimationData();
-
- playbackSpeed = 1;
- } - -} - -[DisallowMultipleComponent] -public class UnitAnimation : UnitComponent -{ - public AnimatorLayerInfo[] layers { get { return m_LayerInfo; } } - protected AnimatorLayerInfo[] m_LayerInfo; - - public Animator animator { get { return m_Animator; } } - protected Animator m_Animator;
-
- public virtual AnimatorLayerInfo baseLayer
- {
- get { return layers[0]; }
- } - - public bool isInTransition - { - get - { - return m_Animator.IsInTransition(0); - } - }
-
- public override void OnUpdate()
- {
- base.OnUpdate();
- }
-
- public void Play(string animState, int layerIndex = 0, float normalizedTime = float.NegativeInfinity) - {
- AnimatorLayerInfo layer = this.layers[layerIndex];
- if (layer == null)
- return;
- layer.OnPlay(animState, normalizedTime);
-
- UnitRootMotion rm = m_Owner.GetComponent<UnitRootMotion>();
- if(rm)
- {
- rm.OnAnimationChange();
- }
- }
-
- public void CrossFade(string animState, float normalizedTransitionDuration, int layerIndex = 0, float normalizedTimeOffset = float.NegativeInfinity, float normalizedTransitionTime = 0.0f)
- {
- AnimatorLayerInfo layer = this.layers[layerIndex];
- if (layer == null)
- return;
- layer.OnCrossFade(animState, normalizedTransitionDuration, normalizedTimeOffset, normalizedTransitionTime);
-
- UnitRootMotion rm = m_Owner.GetComponent<UnitRootMotion>();
- if (rm)
- {
- rm.OnAnimationChange();
- }
- } - -} diff --git a/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs.meta b/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs.meta deleted file mode 100644 index 75ce33fe..00000000 --- a/Assets/Scripts/Unit/Components/UnitAnimation/UnitAnimation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4af875f33239ebf409f3e4954c0ee0cb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitBody.cs b/Assets/Scripts/Unit/Components/UnitBody.cs deleted file mode 100644 index cc7ac348..00000000 --- a/Assets/Scripts/Unit/Components/UnitBody.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class UnitBody : UnitComponent
-{
- public override void Initialize()
- {
- base.Initialize();
- }
-
- public override void OnUpdate()
- {
- base.OnUpdate();
- }
-
- public override void OnDestroy()
- {
- base.OnDestroy();
- }
-
- public void OnLateAnimatorUpdate()
- {
-
- }
-
-}
diff --git a/Assets/Scripts/Unit/Components/UnitBody.cs.meta b/Assets/Scripts/Unit/Components/UnitBody.cs.meta deleted file mode 100644 index 01a2d416..00000000 --- a/Assets/Scripts/Unit/Components/UnitBody.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d90e40c0e85fa474ba6282bcb5bab16b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitCollider.cs b/Assets/Scripts/Unit/Components/UnitCollider.cs deleted file mode 100644 index 3fd9a6dc..00000000 --- a/Assets/Scripts/Unit/Components/UnitCollider.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 角色当前的碰撞盒 -[DisallowMultipleComponent] -public class UnitCollider : UnitComponent -{ - public bool showGizmos; - - private Dictionary<int/*hitbox hash*/, List<int/*unitController hash*/>> m_HitMask = new Dictionary<int, List<int>>(); - - public override void Awake() - { - base.Awake(); - - ColliderRegistry.Instance.AddCollider(this); - } - - public override void OnDestroy() - { - ColliderRegistry.Instance.RemoveCollider(this); - - base.OnDestroy(); - } - - public override void Initialize() - { - base.Initialize(); - showGizmos = true; - } - - // 返回当前激活的对应类型的碰撞盒数据 - public ColliderInfo[] GetCurrentBoxesInfoByType(ColliderBox.EColliderType type, int layer = 0) - { - var layerInfo = m_Owner.unitAnimation.layers[0]; - AnimationData animData = layerInfo.animationData; - AnimatorClipInfo[] clipInfos = layerInfo.clipsInfo; - //if(clipInfos == null || clipInfos.Length == 0) - //{ - // return null; - //} - float playbackTime = layerInfo.playbackNormalizedTime * clipInfos[0].clip.length; - //float playbackTime = layerInfo.playbackRealTimeInSeconds; - ColliderInfo[] infos = animData.GetActiveCollidersInfo(type, playbackTime); - return infos; - } - - // 动作切换,重置collider mask - public void OnAnimationChange() - { - m_HitMask.Clear(); - } - - public void RecordCollision(int colliderHash, int targetHash) - { - List<int> record; - if (!m_HitMask.TryGetValue(colliderHash, out record)) - { - record = new List<int>(); - m_HitMask.Add(colliderHash, record); - } - record.Add(targetHash); - } - - public bool CanCollide(int colliderHash, int targetHash) - { - List<int> record; - if(!m_HitMask.TryGetValue(colliderHash, out record)) - { - return true; - } - return !record.Contains(targetHash); - } - -#if UNITY_EDITOR - - // 绘制collider调试 - public void OnDrawGizmos() - { - if (!showGizmos) - return; - - Vector3 unitPos = m_Owner.transform.position; - - OnDrawColliders(ColliderBox.EColliderType.HurtBox, Color.green); - OnDrawColliders(ColliderBox.EColliderType.HitBox, Color.red); - } - - void OnDrawColliders(ColliderBox.EColliderType type, Color color) - { - ColliderInfo[] boxes = GetCurrentBoxesInfoByType(type); - if (boxes == null || boxes.Length == 0) - return; - Vector3 unitPos = m_Owner.transform.position; - Quaternion right = Quaternion.Euler(0, 0, 0); - Vector3 fac = new Vector3(1,1, m_Owner.transform.forward.normalized == Vector3.forward ? 1 : -1); - Color oldC = Gizmos.color; - Gizmos.color = color * 0.5f; - for (int i = 0; i < boxes.Length; ++i) - { - var box = boxes[i]; - if (!box.isValid) - continue; - Vector3 localPos = m_Owner.transform.rotation * box.position; - Vector3 localSize = box.size; - var pivot = box.pivot; - Vector3 pos = Vector3.zero; // gizmo位置 - switch (pivot) - { - case ColliderBox.Pivot.MiddleBottom: - localPos.y += localSize.y / 2; - break; - } - pos = unitPos + Vector3.Scale(localPos, fac); - Gizmos.DrawCube(pos, localSize); - } - Gizmos.color = oldC; - } - -#endif - -} diff --git a/Assets/Scripts/Unit/Components/UnitCollider.cs.meta b/Assets/Scripts/Unit/Components/UnitCollider.cs.meta deleted file mode 100644 index fa98ddc9..00000000 --- a/Assets/Scripts/Unit/Components/UnitCollider.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1a4f3dea33ad590458ab820a086a8be3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitComponent.cs b/Assets/Scripts/Unit/Components/UnitComponent.cs deleted file mode 100644 index 825b6d92..00000000 --- a/Assets/Scripts/Unit/Components/UnitComponent.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class UnitComponent : MonoBehaviour -{ - public UnitController owner { get { return m_Owner; } } - - protected UnitController m_Owner; - - public bool IsAlive - { - get - { - return m_Owner != null; - } - } - - public virtual void Awake() - { - } - - public virtual void OnDestroy() - { - } - - public virtual void Initialize() - { - m_Owner = GetComponent<UnitController>(); - } - - public virtual void OnPostInitialize() - { - } - - public virtual void Release() - { - m_Owner = null; - StopAllCoroutines(); - } - - public virtual void OnUpdate() { } - - private void Update() { } - -} diff --git a/Assets/Scripts/Unit/Components/UnitComponent.cs.meta b/Assets/Scripts/Unit/Components/UnitComponent.cs.meta deleted file mode 100644 index 2641a06f..00000000 --- a/Assets/Scripts/Unit/Components/UnitComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c2f1fe7707e5364aab4ddc6a962bb6e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitImageEffect.cs b/Assets/Scripts/Unit/Components/UnitImageEffect.cs deleted file mode 100644 index fcdd5c1f..00000000 --- a/Assets/Scripts/Unit/Components/UnitImageEffect.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine;
-
-// Unit的一种后处理效果,渲染到一个RT上,对这个RT做效果
-
-public class UnitImageEffectHolder -{ - public float size; - public GameObject gameObject; - public MeshRenderer renderer - { - get - { - if (gameObject == null) - return null; - return gameObject.GetComponent<MeshRenderer>(); - } - } -} - -public class UnitImageEffectHandle -{ - public delegate void UnitImageEffectStepCallback(float normalizedTime);
- public delegate void UnitImageEffectEndCallback();
-
- public float lifeTime; - public float curTime; - public UnitImageEffectHolder holder; - - public UnitImageEffectStepCallback stepFunc; - public UnitImageEffectEndCallback onStop; -} - -public class UnitImageEffect : UnitComponent -{ - public List<UnitImageEffectHandle> effects = new List<UnitImageEffectHandle>(); - - public static GameObject effectPlane; - - private Dictionary<float/*size*/, List<UnitImageEffectHolder>/*pool*/> m_HolderPool = new Dictionary<float, List<UnitImageEffectHolder>>(); - - private ObjectPool<UnitImageEffectHandle> m_HandlePool = new ObjectPool<UnitImageEffectHandle>(null, null); - - public override void OnUpdate() - { - base.OnUpdate(); - List<UnitImageEffectHandle> temp = ListPool<UnitImageEffectHandle>.Get(); - for(int i = 0; i < effects.Count; ++i) - { - var handle = effects[i]; - handle.curTime += Time.deltaTime; - if(handle.curTime > handle.lifeTime) - { - temp.Add(handle); - handle.onStop?.Invoke(); - continue; - } - handle.stepFunc?.Invoke(handle.curTime / handle.lifeTime); - } - for(int j = 0; j < temp.Count; j++) - { - temp[j].holder.gameObject.SetActive(false); - ReleaseHolder(ref temp[j].holder); - effects.Remove(temp[j]); - m_HandlePool.Release(temp[j]); - } - ListPool<UnitImageEffectHandle>.Release(temp); - } - - UnitImageEffectHolder ClaimHolder(float size) - { - List<UnitImageEffectHolder> holders; - if (m_HolderPool.TryGetValue(size, out holders)) - { - if (holders.Count > 0) - { - var holder = holders[holders.Count - 1]; - holders.RemoveAt(holders.Count - 1); - return holder; - } - } - UnitImageEffectHolder newHolder = new UnitImageEffectHolder(); - newHolder.size = size; - Mesh mesh = new Mesh(); - mesh.vertices = new Vector3[4] { - new Vector3(-size/2, size/2, 0), - new Vector3(size/2, size/2, 0), - new Vector3(size/2, -size/2, 0), - new Vector3(-size/2, -size/2, 0) - }; - mesh.uv = new Vector2[4] { - new Vector2(0, 1), - new Vector2(1, 1), - new Vector2(1, 0), - new Vector2(0, 0), - }; - mesh.triangles = new int[6] { - 0, 1, 3, - 1, 2, 3, - }; - mesh.UploadMeshData(true); - newHolder.gameObject = new GameObject("Image Effect Holder(" + size + "m)"); - MeshFilter filter = newHolder.gameObject.AddComponent<MeshFilter>(); - filter.sharedMesh = mesh; - MeshRenderer renderer = newHolder.gameObject.AddComponent<MeshRenderer>(); - renderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; - renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; - renderer.receiveShadows = false; - renderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; - renderer.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion; - renderer.allowOcclusionWhenDynamic = false; - return newHolder; - } - - void ReleaseHolder(ref UnitImageEffectHolder holder) - { - float size = holder.size; - List<UnitImageEffectHolder> holders; - if (!m_HolderPool.TryGetValue(size, out holders)) - { - holders = new List<UnitImageEffectHolder>(); - m_HolderPool.Add(size, holders); - } - holder.gameObject.SetActive(false); - holder.gameObject.transform.position = Vector3.zero; - holders.Add(holder); - holder = null; - }
-
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void ShowMotionBlur(float lifeTime, float angle, float distance) - { - UnitImageEffectHandle handle = m_HandlePool.Get(); - - handle.lifeTime = lifeTime; - handle.curTime = 0; - float size = UnitManager.Instance.pc.unitDetail.snapshotBound; - handle.holder = ClaimHolder(size); - handle.holder.gameObject.SetActive(true); - string matPath = StaticDefine.imageEffectMaterails[EImageEffectMaterails.MotionBlur]; - handle.holder.renderer.sharedMaterial = ResourceManager.Instance.LoadAsset<Material>(matPath); - - MaterialPropertyBlock block = new MaterialPropertyBlock(); - handle.holder.renderer.GetPropertyBlock(block); - block.SetFloat("_Angle", angle); - block.SetFloat("_Distance", distance); - handle.holder.renderer.SetPropertyBlock(block); - - handle.stepFunc = (float normalTime) => - { - handle.holder.gameObject.transform.position = UnitManager.Instance.pc.center; - - handle.holder.renderer.GetPropertyBlock(block); - block.SetFloat("_Distance", /*(normalTime) * */distance); - handle.holder.renderer.SetPropertyBlock(block); - }; - - effects.Add(handle); - } - - public void ShowGlitch(float lifeTime, bool hideUnitInMainCamera = true) - { - PCController pc = UnitManager.Instance.pc as PCController;
-
- UnitImageEffectHandle handle = m_HandlePool.Get(); - - handle.lifeTime = lifeTime; - handle.curTime = 0; - float size = UnitManager.Instance.pc.unitDetail.snapshotBound; - handle.holder = ClaimHolder(size); - handle.holder.gameObject.SetActive(true); - string matPath = StaticDefine.imageEffectMaterails[EImageEffectMaterails.Glitch]; - handle.holder.renderer.sharedMaterial = ResourceManager.Instance.LoadAsset<Material>(matPath); - - MaterialPropertyBlock block = new MaterialPropertyBlock(); - handle.holder.renderer.GetPropertyBlock(block); - handle.holder.renderer.SetPropertyBlock(block); - - handle.stepFunc = (float normalTime) => { - UnitCamera.Instance.Render(); - - handle.holder.gameObject.transform.position = UnitManager.Instance.pc.center; - - handle.holder.renderer.GetPropertyBlock(block); - handle.holder.renderer.SetPropertyBlock(block); - }; - - if (hideUnitInMainCamera)
- {
- pc.unitRender.SetVisibilityInAllCameras(false);
- } - - handle.onStop = () => {
- pc.unitRender.SetVisibilityInAllCameras(true);
- };
-
- effects.Add(handle); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitImageEffect.cs.meta b/Assets/Scripts/Unit/Components/UnitImageEffect.cs.meta deleted file mode 100644 index 32f7eebc..00000000 --- a/Assets/Scripts/Unit/Components/UnitImageEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: af35b46f81aa698408be0540784f808d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitLensEffect.cs b/Assets/Scripts/Unit/Components/UnitLensEffect.cs deleted file mode 100644 index e145c331..00000000 --- a/Assets/Scripts/Unit/Components/UnitLensEffect.cs +++ /dev/null @@ -1,234 +0,0 @@ -using System; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -// Unit效果之一,镜头效果,通过command buffer实现 - -public partial class UnitLensEffect : UnitComponent -{
- private List<RendererProxy> renderers;
-
- private static ObjectPool<CommandBuffer> m_CommandBufferPool;
-
- private List<LensEffectBase> m_Effects; - - // 每个角色维护单独的command buffers,而不是共享command buffer。有一定开销,但不重要。 - private Dictionary<ERenderingEvent, CommandBuffer> m_InUseCommandBuffers;
- private Dictionary<ERenderingEvent, CommandBuffer> m_CachedCommandBuffers;
-
- static UnitLensEffect()
- {
- m_CommandBufferPool = new ObjectPool<CommandBuffer>(null, null);
- }
-
- public override void Initialize()
- {
- base.Initialize();
-
- renderers = new List<RendererProxy>();
- m_Effects = new List<LensEffectBase>(); - m_InUseCommandBuffers = new Dictionary<ERenderingEvent, CommandBuffer>(); - m_CachedCommandBuffers = new Dictionary<ERenderingEvent, CommandBuffer>(); - }
-
- public override void OnUpdate()
- {
- base.OnUpdate();
-
- }
-
- public override void OnPostInitialize()
- {
- base.OnPostInitialize();
-
- IBodyRendererAgent body = owner.unitRender.body;
- if (body == null || body.renderers == null)
- return;
- for (int i = 0; i < body.renderers.Length; ++i)
- {
- var renderer = body.renderers[i];
- if (renderer == null)
- continue;
- RendererProxy proxy = renderer.renderer.gameObject.GetOrAddComponent<RendererProxy>();
- proxy.Initialize(renderer);
- proxy.onWillRenderObject = OnWillRenderObj;
- proxy.onRenderObject = OnRenderObj;
- renderers.Add(proxy);
- }
-
- MainCamera.Instance.customRenderingPipeline.onPreCull += OnWillRenderUnit;
- MainCamera.Instance.customRenderingPipeline.onPostRender += OnRenderUnit;
-
- /////
- //m_Effects.Add(new LensEffect_MotionBlur());
- //m_Effects.Add(new LensEffect_BlurRim(Color.blue));
- //m_Effects.Add(new LensEffect_Buzz());
- }
-
- public override void Release()
- {
- MainCamera.Instance.customRenderingPipeline.onPreCull -= OnWillRenderUnit;
- MainCamera.Instance.customRenderingPipeline.onPostRender -= OnRenderUnit;
-
- base.Release();
- }
-
- private void OnWillRenderUnit()
- { - if (m_Effects == null || m_Effects.Count == 0) - return; - - PrepareCommandBuffers(); -
- IBodyRendererAgent body = owner.unitRender.body;
- if (body == null || body.renderers == null)
- return;
- if (m_Effects == null || m_Effects.Count == 0)
- return;
- foreach (var cb in m_InUseCommandBuffers)
- {
- cb.Value.Clear();
- ERenderingEvent re = cb.Key;
- CameraEvent ce = re.ToCameraEvent();
- for (int i = 0; i < m_Effects.Count; ++i)
- {
- LensEffectBase eff = m_Effects[i];
- if (!eff.renderingEvents.HasFlag(re))
- continue;
- MethodInfo method = eff.GetType().GetMethod(re.ToString(), BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(LensEffectBase.EStage), typeof(CommandBuffer) }, null);
- if (method == null)
- continue;
- eff.owner = owner;
- method.Invoke(eff, new object[] { LensEffectBase.EStage.BeforeIterate, cb.Value });
-
- // iterate unit renderers
- for (int j = 0; j < body.renderers.Length; ++j)
- {
- var renderer = body.renderers[j];
- if (renderer == null)
- continue;
- eff.curBodypartRenderer = renderer;
- method.Invoke(eff, new object[] { LensEffectBase.EStage.Iterate, cb.Value });
- }
-
- method.Invoke(eff, new object[] { LensEffectBase.EStage.AfterIterate, cb.Value });
- } - MainCamera.Instance.camera.AddCommandBuffer(ce, cb.Value); - }
- }
-
- private void OnRenderUnit()
- { - if (m_Effects == null || m_Effects.Count == 0) - return;
-
- // 执行每个event的finisher
- foreach (var cb in m_InUseCommandBuffers)
- {
- ERenderingEvent re = cb.Key;
- for (int i = 0; i < m_Effects.Count; ++i)
- {
- LensEffectBase eff = m_Effects[i];
- if (!eff.renderingEvents.HasFlag(re))
- continue;
- MethodInfo method = eff.GetType().GetMethod(re.ToString(), BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(LensEffectBase.EStage), typeof(CommandBuffer) }, null);
- if (method == null)
- continue;
- method.Invoke(eff, new object[] { LensEffectBase.EStage.FinishRender, cb.Value });
- }
- }
-
- List<LensEffectBase> temp = ListPool<LensEffectBase>.Get();
-
- for (int i = 0; i < m_Effects.Count; ++i)
- {
- LensEffectBase eff = m_Effects[i];
- eff.OnRenderFinish();
- if (eff.CanDestroy())
- temp.Add(eff);
- }
-
- for (int i = 0; i < temp.Count; ++i)
- {
- temp[i].OnDestroy();
- m_Effects.Remove(temp[i]);
- }
-
- ListPool<LensEffectBase>.Release(temp);
-
- foreach (var cb in m_InUseCommandBuffers)
- {
- CameraEvent ce = cb.Key.ToCameraEvent();
- MainCamera.Instance.camera.RemoveCommandBuffer(ce, cb.Value); - }
- }
-
- private void OnWillRenderObj(BodyPartRenderer renderer)
- {
- }
-
- private void OnRenderObj(BodyPartRenderer renderer)
- {
- } - - void PrepareCommandBuffers()
- {
- if (m_InUseCommandBuffers.Count != 0)
- {
- var temp = m_CachedCommandBuffers;
- m_CachedCommandBuffers = m_InUseCommandBuffers;
- m_InUseCommandBuffers = temp;
- }
- ERenderingEvent usedEvent = ERenderingEvent.None; - for (int i = 0; i < m_Effects.Count; ++i)
- {
- usedEvent |= m_Effects[i].renderingEvents;
- }
- foreach (ERenderingEvent evt in Enum.GetValues(typeof(ERenderingEvent)))
- {
- if (evt == ERenderingEvent.None)
- continue;
- if (usedEvent.HasFlag(evt))
- {
- CommandBuffer cb;
- if (m_CachedCommandBuffers.TryGetValue(evt, out cb))
- {
- m_CachedCommandBuffers.Remove(evt);
- }
- else
- {
- cb = m_CommandBufferPool.Get();
- cb.name = evt.ToString();
- }
- m_InUseCommandBuffers.Add(evt, cb);
- }
- }
- foreach (var cb in m_CachedCommandBuffers)
- {
- m_CommandBufferPool.Release(cb.Value);
- }
- m_CachedCommandBuffers.Clear();
- }
-
- static CommandBuffer ClaimCommandBuffer()
- {
- CommandBuffer cb = m_CommandBufferPool.Get();
- cb.Clear();
- return cb;
- }
-
- static void ReleaseCommandBuffer(ref CommandBuffer cb)
- {
- m_CommandBufferPool.Release(cb);
- cb = null;
- } - - public void AddEffect(LensEffectBase effect)
- {
- m_Effects.Add(effect);
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitLensEffect.cs.meta b/Assets/Scripts/Unit/Components/UnitLensEffect.cs.meta deleted file mode 100644 index 5a91ee87..00000000 --- a/Assets/Scripts/Unit/Components/UnitLensEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d2d69fdca26298548ba2c146496c33c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs b/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs deleted file mode 100644 index 31d3c549..00000000 --- a/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; -using UnityEngine.Rendering; - -public partial class UnitLensEffect : UnitComponent -{
-
- public void Dash(Color color, float lifeTime, float angle, UnitSnapshotInfo snapshot)
- {
- LensEffect_Dash dash = new LensEffect_Dash(color, lifeTime, angle, snapshot);
- owner.unitLensEffect.AddEffect(dash);
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs.meta b/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs.meta deleted file mode 100644 index 78ed27ad..00000000 --- a/Assets/Scripts/Unit/Components/UnitLensEffect_Effects.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 16bed6a0d9a62e74987b4e6b5d70403c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitMovement.cs b/Assets/Scripts/Unit/Components/UnitMovement.cs deleted file mode 100644 index cb1df193..00000000 --- a/Assets/Scripts/Unit/Components/UnitMovement.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class UnitMovement : UnitComponent -{ - - -} diff --git a/Assets/Scripts/Unit/Components/UnitMovement.cs.meta b/Assets/Scripts/Unit/Components/UnitMovement.cs.meta deleted file mode 100644 index 6978a4bd..00000000 --- a/Assets/Scripts/Unit/Components/UnitMovement.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8a0ce2076d45ed44da0dfc96f277aa36 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitPostEffect.cs b/Assets/Scripts/Unit/Components/UnitPostEffect.cs deleted file mode 100644 index ad98ff6a..00000000 --- a/Assets/Scripts/Unit/Components/UnitPostEffect.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class UnitPostEffect : UnitComponent -{ - - public override void Initialize() - { - base.Initialize(); - } - - - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitPostEffect.cs.meta b/Assets/Scripts/Unit/Components/UnitPostEffect.cs.meta deleted file mode 100644 index d91936b9..00000000 --- a/Assets/Scripts/Unit/Components/UnitPostEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a7d49a2074b33d342beb20900188941d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs b/Assets/Scripts/Unit/Components/UnitPreprocessing.cs deleted file mode 100644 index 8c56f0b6..00000000 --- a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering;
-
-// 给每个角色准备一些特殊的前置渲染
-public class UnitPreprocessing : UnitComponent -{ - [Flags] - public enum EUnitPreprocessing - { - None, - DepthTexture, // Unit Depth Texture
- WorldNormalTexture, // Unit World Normal Texture
- } - - public EUnitPreprocessing preprocessing;
-
- #region render textures - public RenderTexture unitDepthTexture { get; private set; } - public RenderTexture unitWorldNormalTexture { get; private set; }
- public RenderTexture unitMotionVectorTexture { get; private set; }
- #endregion -
- private CommandBuffer m_CommandBufferBeforeDepth; - - private Material m_MaterialDepth; - - public override void Initialize() - { - base.Initialize(); - } - - public override void OnPostInitialize() - { - base.OnPostInitialize(); - - MainCamera.Instance.customRenderingPipeline.onPreCull += OnWillRenderUnit; - MainCamera.Instance.customRenderingPipeline.onPostRender += OnRenderUnit; - - m_CommandBufferBeforeDepth = new CommandBuffer(); - m_CommandBufferBeforeDepth.name = "Unit Preprocessing(" + owner.unitObj.name + ")"; - - PrepareRenderTextures(); - PrepareMaterials(); - } - - void PrepareRenderTextures() - { - int unitHash = owner.GetHashCode(); - - int width = MainCamera.Instance.camera.pixelWidth; - int height = MainCamera.Instance.camera.pixelHeight; - unitDepthTexture = new RenderTexture(width, height, 24, RenderTextureFormat.Depth, RenderTextureReadWrite.Linear); - unitDepthTexture.name = "UnitDepthTexture_" + owner.GetHashCode(); - } - - void PrepareMaterials() - { - m_MaterialDepth = new Material(Shader.Find(StaticDefine.shaders[EShader.UnitDepth].name)); - } - - public override void OnUpdate() - { - base.OnUpdate(); - } - - public override void Release() - { - MainCamera.Instance.customRenderingPipeline.onPreCull -= OnWillRenderUnit; - MainCamera.Instance.customRenderingPipeline.onPostRender -= OnRenderUnit; - - base.Release(); - } - - private void OnWillRenderUnit() - {
- RenderDepthTexture();
- //RenderWorldNormal();
- RenderMotionVector();
- MainCamera.Instance.camera.AddCommandBuffer(CameraEvent.BeforeDepthTexture, m_CommandBufferBeforeDepth);
- } - - void RenderDepthTexture() - { - var cb = m_CommandBufferBeforeDepth; - cb.Clear(); - cb.SetRenderTarget(unitDepthTexture); - cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); - - cb.SetGlobalVector("unity_LightShadowBias", Vector4.zero); - - foreach (var r in GetRenderers()) - { - BodyPartRenderer br = r as BodyPartRenderer; - if (br == null) - continue; - Renderer renderer = br.renderer as Renderer; - if (renderer == null) - continue; - cb.DrawRenderer(renderer, m_MaterialDepth); - } - }
-
- void RenderMotionVector()
- {
- }
-
- //void RenderWorldNormal()
- //{
- // var cb = m_CommandBufferBeforeDepth;
- // cb.Clear();
- // cb.GetTemporaryRT(unitWorldNormalTextureID, -1, -1, 24, FilterMode.Point, RenderTextureFormat.RG16, RenderTextureReadWrite.Linear);
- // cb.SetRenderTarget(unitWorldNormalTextureID);
- // cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
- //}
-
- IEnumerable GetRenderers() - { - IBodyRendererAgent body = owner.unitRender.body; - if (body == null || body.renderers == null || body.renderers.Length == 0) - yield break; - for (int j = 0; j < body.renderers.Length; ++j) - { - yield return body.renderers[j]; - } - } - - private void OnRenderUnit() - {
- //m_CommandBufferBeforeDepth.ReleaseTemporaryRT(unitDepthTextureID);
-
- MainCamera.Instance.camera.RemoveCommandBuffer(CameraEvent.BeforeDepthTexture, m_CommandBufferBeforeDepth); - } -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs.meta b/Assets/Scripts/Unit/Components/UnitPreprocessing.cs.meta deleted file mode 100644 index 734df2f2..00000000 --- a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1998e85be970d1541843ff6166f6c771 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitRender.cs b/Assets/Scripts/Unit/Components/UnitRender.cs deleted file mode 100644 index a5822ffe..00000000 --- a/Assets/Scripts/Unit/Components/UnitRender.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 角色渲染 -[DisallowMultipleComponent] -public class UnitRender : UnitComponent -{ - public IBodyRendererAgent body { get { return m_Body; } } - private IBodyRendererAgent m_Body; - - public Renderer mainRenderer
- {
- get
- {
- if (this.owner.unitDetail == null)
- return null;
- return m_Body.mainRenderer.renderer;
- }
- } - - public override void Initialize()
- {
- base.Initialize();
- } - - public override void OnPostInitialize()
- {
- base.OnPostInitialize();
- m_Body = owner.unitDetail as IBodyRendererAgent;
- } - - public void SetVisibilityInMainCamera(bool isVisible)
- {
- LayerMask mask = LayerMask.GetMask("PlayerCharacter");
- if (!isVisible)
- {
- //SceneManager.Instance.mainCamera.cullingMask &= ~mask.value;
- }
- else
- {
- //SceneManager.Instance.mainCamera.cullingMask |= mask.value;
- }
- } - - public void SetVisibilityInAllCameras(bool isVisible)
- {
- if (mainRenderer == null)
- return;
-
- if (isVisible)
- {
- //mainRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
- }
- else
- {
- //mainRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly;
- }
- } - -}
diff --git a/Assets/Scripts/Unit/Components/UnitRender.cs.meta b/Assets/Scripts/Unit/Components/UnitRender.cs.meta deleted file mode 100644 index 98aaba31..00000000 --- a/Assets/Scripts/Unit/Components/UnitRender.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8a5b6a015d074924b8a247980bb04693 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitSkill.cs b/Assets/Scripts/Unit/Components/UnitSkill.cs deleted file mode 100644 index 3e1e480d..00000000 --- a/Assets/Scripts/Unit/Components/UnitSkill.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 技能逻辑 -[DisallowMultipleComponent] - -public class UnitSkill : UnitComponent -{ - - -} diff --git a/Assets/Scripts/Unit/Components/UnitSkill.cs.meta b/Assets/Scripts/Unit/Components/UnitSkill.cs.meta deleted file mode 100644 index 882bb398..00000000 --- a/Assets/Scripts/Unit/Components/UnitSkill.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d55937c5d88bcc84986d79cd2ec0468b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState.meta b/Assets/Scripts/Unit/Components/UnitState.meta deleted file mode 100644 index 7dca0bf1..00000000 --- a/Assets/Scripts/Unit/Components/UnitState.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b9414a0ec8c909c4ebb11b46a7f0819d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs b/Assets/Scripts/Unit/Components/UnitState/DroneState.cs deleted file mode 100644 index 28640664..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class DroneState : 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/Components/UnitState/DroneState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta deleted file mode 100644 index ab3a2898..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/DroneState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a6917bf61e4a31945846081533eb02f4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs deleted file mode 100644 index c2a581b1..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs +++ /dev/null @@ -1,218 +0,0 @@ -using System; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class MonsterState : UnitState -{ - public enum EUnitState - { - Nien, - - Idle, - - Move, - - HitLight, - HitAir, - HitInAir,
- HitGround, - HitFall, - KnockDown, - Rise, - - Pull, - Landing, - } - - [SerializeField] private EUnitState m_State; - public EUnitState CurrentState { get { return m_State; } } - - UnitAnimation unitAnimation { get { return m_Owner.unitAnimation; } } - - public override void Initialize() - { - base.Initialize(); - } - - public void ChangeState<T>(EUnitState nextState, T param = default, bool bForce = false) - { - if (!IsChange(nextState, bForce)) - return; - - LogHelper.Log("Monster UnitState: " + m_State.ToString() + " -> " + nextState.ToString()); - - StopAllCoroutines(); - - EUnitState prevState = m_State; - string methodFunc = "On" + m_State.ToString() + "Exit"; - MethodInfo exitMethod = GetType().GetMethod(methodFunc, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(EUnitState) }, null); - if (exitMethod != null) - { - exitMethod.Invoke(this, new object[] { nextState }); - } - else - { - LogHelper.LogError("缺少 " + methodFunc); - } - m_State = nextState; - - StartCoroutine(m_State.ToString(), param); - } - - bool IsChange(EUnitState newState, bool bForce) - { - if (newState != m_State || bForce) - return true; - return false; - } - - IEnumerator Nein() { yield break; } - void OnNienExit(EUnitState nextState) { } - - public struct IdleParam { } - - public struct LandingParam { } - - public struct HitLightParam { } - - public struct HitAirParam { } - - public struct RiseParam { } - - public struct HitInAirParam { } - - #region Idle - - IEnumerator Idle(IdleParam param) - { - //if (m_Owner.isInAir) // 浮空切换到landing - //{ - // ChangeState(EUnitState.Landing, new LandingParam()); - //} - //else // idle - //{ - m_Owner.SetYPosition(0); - m_Owner.monsterAnimation.AnimIdle(); - while (true) - { - yield return null; - } - //} - } - - void OnIdleExit(EUnitState nextState) - { - } - #endregion - - #region HitLight - - IEnumerator HitLight(HitLightParam param) - { - ((MonsterController)owner).FacePC(); - m_Owner.monsterAnimation.AnimHitBackHeavy(); - yield return null; - while (true) - { - bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1; - if(reachEnd) - { - ChangeState(EUnitState.Idle, new IdleParam()); - } - yield return null; - } - } - - void OnHitLightExit(EUnitState nextState) - { - } - - #endregion - - #region HitAir - - IEnumerator HitAir(HitAirParam param) - { - ((MonsterController)owner).FacePC(); - m_Owner.monsterAnimation.AnimHitAir(); - yield return null; - while (true) - { - bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1; - if (reachEnd) - { - //yield return new WaitForSeconds(1f); - ChangeState(EUnitState.Rise, new RiseParam()); - } - yield return null; - } - } - - void OnHitAirExit(EUnitState nextState) - { - }
-
- #endregion -
- #region HitInAir -
- IEnumerator HitInAir(HitInAirParam param) - { - ((MonsterController)owner).FaceToFacePC(); - m_Owner.monsterAnimation.AnimHitInAir(); - yield return null; - float vy = -1f; - float g = -15.8f; - while (true) - { - bool reachEnd = m_Owner.monsterAnimation.baseLayer.playbackNormalizedTime == 1; - if (reachEnd) - { - vy += g * Time.deltaTime; - Vector3 pos = owner.transform.position; - pos.y += vy * Time.deltaTime; - if(pos.y <= 0)
- {
- yield return new WaitForSeconds(0.5f);
- ChangeState(EUnitState.Rise, new RiseParam());
- } - owner.transform.position = pos; - } - yield return null; - } - } - - void OnHitInAirExit(EUnitState nextState) - { - }
-
- #endregion -
- #region Rise -
- IEnumerator Rise(RiseParam param) - { - m_Owner.monsterAnimation.AnimRise(); - yield return null; - while (true) - { - bool reachEnd = m_Owner.monsterAnimation.layers[0].playbackNormalizedTime == 1; - if (reachEnd) - { - ChangeState(EUnitState.Idle, new IdleParam()); - } - yield return null; - } - } - - void OnRiseExit(EUnitState nextState) - { - } - - - #endregion - - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta deleted file mode 100644 index 7d60499f..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/MonsterState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b7b1805198282374fbc67108671f8a72 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs deleted file mode 100644 index 6a326431..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 角色状态机 -[DisallowMultipleComponent] -public partial class PCState : UnitState -{ - public enum EUnitState - { - Nien, - - Idle, - Move, - Spawn, - Die, - Dead, - // - Attack, - AirAttack, - AttackToAir, - AirDash, - // - HitAir, - HitAirHit, - Knockdown, - // - HitGuard, - // - Walk, - // - Rise, - // - Jump, - // 转身 - Turn, - Landing, // 从空中降落 - } - - [SerializeField] private EUnitState m_State; - public EUnitState CurrentState { get { return m_State; } } - - private EUnitState m_PrevState; - - public override void Initialize() - { - base.Initialize(); - owner.onTimelineEvent += OnTimeLineEvent; - } - - public override void Release()
- {
- owner.onTimelineEvent -= OnTimeLineEvent;
- base.Release();
- } -
- PCAnimation pcAnimation { get { return m_Owner.pcAnimation; } } - - public void ChangeState<T>(EUnitState nextState, T param = default, bool bForce = false) - { - if (!IsChange(nextState, bForce)) - return; - - LogHelper.Log("UnitState: " + m_State.ToString() + " -> " + nextState.ToString()); - - StopAllCoroutines(); - - string methodFunc = "On" + m_State.ToString() + "Exit"; - MethodInfo exitMethod = GetType().GetMethod(methodFunc, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(EUnitState) }, null); - if (exitMethod != null) - { - exitMethod.Invoke(this, new object[] { nextState }); - } - else - { - LogHelper.LogError("缺少 " + methodFunc); - }
- m_PrevState = m_State; - m_State = nextState;
-
- if(m_PrevState != m_State && owner.unitRender != null)
- {
- // owner.unitRender.SetVisibilityInMainCamera(true);
- }
-
- StartCoroutine(m_State.ToString(), param); - } - - bool IsChange(EUnitState newState, bool bForce) - { - if (newState != m_State || bForce) - return true; - return false; - } - - public void TurnAround(bool bRight) - { - m_Owner.transform.rotation = Quaternion.Euler(0, bRight ? 0 : 180, 0); - } - - public void TurnLeft() - { - TurnAround(false); - } - - public void TurnRight() - { - TurnAround(true); - }
-
- void TryDash()
- {
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.A, KeyCode.A))
- {
- TurnLeft();
- ChangeState(EUnitState.AirDash, new AirDashParam(), true);
- }
- if (InputManager.Instance.TryCommand(0.5f, KeyCode.D, KeyCode.D))
- {
- TurnRight();
- ChangeState(EUnitState.AirDash, new AirDashParam(), true);
- } - } - - void TryTurnAround()
- {
- if (Input.GetKey("a"))
- {
- TurnLeft();
- }
- if (Input.GetKey("d"))
- {
- TurnRight();
- } - } - - bool TryTeleport()
- {
- if (Input.GetKeyDown("i"))
- {
- float offset = owner.isTowardRight ? 1.5f : -1.5f;
-
- Vector3 targetPos = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0);
- targetPos.y = Mathf.Max(1, targetPos.y);
-
- UnitSnapshotInfo info = owner.TakeSnapshot();
- Vector2 dir = targetPos - owner.center;
- owner.unitLensEffect.Dash(Color.white, 0.1f, Mathf.Rad2Deg * Mathf.Atan2(dir.y, dir.x), info);
-
- owner.center = targetPos;
- TurnAround(!owner.isTowardRight);
- return true;
- } - return false; - } - - bool TryBlink()
- {
- return false;
- }
-
- bool TryTianyin()
- {
- if (Input.GetKeyDown("o"))
- {
- float offset = owner.isTowardRight ? 1.2f : -1.2f;
- TestErika.Instance.monster.owner.center = owner.center + new Vector3(offset, 0.5f, 0);
- ((MonsterController)TestErika.Instance.monster.owner).monsterState.ChangeState(MonsterState.EUnitState.HitInAir, new MonsterState.HitInAirParam(), true);
- return true;
- } - return false; - }
-
- bool TryAttackToAir()
- {
- if(Input.GetKey("w") && Input.GetKeyDown("j"))
- {
- ChangeState(EUnitState.AttackToAir, new SkillParam());
- return true;
- }
- return false;
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta deleted file mode 100644 index 548a0a91..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a888cbca17562d4dbea1f28fd4dcbab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs deleted file mode 100644 index 73c65a0c..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class PCState : UnitState
-{
-
-
- void OnTimeLineEvent(AnimationEventBase animEvent)
- {
- if(animEvent is EventUnit_SetPosition)
- {
- EventUnit_SetPosition setPos = animEvent as EventUnit_SetPosition;
- Vector3 pos = owner.transform.position;
- if(setPos.setY)
- {
- pos.y = setPos.y;
- }
- owner.transform.position = pos;
- }
-
- }
-
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta deleted file mode 100644 index 7dc2d927..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState_Event.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 760f104e062ae884d809b7fc80b041b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs deleted file mode 100644 index 738cc7ce..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs +++ /dev/null @@ -1,390 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class PCState : UnitState
-{
-
- #region state param - public struct IdleParam { } - - public struct MoveParam - { - public bool isRight; - public string key; - } - - public struct SkillParam - { - public float offset;
- } - - public struct AirDashParam - { - - } - - public struct JumpParam - { } - - public struct TurnParam - { - EUnitState nextState; - } - - public struct LandingParam { }
-
- #endregion -
- IEnumerator Nein() { yield break; } - void OnNienExit(EUnitState nextState) { } -
- #region Idle -
- IEnumerator Idle(IdleParam param) - {
- m_Owner.pcAnimation.AnimIdle();
- yield return new WaitForTransitionDone(owner.unitAnimation);
- m_Owner.SetYPosition(0);
- while (true)
- {
- if(TryAttackToAir())
- {
- yield break;
- }
- if (Input.GetKeyDown("j"))
- {
- ChangeState(EUnitState.Attack, new SkillParam());
- yield break;
- }
- if (Input.GetKeyDown("space"))
- {
- ChangeState(EUnitState.Jump, new JumpParam());
- yield break;
- }
- if (Input.GetKey("d"))
- {
- MoveParam move = new MoveParam();
- move.isRight = true;
- move.key = "d";
- ChangeState(EUnitState.Move, move);
- yield break;
- }
- if (Input.GetKey("a"))
- {
- MoveParam move = new MoveParam();
- move.isRight = false;
- move.key = "a";
- ChangeState(EUnitState.Move, move);
- yield break;
- }
- yield return null;
- } - } - - void OnIdleExit(EUnitState nextState) - { - } - #endregion - - #region Move - IEnumerator Move(MoveParam param) - { - if (m_Owner.isTowardRight && !param.isRight - || !m_Owner.isTowardRight && param.isRight) - { - //m_Owner.pcAnimation.Play(UnitAnimation.EAnimState.Turn); - //yield return new WaitForActionReachEnd(m_Owner.pcAnimation); - //if (param.isRight) - // m_Owner.transform.rotation = Quaternion.Euler(0, 0, 0); - //else - // m_Owner.transform.rotation = Quaternion.Euler(0, 180, 0); - m_Owner.transform.rotation = Quaternion.Euler(0, param.isRight ? 0 : 180, 0); - } - //if (Input.GetKey(param.key)) - m_Owner.pcAnimation.AnimMove(); - while (Input.GetKey(param.key)) - {
- TryAttackToAir();
- yield return null; - } - ChangeState(EUnitState.Idle, new IdleParam()); - } - - void OnMoveExit(EUnitState nextState) - { - m_Owner.pcAnimation.animator.ResetTrigger("ToMove"); - }
-
- #endregion -
- #region Attack -
- IEnumerator Attack(SkillParam param)
- {
- const int total = 4;
- int id = 0;
- m_Owner.pcAnimation.AnimAttack(id++);
- yield return null;
- while (true)
- {
- if (isComboOpen)
- {
- //if (InputManager.Instance.TryCommand(0.5f, KeyCode.W, KeyCode.J))
- if (Input.GetKeyDown("u")) - {
- SkillParam skill = new SkillParam();
- skill.offset = 0.12f;
- ChangeState(EUnitState.AttackToAir, skill);
- }
- }
-
- if (isComboOpen && id < total)
- {
- if (Input.GetKeyDown("j"))
- {
- TryTurnAround(); -
- m_Owner.pcAnimation.AnimAttack(id++);
- yield return null;
- yield return new WaitForTransitionDone(m_Owner.pcAnimation);
- }
- }
-
- if (isAnimationReachEnd)
- {
- ChangeState(EUnitState.Idle, new IdleParam());
- }
-
- yield return null;
- }
- } - - void OnAttackExit(EUnitState next) - { - }
-
- #endregion -
- #region AttackToAir -
- IEnumerator AttackToAir(SkillParam param)
- {
- m_Owner.pcAnimation.AnimAttackToAir(param.offset);
- yield return null; - InputManager.Instance.ClearCommand(); - while (true)
- {
- TryTianyin();
-
- if (isComboOpen)
- {
- TryDash();
-
- if (InputManager.Instance.TryCommand(0.5f, false, KeyCode.J))
- {
- ChangeState(EUnitState.AirAttack, new SkillParam());
- }
- }
-
- if (isAnimationReachEnd || isAnimationReachEndPoint) - { - ChangeState(EUnitState.Landing, new LandingParam()); - }
- yield return null;
- }
- }
-
- void OnAttackToAirExit(EUnitState next)
- {
- }
-
- #endregion -
- #region AirAttack -
- IEnumerator AirAttack(SkillParam param) - { - int total = 5;
- int id = 0;
- m_Owner.pcAnimation.AnimAirAttack(id++); - yield return null; - InputManager.Instance.ClearCommand(); - while (true) - {
- if (TryTeleport())
- {
- }
-
- TryTianyin(); - - if (isComboOpen) - {
- TryDash(); - - if (InputManager.Instance.TryCommand(0.3f, false, KeyCode.J)) - { - TryTurnAround();
-
- m_Owner.pcAnimation.AnimAirAttack(id++);
- id %= total; - yield return null; // 等待animator更新 - yield return new WaitForTransitionDone(m_Owner.pcAnimation); - } - } - - if (isAnimationReachEnd) - { - ChangeState(EUnitState.Landing, new LandingParam()); - } - - yield return null; - } - } - - void OnAirAttackExit(EUnitState next) - { - - } - - #endregion - - #region AirDash - - IEnumerator AirDash(AirDashParam param) - { - m_Owner.pcAnimation.AnimAirDash(); - yield return null; - while (true) - { - if (isAnimationReachEnd) - { - ChangeState(EUnitState.Landing, new LandingParam()); - } - - TryTianyin(); - - if (isComboOpen) - { - TryDash(); - - if (Input.GetKeyDown("j")) - {
- TryTurnAround(); - ChangeState(EUnitState.AirAttack, new SkillParam()); - } - } - - yield return null; - } - } - - void OnAirDashExit(EUnitState next) - { - } - - #endregion - - #region Jump - - IEnumerator Jump(JumpParam param) - { - pcAnimation.AnimJump(); - yield return null; - yield return new WaitForTransitionDone(pcAnimation); - while (true) - { - if (InputManager.Instance.TryCommand(0.5f, KeyCode.A, KeyCode.A)) - { - TurnLeft(); - ChangeState(EUnitState.AirDash, new AirDashParam()); - } - if (InputManager.Instance.TryCommand(0.5f, KeyCode.D, KeyCode.D)) - { - TurnRight(); - ChangeState(EUnitState.AirDash, new AirDashParam()); - } - if (isAnimationReachEnd) - ChangeState(EUnitState.Landing, new LandingParam()); - bool canAttack = m_Owner.pcAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo); - if (Input.GetKeyDown("j") && canAttack) - { - ChangeState(EUnitState.AirAttack, new SkillParam()); - } - yield return null; - } - } - - void OnJumpExit(EUnitState next) - { - } - - #endregion - - #region Landing - - IEnumerator Landing(LandingParam param) - { - m_Owner.pcAnimation.AnimLanding(); - yield return null; - yield return new WaitForTransitionDone(m_Owner.pcAnimation); - float vy = 0; - float g = -9.8f; - bool landingGround = false; - float vx = 5; - while (true) - { - Vector3 pos = m_Owner.transform.position; - - if(!landingGround)
- {
- vy += g * Time.deltaTime;
- pos.y += vy * Time.deltaTime;
- pos.y = Mathf.Max(0, pos.y);
- } -
- TryDash(); - - TryTianyin(); - - if (Input.GetKey("a")) - { - TurnAround(false); - pos.x -= vx * Time.deltaTime; - } - if (Input.GetKey("d")) - { - TurnAround(true); - pos.x += vx * Time.deltaTime; - } - - if (Input.GetKeyDown("j"))
- {
- ChangeState(EUnitState.AirAttack, new SkillParam());
- } - - m_Owner.transform.position = pos; - - if (pos.y > 0 && pos.y <= 1 && !landingGround) - {
- landingGround = true; - m_Owner.pcAnimation.AnimLandingGround(); - } - if (pos.y <= 0) - { - pos.y = 0; - m_Owner.transform.position = pos; - ChangeState(EUnitState.Idle, new IdleParam()); - } - - yield return null; - } - } - - void OnLandingExit(EUnitState next) - { - }
-
- #endregion -
-}
diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta deleted file mode 100644 index e314f21e..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PCState_States.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bfcb25f32c442a5429ab4d0603b9df67 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/PropState.cs b/Assets/Scripts/Unit/Components/UnitState/PropState.cs deleted file mode 100644 index 86b95e38..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PropState.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PropState : 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/Components/UnitState/PropState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta deleted file mode 100644 index db5dd78f..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/PropState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 96148351ded87a247bbdf39d56eb592e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs b/Assets/Scripts/Unit/Components/UnitState/RobotState.cs deleted file mode 100644 index 68a11135..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RobotState : 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/Components/UnitState/RobotState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta deleted file mode 100644 index ef3ef469..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/RobotState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 12346a9b76519ab4098b11da90589040 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs b/Assets/Scripts/Unit/Components/UnitState/UnitState.cs deleted file mode 100644 index ff42c2be..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 角色状态机 -[DisallowMultipleComponent] -public class UnitState : UnitComponent -{ - - public virtual bool isAnimationReachEnd
- {
- get
- {
- return owner.unitAnimation.baseLayer.playbackNormalizedTime == 1;
- }
- } - - // 如果设置了endpoint属性,检查是否到了endpoint - public virtual bool isAnimationReachEndPoint
- {
- get
- {
- var layer = owner.unitAnimation.baseLayer;
- if (!layer.animationData.HasProperty(EAnimationProperty.Endpoint))
- return false;
- return layer.playbackNormalizedTime >= layer.animationData.GetProperty(EAnimationProperty.Endpoint);
- }
- } - - public virtual bool isComboOpen
- {
- get
- {
- return owner.unitAnimation.baseLayer.IsToggleOpen(EAnimationToogle.Combo);
- }
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta b/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta deleted file mode 100644 index 781994dc..00000000 --- a/Assets/Scripts/Unit/Components/UnitState/UnitState.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 54dfab62..00000000 --- a/Assets/Scripts/Unit/Controller.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e8ee977d4de170a439bd598f793d4989 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/MonsterController.cs b/Assets/Scripts/Unit/Controller/MonsterController.cs deleted file mode 100644 index 22645b47..00000000 --- a/Assets/Scripts/Unit/Controller/MonsterController.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class MonsterController : UnitController
-{
- public override UnitType type { get { return UnitType.Monster; } }
-
- protected override void Initialize()
- {
- base.Initialize();
-
- unitState = GetOrAddUnitComponent<MonsterState>();
- unitState.Initialize();
-
- unitAnimation = GetOrAddUnitComponent<MonsterAnimation>();
- unitAnimation.Initialize();
- }
-
- public override void Update()
- {
- base.Update();
- }
-
- public override void OnHit(CollisionInfo info)
- {
- }
-
- public override void OnGetHit(CollisionInfo info)
- {
- ColliderBox hitbox = info.collider.colliderInfo.collider;
- Debug.Assert(hitbox.type == ColliderBox.EColliderType.HitBox);
-
- if(hitbox.hitResponse == ColliderBox.EHitResponse.Light)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitLight, new MonsterState.HitLightParam(), true);
- }
- else if (hitbox.hitResponse == ColliderBox.EHitResponse.HitAir)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitAir, new MonsterState.HitAirParam());
- }
- else if (hitbox.hitResponse == ColliderBox.EHitResponse.HitInAir)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitInAir, new MonsterState.HitInAirParam(), true);
- }
-
- string path = hitbox.sparkPath;
- GameObject vfx = ResourceManager.Instance.LoadAsset<GameObject>(path);
- if(vfx != null)
- {
- GameObject go = GameObject.Instantiate(vfx);
- go.transform.position = center + hitbox.sparkOffset;
- go.transform.localScale = hitbox.sparkScale;
- }
- }
-
- public override void OnGetShot(CollisionInfo info)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitLight, new MonsterState.HitLightParam(), true);
- }
-
- public virtual bool IsFacePC()
- {
- PCController pc = PCController.instance;
- float pcX = pc.transform.position.x;
- float x = transform.position.x;
- bool isface = pcX > x && isTowardRight || pcX <= x && !isTowardRight;
- return isface;
- }
-
- // 朝向PC
- public virtual void FacePC()
- {
- if (IsFacePC())
- return;
- PCController pc = PCController.instance;
- float pcX = pc.transform.position.x;
- float x = transform.position.x;
- if (pcX > x)
- {
- transform.rotation = Quaternion.Euler(0, 0, 0); - }
- else
- {
- transform.rotation = Quaternion.Euler(0, 180, 0); - }
- }
-
- public virtual void FaceToFacePC()
- {
- PCController pc = PCController.instance;
- transform.rotation = Quaternion.Euler(0, 180, 0) * pc.transform.rotation;
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Controller/MonsterController.cs.meta b/Assets/Scripts/Unit/Controller/MonsterController.cs.meta deleted file mode 100644 index 4762487a..00000000 --- a/Assets/Scripts/Unit/Controller/MonsterController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba16c8e0e6cac0c43b8a80d13dafdda1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/PCController.cs b/Assets/Scripts/Unit/Controller/PCController.cs deleted file mode 100644 index 35645d57..00000000 --- a/Assets/Scripts/Unit/Controller/PCController.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 玩家角色控制器
-[DisallowMultipleComponent]
-public class PCController : UnitController
-{
- public static PCController instance;
-
- #region Unit的三种效果
- public UnitAfterImage unitAfterImage;
- public UnitImageEffect unitImageEffect;
- #endregion
-
- public override UnitType type { get { return UnitType.PC; } }
-
- private void Awake()
- {
- instance = this;
- }
-
- protected override void Initialize()
- {
- base.Initialize();
-
- unitState = GetOrAddUnitComponent<PCState>();
- unitState.Initialize();
-
- unitAnimation = GetOrAddUnitComponent<PCAnimation>();
- unitAnimation.Initialize();
-
- unitAfterImage = GetOrAddUnitComponent<UnitAfterImage>();
- unitAfterImage.Initialize();
-
- unitImageEffect = GetOrAddUnitComponent<UnitImageEffect>();
- unitImageEffect.Initialize();
- }
-
- public override void Update()
- {
- base.Update();
- unitAfterImage.OnUpdate();
- unitImageEffect.OnUpdate();
- }
-
- public override void OnHit(CollisionInfo info)
- {
- ColliderBox hitbox = info.collider.colliderInfo.collider;
- Debug.Assert(hitbox.type == ColliderBox.EColliderType.HitBox);
- }
-
- public override void OnGetHit(CollisionInfo info)
- {
- }
-
- public override void OnGrab()
- {
- }
-
- public override void OnPull()
- {
- }
-
-}
diff --git a/Assets/Scripts/Unit/Controller/PCController.cs.meta b/Assets/Scripts/Unit/Controller/PCController.cs.meta deleted file mode 100644 index d7ed1aa3..00000000 --- a/Assets/Scripts/Unit/Controller/PCController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d3cdc0aac9d88142b135a9aa3792000 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/PropController.cs b/Assets/Scripts/Unit/Controller/PropController.cs deleted file mode 100644 index 6449d49e..00000000 --- a/Assets/Scripts/Unit/Controller/PropController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PropController : 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/Controller/PropController.cs.meta b/Assets/Scripts/Unit/Controller/PropController.cs.meta deleted file mode 100644 index e5212ee7..00000000 --- a/Assets/Scripts/Unit/Controller/PropController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 67cc84cac8614a646a7e981178ec9939 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Controller/RobotController.cs b/Assets/Scripts/Unit/Controller/RobotController.cs deleted file mode 100644 index 7a10c968..00000000 --- a/Assets/Scripts/Unit/Controller/RobotController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RobotController : 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/Controller/RobotController.cs.meta b/Assets/Scripts/Unit/Controller/RobotController.cs.meta deleted file mode 100644 index d40dd55d..00000000 --- a/Assets/Scripts/Unit/Controller/RobotController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f594c33f502a71408a6d16e21274ca2 -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 deleted file mode 100644 index 06d5a840..00000000 --- a/Assets/Scripts/Unit/Controller/UnitController.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-//public interface Interactable
-//{
-// void OnHit();
-// void OnHurt();
-// void OnGrab();
-//}
-
-public class UnitController : MonoBehaviour/*, Interactable*/
-{
- public enum UnitType
- {
- PC,
- Monster,
- Prop,
- }
-
- public virtual UnitType type { get; }
-
- // 角色共有的组件
-
- public UnitRender unitRender;
-
- public UnitState unitState;
- public PCState pcState { get { return unitState as PCState; } }
- public MonsterState monsterState { get { return unitState as MonsterState; } }
-
- public UnitAnimation unitAnimation;
- public PCAnimation pcAnimation { get { return unitAnimation as PCAnimation; } }
- public MonsterAnimation monsterAnimation { get { return unitAnimation as MonsterAnimation; } }
-
- public UnitSkill unitSkill;
-
- public UnitRootMotion unitRootMotion;
-
- public UnitCollider unitCollider;
-
- public UnitDetail unitDetail;
-
- public UnitBody unitBody;
-
- public UnitLensEffect unitLensEffect;
-
- public UnitPreprocessing unitPreprocessing;
-
- public GameObject unitObj; // 角色模型
-
- protected List<UnitComponent> unitComponents;
-
- #region 事件监听
- public delegate void OnTimelineEventHandle(AnimationEventBase animEvent);
- public OnTimelineEventHandle onTimelineEvent { get; set; }
- #endregion
-
- public bool isTowardRight
- {
- get
- {
- return transform.rotation.eulerAngles.y == 0;
- }
- }
-
- public virtual bool isOnGround
- {
- get
- {
- return transform.position.y <= 0f;
- }
- }
-
- public bool isInAir
- {
- get
- {
- return !isOnGround;
- }
- }
-
- private string m_Folder;
- public string folder
- {
- get
- {
- return m_Folder;
- }
- }
-
- private bool m_Visible;
- public bool visible
- {
- get
- {
- return m_Visible;
- }
- }
-
- public TRS trs
- {
- get
- {
- TRS trs = new TRS();
- trs.position = position;
- trs.rotation = rotation;
- trs.scale = lossyScale;
- return trs;
- }
- }
-
- public virtual Vector3 center
- {
- get
- {
- return GetComponentInChildren<Renderer>().bounds.center;
- }
- set
- {
- Vector3 offset = new Vector3(0, -GetComponentInChildren<Renderer>().bounds.size.y / 2f, 0);
- transform.position = value + offset;
- }
- }
-
- public virtual Vector3 position
- {
- get
- {
- return transform.position;
- }
- set
- {
- transform.position = value;
- }
- }
-
- public virtual Quaternion rotation
- {
- get
- {
- return transform.rotation;
- }
- set
- {
- transform.rotation = value;
- }
- }
-
- public virtual Vector3 lossyScale
- {
- get
- {
- return transform.lossyScale;
- }
- }
-
- public virtual void Initialize( GameObject obj , string folder)
- {
- unitObj = obj;
- m_Folder = folder;
- unitComponents = new List<UnitComponent>();
-
- Initialize();
-
- OnPostInitailize();
- }
-
- protected virtual void Initialize()
- {
- unitSkill = GetOrAddUnitComponent<UnitSkill>();
- unitSkill.Initialize();
-
- unitRootMotion = GetOrAddUnitComponent<UnitRootMotion>();
- unitRootMotion.Initialize();
-
- unitCollider = GetOrAddUnitComponent<UnitCollider>();
- unitCollider.Initialize();
-
- unitBody = GetOrAddUnitComponent<UnitBody>();
- unitBody.Initialize();
-
- unitRender = GetOrAddUnitComponent<UnitRender>();
- unitRender.Initialize();
-
- unitLensEffect = GetOrAddUnitComponent<UnitLensEffect>();
- unitLensEffect.Initialize();
-
- unitDetail = gameObject.GetComponentInChildren<UnitDetail>();
-
- unitPreprocessing = GetOrAddUnitComponent<UnitPreprocessing>();
- unitPreprocessing.Initialize();
- }
-
- private void OnPostInitailize()
- {
- if (unitComponents == null)
- return;
- for(int i = 0; i < unitComponents.Count; ++i)
- {
- unitComponents[i].OnPostInitialize();
- }
- }
-
- protected T GetOrAddUnitComponent<T>() where T : UnitComponent
- {
- T comp = gameObject.GetOrAddComponent<T>();
- Debug.Assert(unitComponents != null);
- unitComponents.Add(comp);
- return comp;
- }
-
- public virtual void Update()
- {
- unitRender.OnUpdate();
- unitState.OnUpdate();
- unitAnimation.OnUpdate();
- unitSkill.OnUpdate();
- unitRootMotion.OnUpdate();
- unitLensEffect.OnUpdate();
- }
-
- public virtual void OnDestroy()
- {
- }
-
- public virtual void OnHit(CollisionInfo info)
- {
- }
-
- public virtual void OnGetHit(CollisionInfo info)
- {
- }
-
- public virtual void OnGetShot(CollisionInfo info)
- {
- }
-
-
- public virtual void OnGrab()
- {
- }
-
- public virtual void OnPull()
- {
- }
-
- public void SetYPosition(float y)
- {
- Vector3 pos = transform.position;
- pos.y = y;
- transform.position = pos;
- }
-
- public UnitSnapshotInfo TakeSnapshot()
- {
- UnitSnapshotInfo snapshot = new UnitSnapshotInfo();
- snapshot.trs = new TRS(unitObj.transform.position, unitObj.transform.rotation, unitObj.transform.lossyScale);
- snapshot.unit = this;
- snapshot.animStateHash = unitAnimation.baseLayer.stateHash;
- snapshot.normalizedTime = unitAnimation.baseLayer.playbackNormalizedTime;
- return snapshot;
- }
-
- public UnitSnapshotInfo TakeSnapshotClosestDashPose(bool forward = true)
- {
- UnitSnapshotInfo snapshot = new UnitSnapshotInfo();
- return snapshot;
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Controller/UnitController.cs.meta b/Assets/Scripts/Unit/Controller/UnitController.cs.meta deleted file mode 100644 index 326dd122..00000000 --- a/Assets/Scripts/Unit/Controller/UnitController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ea5af1ca0baa89e4fbbe5d87920fb748 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Editor.meta b/Assets/Scripts/Unit/Editor.meta deleted file mode 100644 index 45bf7867..00000000 --- a/Assets/Scripts/Unit/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 70a2febe367468c4ebf5c1b466b1a005 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs b/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs deleted file mode 100644 index 8dace739..00000000 --- a/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -[CustomPropertyDrawer(typeof(TriggerAnimationDictionary))] -public class TriggerAnimationDicDrawer : SerializableDictionaryPropertyDrawer { } diff --git a/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs.meta b/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs.meta deleted file mode 100644 index 1b2fcd94..00000000 --- a/Assets/Scripts/Unit/Editor/TriggerAnimationDicDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 548e21e5e705cc44597ccc005450a9e2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs deleted file mode 100644 index 07e3073e..00000000 --- a/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -[CustomPropertyDrawer(typeof(UnitBoneDictionary))] -public class UnitBoneDictionaryDrawer : SerializableDictionaryPropertyDrawer { } - - -[CustomPropertyDrawer(typeof(UnitReferencePointDictionary))] -public class UnitReferencePointDictionaryDrawer : SerializableDictionaryPropertyDrawer { } - diff --git a/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta b/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta deleted file mode 100644 index 4a92e024..00000000 --- a/Assets/Scripts/Unit/Editor/UnitDictionariesDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8850261fe4c29b442a0e3b613e07597e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Effect.meta b/Assets/Scripts/Unit/Effect.meta deleted file mode 100644 index 18369d64..00000000 --- a/Assets/Scripts/Unit/Effect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7ff5e16d7cc0410489258a170a2a539a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Effect/UnitCamera.cs b/Assets/Scripts/Unit/Effect/UnitCamera.cs deleted file mode 100644 index abb13a00..00000000 --- a/Assets/Scripts/Unit/Effect/UnitCamera.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// 专门用来渲染character的相机,用来做特效 -[RequireComponent(typeof(Camera))] -public class UnitCamera : SingletonMB<UnitCamera> -{ - PCController pc { get { return UnitManager.Instance.pc; } } - - Camera m_Camera; - - private void OnEnable() - { - m_Camera = GetComponent<Camera>(); - m_Camera.enabled = false; - }
-
- // 手动渲染
- public void Render()
- {
- m_Camera.Render();
- }
-
- // 这里要用OnPreCull,不能是OnPreRender,因为设置了可见性,OnPreRender是在可见性剔除之后
- void OnPreCull() - { - if (pc == null) - return; - if (pc.unitImageEffect == null || pc.unitImageEffect.effects.Count == 0) - return; - if (m_Camera == null) - return; - - Vector3 pos = transform.position; - transform.position = new Vector3(pc.center.x, pc.center.y, pos.z); - - float dz = Mathf.Abs(pos.z - pc.center.z); - float fov = 2 * Mathf.Atan2(pc.unitDetail.snapshotBound / 2, dz) * Mathf.Rad2Deg; - - m_Camera.fieldOfView = fov; - - // 开启unit的渲染 - pc.unitRender.SetVisibilityInAllCameras(true); - } - - void OnPostRender()
- {
- if (pc.unitImageEffect == null || pc.unitImageEffect.effects.Count == 0) - return; -
- pc.unitRender.SetVisibilityInAllCameras(false); - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Effect/UnitCamera.cs.meta b/Assets/Scripts/Unit/Effect/UnitCamera.cs.meta deleted file mode 100644 index e74544bd..00000000 --- a/Assets/Scripts/Unit/Effect/UnitCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c4798e37b95c98b4d9679542c6e14947 -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 deleted file mode 100644 index afb263d4..00000000 --- a/Assets/Scripts/Unit/Events.meta +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index d8d97892..00000000 --- a/Assets/Scripts/Unit/Events/AnimationEventBase.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public abstract class AnimationEventBase : ScriptableObject
-{
- public int startFrame;
-
- public abstract TimelineEventProxy.EEventType type { get; }
-
- public string fullName
- {
- get
- {
- return this.type.ToString();
- }
- }
-
- public string Name
- {
- get
- {
- string name = fullName.Replace("Event", "");
- //int underscore = name.IndexOf('_');
- //if (underscore != -1)
- //{
- // name = name.Substring(underscore + 1, name.Length - underscore - 1);
- //}
- return name;
- }
- }
-
- public abstract string shortName { get; }
-}
diff --git a/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta b/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta deleted file mode 100644 index 346639b7..00000000 --- a/Assets/Scripts/Unit/Events/AnimationEventBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index c76c19aa..00000000 --- a/Assets/Scripts/Unit/Events/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 1ca321c8..00000000 --- a/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs +++ /dev/null @@ -1,39 +0,0 @@ -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()
- {
- this.DrawDefaultInspector();
-
- //if (animData == null)
- // return;
- //EditorGUI.BeginChangeCheck();
-
- //GUILayout.Label("Animation File:");
- //GUILayout.TextField(animData.animationName);
-
- //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 deleted file mode 100644 index 2ec7d039..00000000 --- a/Assets/Scripts/Unit/Events/Editor/AnimationDataInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6f340a992a68e144cb133678df7b505d -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 deleted file mode 100644 index 204fa528..00000000 --- a/Assets/Scripts/Unit/Events/EventEffect.cs +++ /dev/null @@ -1,43 +0,0 @@ -using UnityEngine;
-
-public class EventEffect : AnimationEventBase
-{
- public enum EParentNode
- {
- Unit = 0,
- World,
- Bone,
- PresetBone,
- ReferencePoint,
- }
-
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventEffect; } }
- public override string shortName { get { return "E"; } }
-
- [Tooltip("Effect path")]
- public string effectPath;
-
- [Tooltip("Is attached to a bone")]
- public bool attached = true;
-
- [Tooltip("Parent node")]
- public EParentNode parentNode = EParentNode.Unit;
-
- [When("parentNode", EParentNode.Bone), Tooltip("Bone path attach to")]
- public string bonePath;
-
- [When("parentNode", EParentNode.PresetBone), Tooltip("Preset unit bone defined in unit details")]
- public EUnitBone bone;
-
- [When("parentNode", EParentNode.ReferencePoint), Tooltip("参考点")]
- public EUnitReferencePoint referencePoint;
-
- [Tooltip("Position offset")]
- public Vector3 position;
-
- [Tooltip("Rotation in euler")]
- public Vector3 rotation;
-
- [Tooltip("Scale")]
- public Vector3 scale = Vector3.one;
-}
diff --git a/Assets/Scripts/Unit/Events/EventEffect.cs.meta b/Assets/Scripts/Unit/Events/EventEffect.cs.meta deleted file mode 100644 index c88ceaa0..00000000 --- a/Assets/Scripts/Unit/Events/EventEffect.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9fe45d0826fb033448a877f1d49199d6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs b/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs deleted file mode 100644 index df393a6b..00000000 --- a/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventGame_TimeScale : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventGame_TimeScale; } }
- public override string shortName { get { return "T"; } }
-
- public AnimationCurve curve;
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs.meta b/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs.meta deleted file mode 100644 index 8b5d5745..00000000 --- a/Assets/Scripts/Unit/Events/EventGame_TimeScale.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 227b9bc615c7c8044be9c4547dee5fcf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs b/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs deleted file mode 100644 index 3eb161cb..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs +++ /dev/null @@ -1,65 +0,0 @@ -using UnityEngine;
-
-public class EventMesh_AfterImage : AnimationEventBase
-{
- public enum ESpawnRange // 生成残影的范围
- {
- Once = 0, // 只生成一个残影
- Duration = 1, // 给定一个时间范围内
- WaitForAfterImageStopEvent = 2, // 等待触发afterImageStopEvent
- Manual = 3, // 手动停止生成
- }
-
- public enum ESpawnPosition
- {
- InitPosition = 0, // 在触发事件的位置生成
- Follow = 1, // 跟随
- }
-
- public enum ESpawnMode
- {
- Count = 0, // 生成固定数量个,间隔平均
- Interval = 1, // 等时间间隔生成
- Curve = 2, // 曲线
- }
-
- public enum EEffect // 效果
- {
- Original = 0, // 原样
- RimLight = 1, // 边缘光
- FullColor = 2, // 全着色
- Ink = 3, // 墨水效果
- Distorsion = 4, // 扭曲
- Dissolve = 5, // 溶解
- }
-
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventMesh_AfterImage; } }
- public override string shortName { get { return "A"; } }
-
- [Comment("[ 残影生成 ]", TextAnchor.MiddleCenter)]
- public ESpawnRange spawnRange;
-
- [When("spawnRange", ESpawnRange.Duration), Tooltip("整个生成的持续时间(按时间,scaledTime)")]
- public float duration;
-
- public ESpawnPosition spawnPosition;
-
- public ESpawnMode spawnMode;
- [When("spawnMode", ESpawnMode.Count)]
- public int spawnCount;
- [When("spawnMode", ESpawnMode.Interval)]
- public float interval;
- [When("spawnMode", ESpawnMode.Curve)]
- public AnimationCurve spawnCurve;
-
- [Comment("[ 残影效果 ]", TextAnchor.MiddleCenter)]
- public EEffect effect;
-
- [ Tooltip("单个残影持续时间(按时间,scaledTime)")]
- public float lifetime;
-
- [When("effect", EEffect.RimLight)]
- [HDR] public Color rimColor;
-
- [HDR] public Color color;
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs.meta deleted file mode 100644 index 5e68ea59..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_AfterImage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cbd5a33b9ed7704439230ab5ba43cb86 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs b/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs deleted file mode 100644 index 29d1adde..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs +++ /dev/null @@ -1,19 +0,0 @@ -using UnityEngine;
-
-public class EventMesh_FadeIn : AnimationEventBase
-{
- public enum EFadeInMode
- {
- Linear = 0,
- Curve = 1,
- }
-
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventMesh_FadeIn; } }
- public override string shortName { get { return "I"; } }
-
- public EFadeInMode mode;
-
- [Tooltip("Duration in frame")]
- public float duration;
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs.meta deleted file mode 100644 index 5c943a7d..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_FadeIn.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 155962a945650e440806af7a4346f155 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs b/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs deleted file mode 100644 index 209810b2..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs +++ /dev/null @@ -1,8 +0,0 @@ -using UnityEngine;
-
-public class EventMesh_FadeOut : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventMesh_FadeOut; } }
- public override string shortName { get { return "O"; } }
-
-}
diff --git a/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs.meta deleted file mode 100644 index 7abb9b33..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_FadeOut.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ed55d0137f7de849918ade75357e60b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs b/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs deleted file mode 100644 index cb1a657c..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventMesh_ImageEffect_MotionBlur : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type => TimelineEventProxy.EEventType.EventMesh_ImageEffect_MotionBlur;
-
- public override string shortName => "M";
-
- public float lifeTime;
-
- public float angle;
-
- public float distance;
-
- [Tooltip("隐藏角色")]
- public bool hideUnitInMainCamera;
-
-}
diff --git a/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs.meta deleted file mode 100644 index e8e385f9..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_ImageEffect_MotionBlur.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a75401f0015aa1e4f856979c8aa1dae2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs b/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs deleted file mode 100644 index 0da254cc..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventMesh_LensEffect_Dash : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventMesh_LensEffect_Dash; } }
- public override string shortName { get { return "D"; } }
-
- public float lifeTime;
- public float angle;
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs.meta deleted file mode 100644 index 7be0b8bf..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_LensEffect_Dash.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d52092c3bed6f524ead14801bb72e1c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs b/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs deleted file mode 100644 index cf6e1bc8..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventMesh_VisibilityInMainCamera : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type => TimelineEventProxy.EEventType.EventMesh_VisibilityInMainCamera;
-
- public override string shortName => "V";
-
- public bool isVisible;
-
-}
diff --git a/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs.meta b/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs.meta deleted file mode 100644 index eb3e8bf8..00000000 --- a/Assets/Scripts/Unit/Events/EventMesh_VisibilityInMainCamera.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a4957372b8a4fd946b86016c20f83750 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventProjectile.cs b/Assets/Scripts/Unit/Events/EventProjectile.cs deleted file mode 100644 index 65bf4d29..00000000 --- a/Assets/Scripts/Unit/Events/EventProjectile.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventProjectile : AnimationEventBase
-{
- public enum EMoveType
- {
- Kinematic = 0,
- Curve, // 用一个固定曲线运动
- Procedural, // 程序控制
- }
-
- public override TimelineEventProxy.EEventType type { get { return TimelineEventProxy.EEventType.EventProjectile; } }
-
- public override string shortName { get { return "P"; } }
-
- [Tooltip("名字,可以用来识别这个projectile")]
- public string name;
-
- [Tooltip("标签,可以用来做一些标记,逗号分隔")]
- public string tag;
-
- [Tooltip("Projectile path")]
- public string projectilePath;
-
- [Tooltip("Is attached to a bone")]
- public bool attachedToBone;
-
- [If("attachedToBone"), Tooltip("Bone path attach to")]
- public string bone;
-
- [Tooltip("Position offset")]
- public Vector3 posOffset;
-
- [Tooltip("Rotation in euler")]
- public Vector3 rotation;
-
- [Tooltip("Scale")]
- public Vector3 scale = Vector3.one;
-
- public float lifeTime;
-
- [Comment("[ 运动方式 ]", TextAnchor.MiddleCenter)]
-
- public EMoveType moveType;
-
- [When("moveType", EMoveType.Kinematic), Tooltip("初始速度")]
- public Vector3 velocity;
- [When("moveType", EMoveType.Kinematic), Tooltip("加速度")]
- public Vector3 acceleration;
-
- [When("moveType", EMoveType.Curve), Tooltip("运动曲线")]
- public string curvePath;
- [When("moveType", EMoveType.Curve), Tooltip("运动速度")]
- public AnimationCurve speedCurve;
-
- [WhenNot("moveType", EMoveType.Procedural), Tooltip("forward朝向运动轨迹的方向")]
- public bool towardDirection;
-
- [Comment("[ 击中反馈 ]", TextAnchor.MiddleCenter)]
-
- public string sparkPath;
-
- [Tooltip("击中效果")]
- public ColliderBox.EHitResponse hitResponse;
-
-}
diff --git a/Assets/Scripts/Unit/Events/EventProjectile.cs.meta b/Assets/Scripts/Unit/Events/EventProjectile.cs.meta deleted file mode 100644 index 4afba321..00000000 --- a/Assets/Scripts/Unit/Events/EventProjectile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75c54c029c766614590737d26471b7a4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs b/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs deleted file mode 100644 index 2298492b..00000000 --- a/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class EventUnit_SetPosition : AnimationEventBase
-{
- public override TimelineEventProxy.EEventType type => TimelineEventProxy.EEventType.EventUnit_SetPosition;
-
- public override string shortName => "P";
-
- public bool setX;
- [If("setX")]
- public float x;
-
- public bool setY;
- [If("setY")]
- public float y;
-
- public bool setZ;
- [If("setZ")]
- public float z;
-
-}
diff --git a/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs.meta b/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs.meta deleted file mode 100644 index d7ccb476..00000000 --- a/Assets/Scripts/Unit/Events/EventUnit_SetPosition.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7b8952562a0fbae41a92bd6c1f897ca1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Helper.meta b/Assets/Scripts/Unit/Helper.meta deleted file mode 100644 index e6ded530..00000000 --- a/Assets/Scripts/Unit/Helper.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2608980741d3e0d49864f1a2e240bb77 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/Helper/DirectionCalculator.cs b/Assets/Scripts/Unit/Helper/DirectionCalculator.cs deleted file mode 100644 index 267fc86d..00000000 --- a/Assets/Scripts/Unit/Helper/DirectionCalculator.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class DirectionCalculator
-{
-
-
-}
-
-
diff --git a/Assets/Scripts/Unit/Helper/DirectionCalculator.cs.meta b/Assets/Scripts/Unit/Helper/DirectionCalculator.cs.meta deleted file mode 100644 index 61f34b48..00000000 --- a/Assets/Scripts/Unit/Helper/DirectionCalculator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2c264e119e0dde14ca91aefd61f02442 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect.meta b/Assets/Scripts/Unit/LensEffect.meta deleted file mode 100644 index ad9ac741..00000000 --- a/Assets/Scripts/Unit/LensEffect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3d1f1847b55e52a448151b0186678736 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs b/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs deleted file mode 100644 index 94e5f6a7..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Rendering;
-
-public class MaterialEntry
-{
- public string shader;
- public Material material;
-}
-
-// unit 镜头效果,和image effect的区别在于不光是后处理
-public abstract class LensEffectBase
-{
- public enum EStage
- {
- BeforeIterate, // 迭代之前
- Iterate, // 迭代renderer
- AfterIterate, // 迭代之后
- FinishRender, // 渲染角色之后(所有lens effect结束)
- }
-
- public abstract ERenderingEvent renderingEvents { get; }
-
- protected static Dictionary<string/*shaderName*/, List<MaterialEntry>> m_MaterailPool = new Dictionary<string, List<MaterialEntry>>();
-
- private List<MaterialEntry> m_InUseMaterials = new List<MaterialEntry>();
-
- #region upvalues
- public BodyPartRenderer curBodypartRenderer;
- public UnitController owner;
- #endregion
-
- private static MaterialEntry ClaimMaterial(string shader)
- {
- List<MaterialEntry> mats;
- if (m_MaterailPool.TryGetValue(shader, out mats) && mats.Count > 0)
- {
- MaterialEntry me = mats[mats.Count - 1];
- mats.RemoveAt(mats.Count - 1);
- return me;
- }
- Material mat = new Material(Shader.Find(shader));
- MaterialEntry entry = new MaterialEntry();
- entry.material = mat;
- entry.shader = shader;
- return entry;
- }
-
- private static void ReleaseMaterial(MaterialEntry entry)
- {
- List<MaterialEntry> mats;
- if (!m_MaterailPool.TryGetValue(entry.shader, out mats))
- {
- mats = new List<MaterialEntry>();
- m_MaterailPool.Add(entry.shader, mats);
- }
- mats.Add(entry);
- } - - protected MaterialEntry GetTempMaterial(string shader)
- {
- MaterialEntry entry = ClaimMaterial(shader);
- m_InUseMaterials.Add(entry);
- return entry;
- } - - protected void ReleaseAllInUsedMaterials()
- {
- for(int i = 0; i < m_InUseMaterials.Count; ++i)
- {
- ReleaseMaterial(m_InUseMaterials[i]);
- }
- m_InUseMaterials.Clear();
- } -
- public virtual void BeforeDepthTexture(EStage stage, CommandBuffer cb) { }
- public virtual void AfterDepthTexture(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeDepthNormalsTexture(EStage stage, CommandBuffer cb) { }
- public virtual void AfterDepthNormalsTexture(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeForwardOpaque(EStage stage, CommandBuffer cb) { }
- public virtual void AfterForwardOpaque(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeImageEffectsOpaque(EStage stage, CommandBuffer cb) { }
- public virtual void AfterImageEffectsOpaque(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeSkybox(EStage stage, CommandBuffer cb) { }
- public virtual void AfterSkybox(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeForwardAlpha(EStage stage, CommandBuffer cb) { }
- public virtual void AfterForwardAlpha(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeImageEffects(EStage stage, CommandBuffer cb) { }
- public virtual void AfterImageEffects(EStage stage, CommandBuffer cb) { }
-
- public virtual void BeforeEverything(EStage stage, CommandBuffer cb) { }
- public virtual void AfterEverything(EStage stage, CommandBuffer cb) { }
-
- public virtual bool CanDestroy() { return false; }
-
- public virtual void OnDestroy() { }
-
- // 角色渲染完毕
- public virtual void OnRenderFinish()
- {
- ReleaseAllInUsedMaterials();
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs.meta deleted file mode 100644 index d0d0d81b..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffectBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 548560041d20266478078df50edab4e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs deleted file mode 100644 index db0c1956..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Rendering;
-
-public class LensEffect_BlurRim : LensEffectBase
-{
- public override ERenderingEvent renderingEvents => ERenderingEvent.AfterForwardOpaque;
-
- Color rimColor;
- int tempID;
-
- public LensEffect_BlurRim(Color color) : base()
- {
- rimColor = color;
- tempID = Shader.PropertyToID("_BlurRim_RT0");
- }
-
- public override void AfterForwardOpaque(EStage stage, CommandBuffer cb)
- {
- if (stage == EStage.BeforeIterate)
- {
- Before(cb); - }
- else if (stage == EStage.Iterate)
- {
- Iterate(cb); - }
- else if (stage == EStage.AfterIterate)
- {
- After(cb); - }
- else if (stage == EStage.FinishRender)
- {
- }
- }
-
- void Before(CommandBuffer cb)
- {
- cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear);
- cb.SetRenderTarget(tempID);
- cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
- }
-
- void Iterate(CommandBuffer cb)
- {
- Matrix4x4 obj2Wod = Matrix4x4.identity;
- int subMeshCount = 0;
- if (curBodypartRenderer.renderer is SkinnedMeshRenderer)
- {
- SkinnedMeshRenderer smr = curBodypartRenderer.renderer as SkinnedMeshRenderer;
- Vector3 pos = smr.rootBone.transform.position;
- Quaternion rot = smr.rootBone.transform.rotation;
- obj2Wod = MatrixUtility.RotateAndTranslate(pos, rot);
- obj2Wod = Matrix4x4.Translate(new Vector3(1, 0, 0)) * obj2Wod;
- subMeshCount = smr.sharedMesh.subMeshCount;
- }
- else if (curBodypartRenderer.renderer is MeshRenderer)
- {
- obj2Wod = curBodypartRenderer.renderer.transform.localToWorldMatrix;
- obj2Wod = Matrix4x4.Translate(new Vector3(1, 0, 0)) * obj2Wod;
- subMeshCount = curBodypartRenderer.renderer.GetComponent<MeshFilter>().sharedMesh.subMeshCount;
- }
-
- for (int i = 0; i < subMeshCount; ++i)
- {
- MaterialEntry mat = GetTempMaterial(StaticDefine.shaders[EShader.SolidColor].name);
- mat.material.SetColor("_Color", rimColor);
- mat.material.SetMatrix("_ObjectToWorld", obj2Wod);
- mat.material.SetTexture("_MainTex", curBodypartRenderer.renderer.sharedMaterial.GetTexture("_MainTex"));
- cb.DrawRenderer(curBodypartRenderer.renderer, mat.material, i);
- }
- }
-
- void After(CommandBuffer cb)
- {
- MaterialEntry blur = GetTempMaterial(StaticDefine.shaders[EShader.Blur].name);
-
- Vector4 tileOffset = RenderingUtility.GetTillingOffset(MainCamera.Instance.camera, owner.center, owner.unitDetail.snapshotBound);
- blur.material.SetVector("_UnitTileOffset", tileOffset);
-
- cb.Blit(tempID, BuiltinRenderTextureType.CameraTarget, blur.material);
- cb.ReleaseTemporaryRT(tempID);
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs.meta deleted file mode 100644 index 3a2e02ef..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_BlurRim.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f49dbf9002764be4aa6ca79b78052d7a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs deleted file mode 100644 index 252efc6e..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -// 蜂鸣 -public class LensEffect_Buzz : LensEffectBase -{ - public override ERenderingEvent renderingEvents => ERenderingEvent.AfterForwardAlpha; - - public LensEffect_Buzz() : base() - { - - } - - public override void AfterForwardAlpha(EStage stage, CommandBuffer cb) - { - if (stage == EStage.BeforeIterate) - { - Before(cb); - } - else if (stage == EStage.AfterIterate) - { - After(cb); - } - } - - void Before(CommandBuffer cb) - { - MaterialEntry buzz = GetTempMaterial(StaticDefine.shaders[EShader.Buzz].name); - - cb.SetGlobalTexture("_UnitDepthTexture", owner.unitPreprocessing.unitDepthTexture); - cb.Blit(BuiltinRenderTextureType.CameraTarget, BuiltinRenderTextureType.CameraTarget, buzz.material); - } - - void After(CommandBuffer cb) - { - - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs.meta deleted file mode 100644 index 24b527a2..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d76bd4e3298fc574e9f90efa626f6e17 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs deleted file mode 100644 index d5d368d0..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Rendering; - -public class LensEffect_Dash : LensEffectBase -{ - public override ERenderingEvent renderingEvents => ERenderingEvent.AfterForwardOpaque; - - Color rimColor; - int tempID; - float lifeTime;
- UnitSnapshot snapshot;
- TRS trs;
- float angle;
-
- float curTime = 0;
-
- public LensEffect_Dash(Color color, float lifeTime, float angle, UnitSnapshotInfo snapshot) : base() - { - rimColor = color; - tempID = Shader.PropertyToID("RT_Dash"); - this.lifeTime = lifeTime;
- trs = snapshot.trs;
- this.snapshot = UnitManager.Instance.ClaimSnapshotSolo(snapshot);
- this.angle = angle;
- } - - public override void AfterForwardOpaque(EStage stage, CommandBuffer cb) - { - if (stage == EStage.BeforeIterate) - { - Before(cb); - } - else if (stage == EStage.AfterIterate) - { - After(cb); - } - else if (stage == EStage.FinishRender) - { - } - } - - void Before(CommandBuffer cb) - {
- cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear); - cb.SetRenderTarget(tempID); - cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
-
- // renderer
- snapshot.transform.position = trs.position;
- snapshot.transform.rotation = trs.rotation;
- snapshot.transform.localScale = trs.scale;
-
- Matrix4x4 obj2Wod = Matrix4x4.identity;
- SkinnedMeshRenderer smr = snapshot.renderers[0] as SkinnedMeshRenderer;
- Vector3 pos = smr.rootBone.transform.position;
- Quaternion rot = smr.rootBone.transform.rotation;
- obj2Wod = MatrixUtility.RotateAndTranslate(pos, rot);
-
- MaterialEntry mat = GetTempMaterial(StaticDefine.shaders[EShader.SolidColor].name);
- mat.material.SetColor("_Color", rimColor);
- mat.material.SetMatrix("_ObjectToWorld", obj2Wod);
- mat.material.SetTexture("_MainTex", snapshot.renderers[0].sharedMaterial.GetTexture("_MainTex"));
-
- cb.DrawRenderer(snapshot.renderers[0], mat.material);
- } - - void After(CommandBuffer cb) - {
- curTime += Time.deltaTime;
-
- MaterialEntry blur = GetTempMaterial(StaticDefine.shaders[EShader.MotionBlur].name); - - Vector4 tileOffset = RenderingUtility.GetTillingOffset(MainCamera.Instance.camera, trs.position, 6);
- blur.material.SetVector("_UnitTileOffset", tileOffset);
- blur.material.SetFloat("_Angle", angle);
- blur.material.SetFloat("_AlphaMultiplier", Mathf.Clamp(1 - curTime / lifeTime, 0, 1));
-
- cb.Blit(tempID, BuiltinRenderTextureType.CameraTarget, blur.material); - cb.ReleaseTemporaryRT(tempID); - }
-
- public override bool CanDestroy()
- {
- return curTime > lifeTime;
- }
-
- public override void OnDestroy()
- {
- UnitManager.Instance.ReleaseSnapshot(ref snapshot);
- }
- -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs.meta deleted file mode 100644 index f0c4f6ab..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3fac41ebc7706eb4abec04ae44602464 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Glitch.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Glitch.cs deleted file mode 100644 index 00763a37..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Glitch.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class LensEffect_Glitch : 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/LensEffect/LensEffect_Glitch.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffect_Glitch.cs.meta deleted file mode 100644 index 88e5b0de..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Glitch.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 48bd0d7bffad03a44a281ccb6f21f188 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs deleted file mode 100644 index 371186d0..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Rendering;
-
-public class LensEffect_MotionBlur : LensEffectBase
-{
- int tempID;
-
- public LensEffect_MotionBlur()
- {
- }
-
- public override ERenderingEvent renderingEvents => ERenderingEvent.AfterImageEffectsOpaque;
-
- public override void AfterImageEffectsOpaque(EStage stage, CommandBuffer cb)
- {
- if (stage == EStage.BeforeIterate)
- {
- tempID = Shader.PropertyToID("_Temp1");
-
- cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear);
- cb.SetRenderTarget(tempID);
- cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); - }
- else if(stage == EStage.Iterate)
- {
- Matrix4x4 obj2Wod = Matrix4x4.identity;
- int subMeshCount = 0;
- if (curBodypartRenderer.renderer is SkinnedMeshRenderer)
- {
- SkinnedMeshRenderer smr = curBodypartRenderer.renderer as SkinnedMeshRenderer;
- Vector3 pos = smr.rootBone.transform.position;
- Quaternion rot = smr.rootBone.transform.rotation;
- obj2Wod = MatrixUtility.RotateAndTranslate(pos, rot);
- subMeshCount = smr.sharedMesh.subMeshCount;
- }
- else if (curBodypartRenderer.renderer is MeshRenderer)
- {
- obj2Wod = curBodypartRenderer.renderer.transform.localToWorldMatrix;
- subMeshCount = curBodypartRenderer.renderer.GetComponent<MeshFilter>().sharedMesh.subMeshCount;
- }
-
- for (int i = 0; i < subMeshCount; ++i)
- {
- MaterialEntry mat = GetTempMaterial(StaticDefine.shaders[EShader.SolidColor].name);
- mat.material.SetColor("_Color", Color.red);
- mat.material.SetMatrix("_ObjectToWorld", obj2Wod);
-
- cb.DrawRenderer(curBodypartRenderer.renderer, mat.material, i);
- } - }
- else if(stage == EStage.AfterIterate)
- {
- MaterialEntry blur = GetTempMaterial(StaticDefine.shaders[EShader.Blur].name);
-
- Vector4 tileOffset = RenderingUtility.GetTillingOffset(MainCamera.Instance.camera, owner.center, owner.unitDetail.snapshotBound);
- blur.material.SetVector("_UnitTileOffset", tileOffset);
-
- cb.Blit(tempID, BuiltinRenderTextureType.CameraTarget, blur.material);
- tempID = Shader.PropertyToID("_Temp1");
- cb.ReleaseTemporaryRT(tempID); - }
- else if(stage == EStage.FinishRender)
- {
- }
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs.meta b/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs.meta deleted file mode 100644 index 364e3d30..00000000 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_MotionBlur.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 499c4e25bc0f4d641b99f688e91c495f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/LensEffect/RendererProxy.cs b/Assets/Scripts/Unit/LensEffect/RendererProxy.cs deleted file mode 100644 index 17d8d611..00000000 --- a/Assets/Scripts/Unit/LensEffect/RendererProxy.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[RequireComponent(typeof(Renderer))] -public class RendererProxy : MonoBehaviour -{ - public delegate void OnWillRenderObjectHandler(BodyPartRenderer renderer); - public OnWillRenderObjectHandler onWillRenderObject; - - public delegate void OnRenderObjectHandler(BodyPartRenderer renderer); - public OnRenderObjectHandler onRenderObject; - - BodyPartRenderer bodyPartRenderer; - - public void Initialize(BodyPartRenderer renderer) - { - bodyPartRenderer = renderer; - } - - void OnWillRenderObject() - { - if(onWillRenderObject != null) - onWillRenderObject(bodyPartRenderer); - } - - void OnRenderObject() - { - if(onRenderObject != null) - onRenderObject(bodyPartRenderer); - } - -} diff --git a/Assets/Scripts/Unit/LensEffect/RendererProxy.cs.meta b/Assets/Scripts/Unit/LensEffect/RendererProxy.cs.meta deleted file mode 100644 index 5f8c904e..00000000 --- a/Assets/Scripts/Unit/LensEffect/RendererProxy.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 81836ced17364c94d8130f6eeb2bf115 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/RootMotionProxy.cs b/Assets/Scripts/Unit/RootMotionProxy.cs deleted file mode 100644 index 96bba7ca..00000000 --- a/Assets/Scripts/Unit/RootMotionProxy.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RootMotionProxy : MonoBehaviour -{ - - private void OnAnimatorMove() - { - } - -} diff --git a/Assets/Scripts/Unit/RootMotionProxy.cs.meta b/Assets/Scripts/Unit/RootMotionProxy.cs.meta deleted file mode 100644 index 159e22b9..00000000 --- a/Assets/Scripts/Unit/RootMotionProxy.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a446cc0f3964e6248b0411882c74ceab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs b/Assets/Scripts/Unit/TimelineEventProxy.cs deleted file mode 100644 index 437b5b2d..00000000 --- a/Assets/Scripts/Unit/TimelineEventProxy.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Collections; -using System.Reflection; -using System.Collections.Generic; -using UnityEngine; - -// 执行帧事件 -[DisallowMultipleComponent] -public partial class TimelineEventProxy -{
-
-#if UNITY_EDITOR // ActionTool里 - private static GameObject m_Root_Particles; - public static GameObject Root_Particles
- {
- get
- {
- if (m_Root_Particles == null)
- {
- m_Root_Particles = GameObject.Find("Root_Particles");
- if(m_Root_Particles == null)
- m_Root_Particles = new GameObject("Root_Particles");
- }
- return m_Root_Particles;
- }
- }
- private static GameObject m_Root_Projectiles; - public static GameObject Root_Projectiles
- {
- get
- {
- m_Root_Projectiles = GameObject.Find("Root_Projectiles");
- if (m_Root_Projectiles == null)
- m_Root_Projectiles = new GameObject("Root_Projectiles");
- return m_Root_Projectiles;
- }
- } - - public bool isInEditMode;
-
- public delegate void RegisterProjectileHandle(Projectile projectile);
- public RegisterProjectileHandle registerProjectile;
-
- public delegate void RegisterParticleSystemHandle(FxClear vfx);
- public RegisterParticleSystemHandle registerParticleSystem;
-#endif -
- // 不要序列化枚举值,因为可能会随时更改
- public enum EEventType - {
- EventGame_TimeScale, // 缩放时间
-
- EventMesh_ImageEffect_MotionBlur, // 运动模糊 - EventMesh_ImageEffect_Glitch, // glitch
-
- EventMesh_LensEffect_Bloom, // bloom
- EventMesh_LensEffect_MotionBlur, // motionBlur
- EventMesh_LensEffect_Dash, // dash
-
- EventMesh_PostEffect_Curly, //
-
- EventMesh_AfterImage, // 角色残像
- EventMesh_AfterImageStop, // 角色残像停止事件
- EventMesh_FadeIn, // 角色透明度
- EventMesh_FadeOut, // 角色透明度 - EventMesh_Gloss, // 角色泛光
- EventMesh_VisibilityInMainCamera, // 是否在主相机渲染 - - EventUnit_SetPosition, // 设置位置
- EventUnit_BulletTime, // 子弹时间 -
- EventCamera_Zoom, // 相机聚焦 - EventCamera_Shake, // 相机晃动 - EventCamera_Blur, // 相机模糊 - EventCamera_WhiteOut, // 相机白屏 -
- EventEnv_Dark, - EventEnv_Exposure, - - EventUI_Drift, // - EventUI_Blur, // - - EventProjectile, // 发射体 - EventEffect, // 特效 - EventSound, // 音效 - } - - public const int FPS = 30; // timeline 每秒采样30次 - - private int m_PrevFrame = -1; - - private Transform m_Root; - - private Transform m_UnitModel; // 模型的Unit prefab,默认是m_Root的第一个子节点 - - public UnitController owner { get; private set; }
- - private UnitAnimation m_UnitAnimation { get { return owner.unitAnimation; } } - - private AnimationData m_PrevAnimationData;
-
- public TimelineEventProxy( UnitController owner) - {
- this.owner = owner;
- m_Root = owner.transform; - m_PrevAnimationData = null; - m_UnitModel = m_Root.GetChild(0); - } - - public TimelineEventProxy(Transform root)
- {
- m_Root = root;
- m_PrevAnimationData = null; - m_UnitModel = m_Root.GetChild(0); - } - - public static Type GetTypeByName(string name) - { - Type type = Type.GetType(name); - return type; - } - - public void ResetPrevAnimationData()
- {
- m_PrevAnimationData = null;
- } - - public void ExecuteAnimationEvents(AnimationData animData, float animFrame) - { - if (animData == null) - return;
-
- int frame = (int)animFrame; - if (m_PrevAnimationData != animData)
- {
- m_PrevFrame = frame;
- m_PrevAnimationData = animData; - }
- if (frame != m_PrevFrame) - { - for (int i = m_PrevFrame + 1; i <= frame; i++) - { - List<int> framesHasEvent = animData.GetAnimationEventFrameIndices(); - if (framesHasEvent.Contains(i)) - { - List<AnimationEventBase> events = animData.GetAnimationEventsAtFrame(i); - ExecuteEvents(events); - ListPool<AnimationEventBase>.Release(events); - } - ListPool<int>.Release(framesHasEvent); - } - } - m_PrevFrame = frame; - }
-
- void ExecuteEvents(List<AnimationEventBase> events)
- {
- if (events == null || events.Count == 0)
- return;
- foreach (var e in events)
- {
- string name = e.type.ToString();
- MethodInfo method = GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(AnimationEventBase) }, null);
- if (method != null)
- {
- object[] param = new object[] { e };
- method.Invoke(this, param);
-
- if(owner != null)
- owner.onTimelineEvent(e);
- }
- }
- }
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/TimelineEventProxy.cs.meta b/Assets/Scripts/Unit/TimelineEventProxy.cs.meta deleted file mode 100644 index c311d274..00000000 --- a/Assets/Scripts/Unit/TimelineEventProxy.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 893827f42c99cd849987e51e6af8820d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs b/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs deleted file mode 100644 index cc352324..00000000 --- a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs +++ /dev/null @@ -1,203 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// Timeline Event Handlers -public partial class TimelineEventProxy -{ - - void EventEffect(AnimationEventBase animEvent) - { - EventEffect effect = animEvent as EventEffect; - if (effect == null) - return; - string path = effect.effectPath; - if (path == null || path == "") - return; - GameObject prefab = ResourceManager.Instance.LoadAsset<GameObject>(path); - if (prefab != null) - { - GameObject root = new GameObject(); - - GameObject go = GameObject.Instantiate(prefab); - go.transform.SetParent(root.transform); - FxClear onClear = root.AddComponent<FxClear>(); - onClear.gameObject.name = prefab.name + "(Clone)"; - - PlayEffectInfo info = new PlayEffectInfo(); - info.path = path; - info.playEffectType = EffectPlayTypes.Oneshot; - info.posOffset = effect.position; - info.rot = effect.rotation; - info.scale = effect.scale; - info.bAttached = effect.attached; - if (effect.attached) - { - if (effect.parentNode == global::EventEffect.EParentNode.Unit) - { - info.rootTr = m_Root; - } - else if(effect.parentNode == global::EventEffect.EParentNode.World)
- {
- info.rootTr = null;
- } - else if (effect.parentNode == global::EventEffect.EParentNode.Bone) - { - if (m_UnitModel != null) - { - info.rootTr = m_UnitModel.Find(effect.bonePath); - } - } - else if(effect.parentNode == global::EventEffect.EParentNode.PresetBone) - { - if(m_UnitModel != null) - { - UnitDetail detail = m_UnitModel.GetComponent<UnitDetail>(); - if(detail) - { - info.rootTr = detail.GetBone(effect.bone); - } - } - } - else if(effect.parentNode == global::EventEffect.EParentNode.ReferencePoint)
- {
- } - } - - onClear.Initialize(info); -#if UNITY_EDITOR - if (isInEditMode && registerParticleSystem != null) - { - registerParticleSystem(onClear); - } - onClear.gameObject.transform.SetParent(Root_Particles.transform); -#endif - } - } - - void EventCamera_Shake(AnimationEventBase animEvent) - { - - } - - void EventProjectile(AnimationEventBase animEvent) - { - EventProjectile e = animEvent as EventProjectile; - if (e == null) - return; - string projectilePath = e.projectilePath; - if (projectilePath == null || projectilePath == "") - return; - GameObject prefab = ResourceManager.Instance.LoadAsset<GameObject>(projectilePath); - if (prefab == null) - { - LogHelper.LogError("缺少对应的projectile, " + projectilePath); - return; - } - if (prefab.GetComponent<Projectile>() == null) - { - LogHelper.LogError("没有projectile脚本"); - return; - } - GameObject obj = GameObject.Instantiate(prefab); - Projectile projectile = obj.GetComponent<Projectile>(); - ProjectileInfo info = new ProjectileInfo(); - info.name = e.name; - info.tag = e.tag; - info.moveType = e.moveType; - info.owner = owner; - info.position = m_Root.transform.position + e.posOffset; - info.rotation = e.rotation; - info.scale = e.scale; - if (owner) - { - info.velocity = owner.transform.rotation * e.velocity; - } - else - { - info.velocity = e.velocity; - } - info.acceleration = e.acceleration; - info.lifetime = e.lifeTime; - info.sparkPath = e.sparkPath; - projectile.Initialize(info); - -#if UNITY_EDITOR - if (isInEditMode && registerProjectile != null) - { - registerProjectile(projectile); - } - obj.transform.SetParent(Root_Projectiles.transform); -#endif - } - - void EventMesh_AfterImage(AnimationEventBase animEvent) - { -#if UNITY_EDITOR - if (isInEditMode) - return; -#endif - EventMesh_AfterImage afterImage = animEvent as EventMesh_AfterImage; - if (afterImage == null) - return; - string avatarPath = owner.unitDetail.afterImageAvatarPath; - GameObject go = ResourceManager.Instance.LoadAsset<GameObject>(avatarPath); - if (go) - { - GameObject instance = GameObject.Instantiate(go); - AfterImageAvatar avatar = instance.GetOrAddComponent<AfterImageAvatar>(); - if (!avatar) - { - GameObject.DestroyImmediate(instance); - return; - } - avatar.Initialize(owner); - } - } - - void EventUnit_SetPosition(AnimationEventBase animEvent) - { - // 在unitState回调里处理 - } - - void EventMesh_VisibilityInMainCamera(AnimationEventBase animEvent)
- {
- EventMesh_VisibilityInMainCamera visible = animEvent as EventMesh_VisibilityInMainCamera;
- if (visible == null)
- return;
- if (owner == null || owner.unitRender == null)
- return;
- owner.unitRender.SetVisibilityInMainCamera(visible.isVisible);
- }
-
- #region Unit Image Effects - void EventMesh_ImageEffect_MotionBlur(AnimationEventBase animEvent)
- {
- EventMesh_ImageEffect_MotionBlur motionBlur = animEvent as EventMesh_ImageEffect_MotionBlur;
- if (motionBlur == null)
- return ;
- if (owner == null || !(owner is PCController))
- return;
- float angle = motionBlur.angle;
- angle = owner.isTowardRight ? angle : 180 - angle;
- // ((PCController)owner).unitImageEffect.ShowMotionBlur(motionBlur.lifeTime, angle, motionBlur.distance);
- ((PCController)owner).unitImageEffect.ShowGlitch(motionBlur.lifeTime);
- }
-
- #endregion -
- #region Lens Effect
-
- void EventMesh_LensEffect_Dash(AnimationEventBase animEvent)
- {
- EventMesh_LensEffect_Dash dashinfo = animEvent as EventMesh_LensEffect_Dash;
- if (dashinfo == null)
- return;
-
- UnitSnapshotInfo info = owner.TakeSnapshot();
- owner.unitLensEffect.Dash(Color.white, dashinfo.lifeTime, dashinfo.angle, info);
- }
-
- #endregion
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs.meta b/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs.meta deleted file mode 100644 index 8ac28875..00000000 --- a/Assets/Scripts/Unit/TimelineEventProxy_Handlers.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e3ae1078c8bcc2f4299aaa231266363e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitActionData.cs b/Assets/Scripts/Unit/UnitActionData.cs deleted file mode 100644 index 8a06a249..00000000 --- a/Assets/Scripts/Unit/UnitActionData.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[Serializable] -public class TriggerAnimationDictionary : SerializableDictionary<string/*override clip name\state name*/, AnimationClip> { } - -// 配置角色的动画 -[CreateAssetMenu(fileName = "Unit Action Data")] -public class UnitActionData : ScriptableObject -{ - public TriggerAnimationDictionary actions; - - -} diff --git a/Assets/Scripts/Unit/UnitActionData.cs.meta b/Assets/Scripts/Unit/UnitActionData.cs.meta deleted file mode 100644 index ed3d6b70..00000000 --- a/Assets/Scripts/Unit/UnitActionData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 34c4f0be042b58840bbd5f39068e5007 -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 deleted file mode 100644 index 81921d2f..00000000 --- a/Assets/Scripts/Unit/UnitData.cs +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index fdd22280..00000000 --- a/Assets/Scripts/Unit/UnitData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3517d9ffab3b50f4d97c6a1db74fff11 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitDetail.cs b/Assets/Scripts/Unit/UnitDetail.cs deleted file mode 100644 index c57b87b5..00000000 --- a/Assets/Scripts/Unit/UnitDetail.cs +++ /dev/null @@ -1,218 +0,0 @@ -using System; -using UnityEngine.Serialization; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public enum EUnitBone -{ - Hips = 0, // 盆骨 - Spine , // 脊柱 - Chest , // 胸腔 - UpperChest , // - Neck , - Head , - LEye , - REye , - Jaw , - - LShoulder = 20, - LUpperArm, - LLowerArm, - LHand, - LFinger00, - LFinger01, - LFinger02, - LFinger10, - LFinger11, - LFinger12, - LFinger20, - LFinger21, - LFinger22, - LFinger30, - LFinger31, - LFinger32, - LFinger40, - LFinger41, - LFinger42, - - RShoulder = 40, - RUpperArm, - RLowerArm, - RHand, - RFinger00, - RFinger01, - RFinger02, - RFinger10, - RFinger11, - RFinger12, - RFinger20, - RFinger21, - RFinger22, - RFinger30, - RFinger31, - RFinger32, - RFinger40, - RFinger41, - RFinger42, - - LUpperLeg = 60, // 大腿 - LLowerLeg, // 小腿肚 - LFoot, // 左脚 - LToes, // 脚趾 - //LToe0, // 脚趾0 - //LToe1, // 脚趾1 - //LToe2, // 脚趾2 - //LToe3, // 脚趾3 - //LToe4, // 脚趾4 - - RUpperLeg = 80, // 大腿 - RLowerLeg, // 小腿肚 - RFoot, // 左脚 - RToes, // 脚趾 - //RToe0, // 脚趾0 - //RToe1, // 脚趾1 - //RToe2, // 脚趾2 - //RToe3, // 脚趾3 - //RToe4, // 脚趾4 - -} - -[Serializable] -public class UnitBoneDictionary : SerializableDictionary<EUnitBone, Transform> { } - -public enum EUnitReferencePoint
-{
- None = 0,
-
- Gunpoint = 1, // 枪口
- Gunpoint2, // 枪口
-
- SwordTop = 20, // 剑尖端
- SwordBottom, // 剑底端
-
- HitpointHead = 40,
- HitpointHeadFront,
- HitpointHeadBack,
- HitpointNeck,
- HitpointUpperBody,
- HitpointUpperBodyFront,
- HitpointUpperBodyBack,
- HitpointLowerBody,
- HitpointLowerBodyFront,
- HitpointLowerBodyBack,
-
- GrabpointChest = 60, // 被抓取的时候的挂点
- GrabpointHead,
- GrabpointLeg,
-
-} - -[Serializable] -public class UnitReferencePointDictionary : SerializableDictionary<EUnitReferencePoint, Transform> { } - -public enum EBodyPart
-{
- Body = 0, // main body
- Sword = 1,
-} - -[Serializable] -public class BodyPartRenderer
-{
- [SerializeField] public EBodyPart tag;
- [SerializeField] public Renderer renderer;
-} - -public interface IBodyRendererAgent
-{
- BodyPartRenderer mainRenderer { get; }
- BodyPartRenderer[] renderers { get; }
-} - -public interface IBodyJointAgent
-{
- UnitBoneDictionary bones { get; }
- UnitReferencePointDictionary referencePoints { get; }
-} - -// 角色的prefab附加数据 -// * afterimage的prefab -// * 骨骼映射 -// * 武器 -[DisallowMultipleComponent] -public class UnitDetail : MonoBehaviour, IBodyRendererAgent, IBodyJointAgent -{ - public bool showGizmos;
-
- [FormerlySerializedAs("root")] - public Transform rootBone; - - [Tooltip("残影用的prefab")] - public string afterImageAvatarPath;
-
- [Tooltip("Snapshot用的prefab")] - public string snapshotAvatarPath;
-
- UnitBoneDictionary IBodyJointAgent.bones { get { return m_Bones; } }
- [FormerlySerializedAs("bones")] - public UnitBoneDictionary m_Bones;
-
- UnitReferencePointDictionary IBodyJointAgent.referencePoints { get { return m_ReferencePoints; } }
- [FormerlySerializedAs("referencePoints")] - public UnitReferencePointDictionary m_ReferencePoints;
-
- public float snapshotBound;
-
- BodyPartRenderer IBodyRendererAgent.mainRenderer { get { return m_MainRenderer; } }
- [SerializeField] private BodyPartRenderer m_MainRenderer;
- BodyPartRenderer[] IBodyRendererAgent.renderers { get { return m_Renderers; } }
- [SerializeField] private BodyPartRenderer[] m_Renderers;
-
- public Vector3 center
- {
- get
- {
- if (m_MainRenderer == null || m_MainRenderer.renderer == null)
- return Vector3.zero ;
- return m_MainRenderer.renderer.bounds.center;
- }
- }
-
- public UnitDetail() - {
- m_Bones = new UnitBoneDictionary(); - foreach(EUnitBone e in Enum.GetValues(typeof(EUnitBone))) - {
- m_Bones.Add(e, null); - } - } - - public Transform GetBone(EUnitBone bone) - { - if (m_Bones.ContainsKey(bone)) - return m_Bones[bone]; - return null; - } - - public bool HasBone(EUnitBone bone) - { - return m_Bones.ContainsKey(bone); - } - - private void OnDrawGizmos()
- {
- if (!showGizmos)
- return;
- Gizmos.DrawWireCube(center, new Vector3(snapshotBound, snapshotBound, 0));
- } - - IEnumerator GetRenderers()
- {
- for(int i = 0; i < m_Renderers.Length; ++i)
- {
- yield return m_Renderers[i].renderer;
- }
- } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/UnitDetail.cs.meta b/Assets/Scripts/Unit/UnitDetail.cs.meta deleted file mode 100644 index f004ea18..00000000 --- a/Assets/Scripts/Unit/UnitDetail.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75a2e2ebdc58ab940858d821f8a1ffa0 -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 deleted file mode 100644 index 5234daab..00000000 --- a/Assets/Scripts/Unit/UnitRootMotion.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-// 同步root motion到角色根节点
-[DisallowMultipleComponent]
-public class UnitRootMotion : UnitComponent
-{
- RootMotionData m_RootMotionData;
-
- float m_PrevFrame;
- AnimationData m_PrevAnimationData;
-
- public override void Initialize()
- {
- base.Initialize();
-
- m_PrevFrame = 0;
- m_PrevAnimationData = null;
- }
-
-#if false // 用自定义root motion
-
- private float m_PrevNormalTime;
-
- Dictionary<UnitAnimation.EAnimState, RootMotionData> m_RootMotionDic = new Dictionary<UnitAnimation.EAnimState, RootMotionData>();
-
- public void Reset()
- {
- m_PrevNormalTime = 0;
- }
-
- public override void OnUpdate()
- {
- base.OnUpdate();
-
- var state = m_Owner.unitAnimation.curState;
- float playbackTime = m_Owner.unitAnimation.playbackTime;
-
- var rootMotion = m_RootMotionDic[state];
- float normalTime = (playbackTime % rootMotion.animationLength) / rootMotion.animationLength;
-
- if (m_PrevNormalTime > normalTime)
- m_PrevNormalTime = 0;
-
- m_Owner.transform.position += rootMotion.GetRootMotionDistance(m_PrevNormalTime, normalTime);
- m_PrevNormalTime = normalTime;
- }
-
- public void SetUpRootMotion(string unitFolder, UnitActionData actions)
- {
- if (actions == null)
- return;
-
- foreach (var action in actions.actions)
- {
-#if UNITY_EDITOR
- AnimationClip clip = action.Value;
- string name = clip.name;
- string path = unitFolder + "RootMotion/" + name + ".asset";
- RootMotionData data = AssetDatabase.LoadAssetAtPath<RootMotionData>(path);
- m_RootMotionDic.Add(action.Key, data);
-#endif
- }
- }
-
-#else
-
- public override void OnUpdate()
- {
- base.OnUpdate();
- }
-
- public void OnAnimationChange()
- {
- m_PrevAnimationData = null;
- }
-
- public void UpdateRootMotion()
- {
- bool overrideRootMotion = m_Owner.unitAnimation.baseLayer.animationData.overrideRootMotion;
- if(overrideRootMotion)
- {
- var baseLayer = m_Owner.unitAnimation.baseLayer;
- var rmData = m_Owner.unitAnimation.baseLayer.animationData.rootMotionOverrideData;
- float frame = baseLayer.playbackNormalizedTime * baseLayer.clipInfo.clip.length * TimelineEventProxy.FPS;
- var animData = m_Owner.unitAnimation.baseLayer.animationData;
- if(animData != m_PrevAnimationData)
- {
- m_PrevAnimationData = animData;
- m_PrevFrame = frame;
- }
- if (m_PrevFrame > frame)
- m_PrevFrame = frame;
- Vector3 dest = rmData.GetRootMotionDistance(m_PrevFrame, frame);
- Vector3 realDest = m_Owner.transform.rotation * dest;
- if(animData.GetProperty(EAnimationProperty.ORMEnforcement) != 0)
- {
- if(m_Owner.transform.position.y + realDest.y < 0)
- realDest.y = 0;
- }
- m_Owner.transform.position += realDest;
-
- m_PrevFrame = frame;
- }
- else
- {
- // 因为Unti被旋转了90度,所以这里的deltaPosition的forward是x方向了
- Vector3 dest = m_Owner.unitAnimation.animator.deltaPosition;
- dest.z = 0;
- var state = m_Owner.unitAnimation.baseLayer.stateInfo;
- bool ignoreY = m_Owner.unitAnimation.baseLayer.animationData.GetProperty(EAnimationProperty.IgnoreY, 0) != 0;
- if (state.IsTag("IgnoreY") || ignoreY)
- {
- dest.y = 0;
- }
- //m_Owner.transform.position += RootMotionUtility.ExchangeXZ(dest); // 不需要exchangeXZ
- m_Owner.transform.position += dest;
- }
- }
-
-#endif
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Unit/UnitRootMotion.cs.meta b/Assets/Scripts/Unit/UnitRootMotion.cs.meta deleted file mode 100644 index 42622b66..00000000 --- a/Assets/Scripts/Unit/UnitRootMotion.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05efd5500263f8b4083c459be5fb763d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/UnitSnapshot.cs b/Assets/Scripts/Unit/UnitSnapshot.cs deleted file mode 100644 index f43189cb..00000000 --- a/Assets/Scripts/Unit/UnitSnapshot.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
- -// 保存当前角色的快照 -public struct UnitSnapshotInfo -{
- public UnitController unit;
-
- public int animStateHash;
-
- public float normalizedTime;
-
- public TRS trs;
-
-}
-
-// 角色快照,用于lens effect
-public class UnitSnapshot : MonoBehaviour
-{
- [HideInInspector]
- public UnitController owner;
- public Animator animator;
- public Renderer[] renderers;
-
- public bool active
- {
- get
- {
- return this.gameObject.activeSelf;
- }
- set
- {
- this.gameObject.SetActive(value);
- }
- }
-
- public void Initialize(UnitController prototype)
- {
- owner = prototype;
- animator.runtimeAnimatorController = prototype.unitAnimation.animator.runtimeAnimatorController;
- animator.speed = 0;
- }
-
- public void ApplySnapshot(UnitSnapshotInfo info)
- {
- active = true;
- animator.speed = 0.02f;
- animator.Play(info.animStateHash, 0, info.normalizedTime);
- animator.Update(1 / 60f);
- animator.speed = 0;
- active = false;
- }
-
-}
diff --git a/Assets/Scripts/Unit/UnitSnapshot.cs.meta b/Assets/Scripts/Unit/UnitSnapshot.cs.meta deleted file mode 100644 index 31c837aa..00000000 --- a/Assets/Scripts/Unit/UnitSnapshot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d63b30ef896f0a548865db54d2bdbbeb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils.meta b/Assets/Scripts/Utils.meta deleted file mode 100644 index 91ca41d5..00000000 --- a/Assets/Scripts/Utils.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a953029ae3d65c244810684d4561cc3e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/ActiveGroup.cs b/Assets/Scripts/Utils/ActiveGroup.cs deleted file mode 100644 index bae3a39d..00000000 --- a/Assets/Scripts/Utils/ActiveGroup.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActiveGroup : MonoBehaviour
-{
- public Object[] members;
-
- public bool active
- {
- get
- {
- return true;
- }
- set
- {
- }
- }
-
-}
diff --git a/Assets/Scripts/Utils/ActiveGroup.cs.meta b/Assets/Scripts/Utils/ActiveGroup.cs.meta deleted file mode 100644 index 3ccf34ba..00000000 --- a/Assets/Scripts/Utils/ActiveGroup.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6391395616b3b234a8dc72ea67aaa400 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs b/Assets/Scripts/Utils/DisallowModifiyInGUI.cs deleted file mode 100644 index 660d2f0e..00000000 --- a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 有这个标记时表示这个属性是GUI.enabled = false
-public class DisallowModifiyInGUI : Attribute
-{
-}
diff --git a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta b/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta deleted file mode 100644 index afc8de79..00000000 --- a/Assets/Scripts/Utils/DisallowModifiyInGUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28afd9ec15889e540aed85386e9d33f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/ListPool.cs b/Assets/Scripts/Utils/ListPool.cs deleted file mode 100644 index 9819aa48..00000000 --- a/Assets/Scripts/Utils/ListPool.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine;
-using UnityEngine.Events;
-
-public static class ListPool<T>
-{
- public static List<T> Get()
- {
- return ListPool<T>.m_ListPool.Get();
- }
-
- public static void Release(List<T> toRelease)
- {
- ListPool<T>.m_ListPool.Release(toRelease);
- }
-
- private static readonly ObjectPool<List<T>> m_ListPool = new ObjectPool<List<T>>(null, delegate (List<T> l)
- {
- l.Clear();
- });
-}
-
-public class ObjectPool<T> where T : new()
-{
- private readonly Stack<T> m_Stack = new Stack<T>();
- private readonly UnityAction<T> m_ActionOnGet;
- private readonly UnityAction<T> m_ActionOnRelease;
-
- public int countAll { get; private set; }
- public int countActive { get { return countAll - countInactive; } }
- public int countInactive { get { return m_Stack.Count; } }
-
- public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
- {
- m_ActionOnGet = actionOnGet;
- m_ActionOnRelease = actionOnRelease;
- }
-
- public T Get()
- {
- T element;
- if (m_Stack.Count == 0)
- {
- element = new T();
- countAll++;
- }
- else
- {
- element = m_Stack.Pop();
- }
- if (m_ActionOnGet != null)
- m_ActionOnGet(element);
- return element;
- }
-
- public void Release(T element)
- {
- if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element))
- Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
- if (m_ActionOnRelease != null)
- m_ActionOnRelease(element);
- m_Stack.Push(element);
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/ListPool.cs.meta b/Assets/Scripts/Utils/ListPool.cs.meta deleted file mode 100644 index 61b7dcc3..00000000 --- a/Assets/Scripts/Utils/ListPool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 385194156796a3241a248d31172defe5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/LogHelper.cs b/Assets/Scripts/Utils/LogHelper.cs deleted file mode 100644 index 9c835bbe..00000000 --- a/Assets/Scripts/Utils/LogHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class LogHelper -{ - public static void LogError(string msg) - { - Debug.LogError("[Erika] " + msg); - } - - public static void Log(string msg) - { - Debug.Log("[Erika] " + msg); - } - -} diff --git a/Assets/Scripts/Utils/LogHelper.cs.meta b/Assets/Scripts/Utils/LogHelper.cs.meta deleted file mode 100644 index c8d1f167..00000000 --- a/Assets/Scripts/Utils/LogHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dd089c734de45ce41b5d8cf87dfbd0bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/MatrixUtility.cs b/Assets/Scripts/Utils/MatrixUtility.cs deleted file mode 100644 index f3d865f2..00000000 --- a/Assets/Scripts/Utils/MatrixUtility.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class MatrixUtility -{ - - public static void SetTR(ref this Matrix4x4 matrix, Vector3 pos, Quaternion q) - { - matrix = q.ToMatrix(); - matrix[12] = pos[0]; - matrix[13] = pos[1]; - matrix[14] = pos[2]; - } - - public static void SetTRS2(ref this Matrix4x4 matrix, Vector3 pos, Quaternion q, Vector3 s) - { - matrix = q.ToMatrix(); - - matrix[0] *= s[0]; - matrix[1] *= s[0]; - matrix[2] *= s[0]; - matrix[4] *= s[1]; - matrix[5] *= s[1]; - matrix[6] *= s[1]; - matrix[8] *= s[2]; - matrix[9] *= s[2]; - matrix[10] *= s[2]; - matrix[12] = pos[0]; - matrix[13] = pos[1]; - matrix[14] = pos[2]; - - } - - public static Matrix4x4 RotateAndTranslate(Vector3 pos, Quaternion q) - { - Matrix4x4 m = new Matrix4x4(); - m.SetTR(pos, q); - return m; - } - -} diff --git a/Assets/Scripts/Utils/MatrixUtility.cs.meta b/Assets/Scripts/Utils/MatrixUtility.cs.meta deleted file mode 100644 index 746a5d82..00000000 --- a/Assets/Scripts/Utils/MatrixUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f4a4958b670de143b1189fc304ace4a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/MinMaxAttribute.cs b/Assets/Scripts/Utils/MinMaxAttribute.cs deleted file mode 100644 index bba4087a..00000000 --- a/Assets/Scripts/Utils/MinMaxAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -public class MinMaxSliderAttribute : PropertyAttribute -{ - - public float min; - public float max; - - public MinMaxSliderAttribute(float min, float max) - { - this.min = min; - this.max = max; - } -} diff --git a/Assets/Scripts/Utils/MinMaxAttribute.cs.meta b/Assets/Scripts/Utils/MinMaxAttribute.cs.meta deleted file mode 100644 index 7a97ffb4..00000000 --- a/Assets/Scripts/Utils/MinMaxAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7afbee84722215549ae77c81ee280f53 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/QuaternionUtility.cs b/Assets/Scripts/Utils/QuaternionUtility.cs deleted file mode 100644 index d491b1fe..00000000 --- a/Assets/Scripts/Utils/QuaternionUtility.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class QuaternionUtility -{ - - public static Matrix4x4 ToMatrix(ref this Quaternion q) - { - Matrix4x4 m = new Matrix4x4(); - - // Precalculate coordinate products - float x = q.x * 2.0F; - float y = q.y * 2.0F; - float z = q.z * 2.0F; - float xx = q.x * x; - float yy = q.y * y; - float zz = q.z * z; - float xy = q.x * y; - float xz = q.x * z; - float yz = q.y * z; - float wx = q.w * x; - float wy = q.w * y; - float wz = q.w * z; - - // Calculate 3x3 matrix from orthonormal basis - m[0] = 1.0f - (yy + zz); - m[1] = xy + wz; - m[2] = xz - wy; - m[3] = 0.0F; - - m[4] = xy - wz; - m[5] = 1.0f - (xx + zz); - m[6] = yz + wx; - m[7] = 0.0F; - - m[8] = xz + wy; - m[9] = yz - wx; - m[10] = 1.0f - (xx + yy); - m[11] = 0.0F; - - m[12] = 0.0F; - m[13] = 0.0F; - m[14] = 0.0F; - m[15] = 1.0F; - - return m; - } - - -} diff --git a/Assets/Scripts/Utils/QuaternionUtility.cs.meta b/Assets/Scripts/Utils/QuaternionUtility.cs.meta deleted file mode 100644 index 49d589fc..00000000 --- a/Assets/Scripts/Utils/QuaternionUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 789820cb2898f6f488d8b3bfdf94ab00 -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 deleted file mode 100644 index a882238a..00000000 --- a/Assets/Scripts/Utils/Singleton.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-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;
-
- public static T Instance
- {
- get
- {
- if (_instance == null)
- _instance = Activator.CreateInstance<T>();
- return _instance;
- }
- }
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/Singleton.cs.meta b/Assets/Scripts/Utils/Singleton.cs.meta deleted file mode 100644 index 81c20c5a..00000000 --- a/Assets/Scripts/Utils/Singleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 47d828939d4273d478d2b48fee027c75 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/TRS.cs b/Assets/Scripts/Utils/TRS.cs deleted file mode 100644 index f5d6f559..00000000 --- a/Assets/Scripts/Utils/TRS.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public struct TRS
-{
- public Vector3 position;
- public Quaternion rotation;
- public Vector3 scale;
- public TRS(Vector3 pos, Quaternion rot, Vector3 sc)
- {
- position = pos;
- rotation = rot;
- scale = sc;
- }
-}
diff --git a/Assets/Scripts/Utils/TRS.cs.meta b/Assets/Scripts/Utils/TRS.cs.meta deleted file mode 100644 index f4d46a93..00000000 --- a/Assets/Scripts/Utils/TRS.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c2ec12b0e2046b84eac06e01b02937e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/TransformUtility.cs b/Assets/Scripts/Utils/TransformUtility.cs deleted file mode 100644 index 62a28ece..00000000 --- a/Assets/Scripts/Utils/TransformUtility.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class TransformUtility -{ - - public static Matrix4x4 GetLocalToWorldMatrix(Transform transform) - { - Matrix4x4 mat = Matrix4x4.identity; - while(transform != null) - { - Matrix4x4 m = Matrix4x4.identity; - m.SetTRS2(transform.localPosition, transform.localRotation, transform.localScale); - mat = m * mat; - transform = transform.parent; - } - - return mat; - } - - public static Matrix4x4 GetLocalToWorldMatrixNoScale(Transform transform) - { - Matrix4x4 mat = Matrix4x4.identity; - while (transform != null) - { - Matrix4x4 m = Matrix4x4.identity; - m.SetTR(transform.localPosition, transform.localRotation); - mat = m * mat; - transform = transform.parent; - } - - return mat; - } - - public static Matrix4x4 GetLocalToWorldMatrixRootBone(Transform transform) - { - //Matrix4x4 mat = Matrix4x4.identity; - //while (transform != null) - //{ - // Matrix4x4 m = Matrix4x4.identity; - // m = Matrix4x4.Rotate(transform.localRotation); - // mat = m * mat; - // transform = transform.parent; - //} - //mat.SetColumn(3, new Vector4(trans.position.x, trans.position.y, trans.position.z, 1)); - - Matrix4x4 mat = Matrix4x4.Rotate(transform.rotation); - mat.SetColumn(3, new Vector4(transform.position.x, transform.position.y, transform.position.z, 1)); - - return mat; - } - -}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/TransformUtility.cs.meta b/Assets/Scripts/Utils/TransformUtility.cs.meta deleted file mode 100644 index bda7ca18..00000000 --- a/Assets/Scripts/Utils/TransformUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 00b07ec5a54ffcc44a9af249df119257 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/UIDManager.cs b/Assets/Scripts/Utils/UIDManager.cs deleted file mode 100644 index 3283de4e..00000000 --- a/Assets/Scripts/Utils/UIDManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class UIDManager
-{
- static int id = 0;
-
- /// <summary>
- /// 拿一个id
- /// </summary>
- /// <returns></returns>
- public static int Acquire()
- {
- return ++id;
- }
-
-}
diff --git a/Assets/Scripts/Utils/UIDManager.cs.meta b/Assets/Scripts/Utils/UIDManager.cs.meta deleted file mode 100644 index 4a2a8ee0..00000000 --- a/Assets/Scripts/Utils/UIDManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 67355920ae292904288feb5dc3f089bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/UnityExtends.cs b/Assets/Scripts/Utils/UnityExtends.cs deleted file mode 100644 index d1a66f48..00000000 --- a/Assets/Scripts/Utils/UnityExtends.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class UnityExtends -{ - public static T GetOrAddComponent<T>(this GameObject go) where T : MonoBehaviour - { - T component = go.GetComponent<T>(); - if (component == null) - component = go.AddComponent<T>(); - return component; - } - - -} diff --git a/Assets/Scripts/Utils/UnityExtends.cs.meta b/Assets/Scripts/Utils/UnityExtends.cs.meta deleted file mode 100644 index 44139deb..00000000 --- a/Assets/Scripts/Utils/UnityExtends.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3d655d75a9052fa499fa925877bb9340 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Utils/VectorUtility.cs b/Assets/Scripts/Utils/VectorUtility.cs deleted file mode 100644 index b0e857e7..00000000 --- a/Assets/Scripts/Utils/VectorUtility.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public static class VectorExtend
-{
-
- public static Vector4 ToVector4(ref this Vector3 v3, float w = 1)
- {
- Vector4 v4 = new Vector4(v3.x, v3.y, v3.z, 1);
- return v4;
- }
-
- public static Vector3 ToVector3(ref this Vector4 v4)
- {
- Vector3 v3 = new Vector3(v4.x, v4.y, v4.z);
- return v3;
- }
-
- public static Vector2 ToVector2(ref this Vector3 v3)
- {
- Vector2 v2 = new Vector2(v3.x, v3.y);
- return v2;
- }
-
-}
-
-public class VectorUtility
-{
-
-
-}
\ No newline at end of file diff --git a/Assets/Scripts/Utils/VectorUtility.cs.meta b/Assets/Scripts/Utils/VectorUtility.cs.meta deleted file mode 100644 index 32a9937b..00000000 --- a/Assets/Scripts/Utils/VectorUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2ee12b1cbc903254a8f8328d26b267c7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: |