diff options
author | chai <chaifix@163.com> | 2020-11-09 20:50:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-11-09 20:50:17 +0800 |
commit | d21321d1e0d594ab247679cbfde86737aa24979c (patch) | |
tree | c22021ea204c25eda3a3eaa23b7aedd904eb00cc | |
parent | 0fdb81ffb2af8c39cfd611f485d46f3341206832 (diff) |
*misc
-rw-r--r-- | Assets/Prefabs/Characters/Saionji.prefab | 48 | ||||
-rw-r--r-- | Assets/Scenes/Demo/SaionjiShowOff.unity | 111 | ||||
-rw-r--r-- | Assets/Scripts/ApplicationMain.cs | 7 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/AbilitySystem.cs | 6 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/Avatar.cs | 6 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/HitDefination.cs | 6 | ||||
-rw-r--r-- | Assets/Scripts/Managers/BattleManager.cs | 12 | ||||
-rw-r--r-- | Assets/Scripts/Managers/BattleManager.cs.meta | 11 | ||||
-rw-r--r-- | Assets/Scripts/Managers/HitManager.cs | 3 | ||||
-rw-r--r-- | Assets/Scripts/Physics/PhysicsWorld.cs | 16 |
10 files changed, 135 insertions, 91 deletions
diff --git a/Assets/Prefabs/Characters/Saionji.prefab b/Assets/Prefabs/Characters/Saionji.prefab index e1b411fe..b1c32bec 100644 --- a/Assets/Prefabs/Characters/Saionji.prefab +++ b/Assets/Prefabs/Characters/Saionji.prefab @@ -490,6 +490,7 @@ GameObject: m_Component: - component: {fileID: 4721566464291151502} - component: {fileID: 4380598530412210718} + - component: {fileID: 6224224267027884549} m_Layer: 0 m_Name: J_Bip_C_Hips m_TagString: Untagged @@ -537,6 +538,20 @@ MonoBehaviour: m_Center: {x: 0, y: 0, z: 0} m_Size: {x: 1, y: 1, z: 1} m_DrawGizmo: 1 +--- !u!114 &6224224267027884549 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091578199452354369} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 154a74587976e25469eae9a4a8c7762b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_BoxCollider: {fileID: 4380598530412210718} + m_Host: {fileID: 3741668519095819896} --- !u!1 &1116262850384336476 GameObject: m_ObjectHideFlags: 0 @@ -2734,6 +2749,7 @@ GameObject: - component: {fileID: 410002255665003909} - component: {fileID: 6265358196206440722} - component: {fileID: 758480958} + - component: {fileID: 1382199721} m_Layer: 0 m_Name: J_Bip_C_Spine m_TagString: Untagged @@ -2795,6 +2811,20 @@ MonoBehaviour: m_Center: {x: 0, y: 0, z: 0} m_Size: {x: 1, y: 1, z: 1} m_DrawGizmo: 1 +--- !u!114 &1382199721 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4130389381008547732} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f763a2db7c267714f824ca6a69bec569, type: 3} + m_Name: + m_EditorClassIdentifier: + m_BoxCollider: {fileID: 758480958} + m_Host: {fileID: 3741668519095819896} --- !u!1 &4302075858485272031 GameObject: m_ObjectHideFlags: 0 @@ -4299,15 +4329,15 @@ MonoBehaviour: m_Body: {fileID: 6037765075253890941} m_BodyCollider: {fileID: 6037765075253890940} m_Hitbox: - - {fileID: 758480958} + - {fileID: 1382199721} m_Hurtbox: - - {fileID: 4380598530412210718} + - {fileID: 6224224267027884549} Go_PistolL: {fileID: 1226857665675379995} Go_PistolR: {fileID: 8973641233767307476} Go_Blade: {fileID: 3741668520236251698} Go_Reaper: {fileID: 1148501203892481869} Go_LongSword: {fileID: 8423417671875454545} - m_Weapon: 3 + m_Weapon: 1 EnableAbilitySystem: 1 Effects: - {fileID: 0} @@ -5655,15 +5685,15 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8423417671875454545} - m_LocalRotation: {x: -0, y: 0.066068396, z: -0, w: 0.99781513} - m_LocalPosition: {x: 0.083, y: -0.0147, z: 0.199} - m_LocalScale: {x: 0.019999996, y: 0.03, z: 2.5288317} + m_LocalRotation: {x: -0, y: 0.3969589, z: -0, w: 0.91783637} + m_LocalPosition: {x: 0.216, y: -0.0147, z: 0.15} + m_LocalScale: {x: 0.020461328, y: 0.03, z: 1.8} m_Children: - {fileID: 3743173033695073248} - {fileID: 7938087974208878210} m_Father: {fileID: 7447072760603604941} m_RootOrder: 8 - m_LocalEulerAnglesHint: {x: 0, y: 7.576, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 46.776, z: 0} --- !u!33 &5562140445699311197 MeshFilter: m_ObjectHideFlags: 0 @@ -6059,7 +6089,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 400000, guid: b199612d64e19664080e2f464c83df38, type: 3} propertyPath: m_LocalPosition.x - value: 0.044 + value: -0.011 objectReference: {fileID: 0} - target: {fileID: 400000, guid: b199612d64e19664080e2f464c83df38, type: 3} propertyPath: m_LocalPosition.y @@ -6067,7 +6097,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 400000, guid: b199612d64e19664080e2f464c83df38, type: 3} propertyPath: m_LocalPosition.z - value: 0.527 + value: 0.045 objectReference: {fileID: 0} - target: {fileID: 400000, guid: b199612d64e19664080e2f464c83df38, type: 3} propertyPath: m_LocalRotation.x diff --git a/Assets/Scenes/Demo/SaionjiShowOff.unity b/Assets/Scenes/Demo/SaionjiShowOff.unity index 76df455d..1833e344 100644 --- a/Assets/Scenes/Demo/SaionjiShowOff.unity +++ b/Assets/Scenes/Demo/SaionjiShowOff.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 170076734} - m_IndirectSpecularColor: {r: 0.44092834, g: 0.4896462, b: 0.5697487, a: 1} + m_IndirectSpecularColor: {r: 0.44092876, g: 0.4896468, b: 0.5697499, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -969,8 +969,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 534669902} - m_LocalRotation: {x: 0.008610075, y: -0.00048662993, z: 0.0000041900757, w: 0.9999628} - m_LocalPosition: {x: 8.448507, y: 2.154934, z: -7.7712817} + m_LocalRotation: {x: 0.026764132, y: -0.0017788075, z: 0.00004762537, w: 0.9996402} + m_LocalPosition: {x: 8.453558, y: 2.5000055, z: -9.190272} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1241327946} @@ -1341,7 +1341,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 801756637} - m_LocalRotation: {x: 0.008610075, y: -0.00048662993, z: 0.0000041900757, w: 0.9999628} + m_LocalRotation: {x: 0.026764132, y: -0.0017788075, z: 0.00004762537, w: 0.9996402} m_LocalPosition: {x: 8.448507, y: 2.154934, z: -7.7712817} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: @@ -1815,6 +1815,38 @@ MonoBehaviour: m_Calls: [] m_LegacyBlendHint: 0 m_ComponentOwner: {fileID: 930746910} +--- !u!1 &1070332050 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 446448032419613296, guid: 3250b3092f3b858438c6154710d18d3b, + type: 3} + m_PrefabInstance: {fileID: 446448032557589059} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1070332052 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2018469940, guid: 3250b3092f3b858438c6154710d18d3b, + type: 3} + m_PrefabInstance: {fileID: 446448032557589059} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1070332050} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 637138a0ba30abc498c5c9dcf6bb5d78, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1070332053 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1070332050} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 154a74587976e25469eae9a4a8c7762b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_BoxCollider: {fileID: 1070332052} + m_Host: {fileID: 1757703858} --- !u!1 &1093005977 GameObject: m_ObjectHideFlags: 0 @@ -2742,6 +2774,18 @@ Transform: m_Father: {fileID: 167449966} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1757703858 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2018470254, guid: 3250b3092f3b858438c6154710d18d3b, + type: 3} + m_PrefabInstance: {fileID: 446448032557589059} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6c58b0c0555555e4c9fbd344b5162103, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1897301755 stripped GameObject: m_CorrespondingSourceObject: {fileID: 1236453127613114, guid: bfbc37d0bc0e8ff4082a8b2894b3a486, @@ -2827,6 +2871,10 @@ PrefabInstance: propertyPath: Name value: ArmorSoldierWhite objectReference: {fileID: 0} + - target: {fileID: 2018470254, guid: 3250b3092f3b858438c6154710d18d3b, type: 3} + propertyPath: m_Hurtbox.Array.data[0] + value: + objectReference: {fileID: 1070332053} - target: {fileID: 446448032419613482, guid: 3250b3092f3b858438c6154710d18d3b, type: 3} propertyPath: m_Name @@ -2896,21 +2944,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 861183510} m_Modifications: - - target: {fileID: 1148501203892122477, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalPosition.x - value: -0.011 - objectReference: {fileID: 0} - - target: {fileID: 1148501203892122477, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalPosition.z - value: 0.045 - objectReference: {fileID: 0} - - target: {fileID: 3741668519095819896, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_Weapon - value: 1 - objectReference: {fileID: 0} - target: {fileID: 5505303514460593431, guid: 83d445123a203b14298b7a7662a0a470, type: 3} propertyPath: m_LocalPosition.x @@ -2966,46 +2999,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalRotation.y - value: 0.3969589 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalRotation.w - value: 0.91783637 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 46.776 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalPosition.x - value: 0.216 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalPosition.z - value: 0.15 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalScale.x - value: 0.020461328 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalScale.z - value: 1.8 - objectReference: {fileID: 0} - - target: {fileID: 6836637912472462891, guid: 83d445123a203b14298b7a7662a0a470, - type: 3} - propertyPath: m_LocalScale.y - value: 0.03 - objectReference: {fileID: 0} - target: {fileID: 6928613106012578342, guid: 83d445123a203b14298b7a7662a0a470, type: 3} propertyPath: m_Name diff --git a/Assets/Scripts/ApplicationMain.cs b/Assets/Scripts/ApplicationMain.cs index 2c310e9b..e445e2ee 100644 --- a/Assets/Scripts/ApplicationMain.cs +++ b/Assets/Scripts/ApplicationMain.cs @@ -10,14 +10,12 @@ public class ApplicationMain : MonoBehaviour PhysicsWorld.Instance.Init();
PhysicsWorld.Instance.onUpdate += OnPhysicsUpdate; - PhysicsWorld.Instance.onAfterUpdate += OnAfterPhysicsUpdate; } void Update() { InputManager.Instance.Update();
AvatarManager.Instance.OnUpdate();
-
PhysicsWorld.Instance.Update();
} @@ -27,11 +25,6 @@ public class ApplicationMain : MonoBehaviour AvatarManager.Instance.OnPhysicsUpdate();
}
- void OnAfterPhysicsUpdate()
- {
-
- }
-
private void OnDrawGizmos()
{
PhysicsWorld.Instance.DrawGizmos();
diff --git a/Assets/Scripts/Avatar/AbilitySystem.cs b/Assets/Scripts/Avatar/AbilitySystem.cs index 9d289884..5f6e9364 100644 --- a/Assets/Scripts/Avatar/AbilitySystem.cs +++ b/Assets/Scripts/Avatar/AbilitySystem.cs @@ -76,12 +76,14 @@ public class AbilitySystem 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 SwitchToAbility(AbilityBase targetAbility) diff --git a/Assets/Scripts/Avatar/Avatar.cs b/Assets/Scripts/Avatar/Avatar.cs index dc6c7858..03cceccb 100644 --- a/Assets/Scripts/Avatar/Avatar.cs +++ b/Assets/Scripts/Avatar/Avatar.cs @@ -99,12 +99,14 @@ public class Avatar : MonoBehaviour, IInteractable public virtual void OnHit(HitInfo hitInfo)
{
- Debug.Log("Hit");
+ //Debug.Log("Hit");
+ m_AbilitySystem.OnHit(hitInfo);
}
public virtual void OnHurt(HurtInfo hurtInfo)
{
- Debug.Log("Hurt");
+ //Debug.Log("Hurt");
+ m_AbilitySystem.OnHurt(hurtInfo);
}
}
diff --git a/Assets/Scripts/Avatar/HitDefination.cs b/Assets/Scripts/Avatar/HitDefination.cs index 96ceaf00..22a78325 100644 --- a/Assets/Scripts/Avatar/HitDefination.cs +++ b/Assets/Scripts/Avatar/HitDefination.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using UnityEngine; -// 一个hit的效果,如果一个attack有多个hit,需要定义多个HitDef +/// <summary>
+/// 一个hit的效果,如果一个attack有多个hit,需要定义多个HitDef
+/// </summary> public class HitDefination { public float start = 0f; @@ -13,6 +15,4 @@ public class HitDefination public Vector3 sparkPosition; // 特效位置(sparkHost为空时生效) public Quaternion sparkRotation; // 特效旋转 public Vector3 sparkScale = Vector3.one; // 特效缩放 - - }
\ No newline at end of file diff --git a/Assets/Scripts/Managers/BattleManager.cs b/Assets/Scripts/Managers/BattleManager.cs new file mode 100644 index 00000000..012862cd --- /dev/null +++ b/Assets/Scripts/Managers/BattleManager.cs @@ -0,0 +1,12 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class BattleManager : Singleton<BattleManager>
+{
+ public void OnHitOccured()
+ {
+
+ }
+
+}
diff --git a/Assets/Scripts/Managers/BattleManager.cs.meta b/Assets/Scripts/Managers/BattleManager.cs.meta new file mode 100644 index 00000000..ce0cee41 --- /dev/null +++ b/Assets/Scripts/Managers/BattleManager.cs.meta @@ -0,0 +1,11 @@ +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 index dfa6530f..2b198788 100644 --- a/Assets/Scripts/Managers/HitManager.cs +++ b/Assets/Scripts/Managers/HitManager.cs @@ -102,6 +102,9 @@ public class HitManager : Singleton<HitManager> hurtInfo.hitDef = hitDef;
hurtbox.Host.OnHurt(hurtInfo);
+
+ // 场景处理特效等
+ BattleManager.Instance.OnHitOccured();
}
}
}
diff --git a/Assets/Scripts/Physics/PhysicsWorld.cs b/Assets/Scripts/Physics/PhysicsWorld.cs index ec3b0ac8..7b7787d4 100644 --- a/Assets/Scripts/Physics/PhysicsWorld.cs +++ b/Assets/Scripts/Physics/PhysicsWorld.cs @@ -35,8 +35,8 @@ public class PhysicsWorld : Singleton<PhysicsWorld> {
public delegate void Callback();
+ public Callback onBeforeUpdate;
public Callback onUpdate;
- public Callback onAfterUpdate;
private int m_UpdateRate = 60;
// 重力加速度
@@ -112,28 +112,26 @@ public class PhysicsWorld : Singleton<PhysicsWorld> }
/// <summary>
- /// 物理系统已稳定的逻辑帧率执行
+ /// 物理系统以稳定的逻辑帧率执行
/// </summary>
public void Update()
{
- BeforeUpdate();
float preTime = m_TimeCount;
m_TimeCount = Time.time;
float deltaTime = m_TimeCount - preTime;
while (deltaTime > 1f / m_UpdateRate)
{
+ BeforeTick();
+ onBeforeUpdate?.Invoke();
Tick();
- if(onUpdate != null)
- onUpdate();
+ onUpdate?.Invoke();
deltaTime -= 1f / m_UpdateRate;
}
m_TimeCount -= deltaTime;
- if(onAfterUpdate != null)
- onAfterUpdate();
}
// 更新之前
- private void BeforeUpdate()
+ private void BeforeTick()
{
m_CollisionInfo.Clear();
}
@@ -238,7 +236,7 @@ public class PhysicsWorld : Singleton<PhysicsWorld> }
/// <summary>
- /// 处理有物体的动力学运动
+ /// 处理动力学
/// </summary>
/// <param name="prim"></param>
/// <param name="deltaTime"></param>
|