diff options
-rw-r--r-- | CreepyRobots.csproj | 3 | ||||
-rw-r--r-- | GameMode.cs | 2 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/Gravity.cs (renamed from _ActiveRagdoll/Gravity.cs) | 15 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/Holding.cs (renamed from _ActiveRagdoll/Holding.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/PlayerDeath.cs (renamed from _ActiveRagdoll/PlayerDeath.cs) | 1 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/PlayerKnockback.cs (renamed from _ActiveRagdoll/PlayerKnockback.cs) | 5 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/SetAnimationByInput.cs (renamed from _ActiveRagdoll/SetAnimationByInput.cs) | 1 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/SetAnimationByVelocity.cs (renamed from _ActiveRagdoll/SetAnimationByVelocity.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/Actions/StayInPlace.cs (renamed from _ActiveRagdoll/StayInPlace.cs) | 9 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/AnimationHandler.cs | 9 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/DragHandler.cs (renamed from _ActiveRagdoll/DragHandler.cs) | 1 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/FootHandler.cs (renamed from _ActiveRagdoll/FootHandler.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/HeadCollisionHandler.cs (renamed from _ActiveRagdoll/HeadCollisionHandler.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/RagdollHandler.cs (renamed from _ActiveRagdoll/RagdollHandler.cs) | 4 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/RigidbodyHolder.cs (renamed from _ActiveRagdoll/RigidbodyHolder.cs) | 1 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/RotationHandler.cs (renamed from _ActiveRagdoll/RotationHandler.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/StandingDataHandler.cs (renamed from _ActiveRagdoll/StandingDataHandler.cs) | 2 | ||||
-rw-r--r-- | _ActiveRagdoll/Handlers/WeaponHandler.cs (renamed from _ActiveRagdoll/WeaponHandler.cs) | 0 | ||||
-rw-r--r-- | _ActiveRagdoll/HasControl.cs | 3 | ||||
-rw-r--r-- | _ActiveRagdoll/SetRigidbodySettings.cs | 4 | ||||
-rw-r--r-- | _Debug/REPL.cs | 28 |
21 files changed, 53 insertions, 35 deletions
diff --git a/CreepyRobots.csproj b/CreepyRobots.csproj index 4a8859f..4130888 100644 --- a/CreepyRobots.csproj +++ b/CreepyRobots.csproj @@ -180,9 +180,6 @@ <HintPath>..\CreepyRobots_Data\Managed\UnityEngine.WindModule.dll</HintPath> </Reference> </ItemGroup> - <ItemGroup> - <Folder Include="_ActiveRagdoll\Actions\" /> - </ItemGroup> <Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Command="D:\Documents\Unity\Decompile\CreepyRobots\copy_dll.cmd" /> </Target> diff --git a/GameMode.cs b/GameMode.cs index 5b03929..5529231 100644 --- a/GameMode.cs +++ b/GameMode.cs @@ -30,7 +30,7 @@ public class GameMode : MonoBehaviour Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; - Invoke("DebugGame", 3); + Invoke("DebugGame", 1); Init(); while (true) diff --git a/_ActiveRagdoll/Gravity.cs b/_ActiveRagdoll/Actions/Gravity.cs index f646f0c..42f3125 100644 --- a/_ActiveRagdoll/Gravity.cs +++ b/_ActiveRagdoll/Actions/Gravity.cs @@ -2,11 +2,11 @@ using UnityEngine; public class Gravity : MonoBehaviour { - public float baseGravity; + public float baseGravity;//5 - public float scalingGravity; + public float scalingGravity;//70 - private RigidbodyHolder allRigs; + private RigidbodyHolder allRigs;//14个全部 private StandingDataHandler standingData; @@ -30,8 +30,13 @@ public class Gravity : MonoBehaviour } for (int i = 0; i < allRigs.GetAllRigs().Length; i++) { - allRigs.GetAllRigs()[i].AddForce(Vector3.down * baseGravity + Vector3.down * scalingGravity * standingData.sinceGrounded, ForceMode.Acceleration); - } + // standingData.sinceGrounded是离地时间 + Vector3 g = Vector3.down * baseGravity + Vector3.down * scalingGravity * standingData.sinceGrounded; + // 重力=持久的基础重力+随着离地状态变化的重力,离地时增加额外重力 + allRigs.GetAllRigs()[i].AddForce(g, ForceMode.Acceleration); + //Debug.Log(g); + //Debug.Log(standingData.sinceGrounded); + } if ((bool)holding) { if ((bool)holding.heldObject) diff --git a/_ActiveRagdoll/Holding.cs b/_ActiveRagdoll/Actions/Holding.cs index eb27095..eb27095 100644 --- a/_ActiveRagdoll/Holding.cs +++ b/_ActiveRagdoll/Actions/Holding.cs diff --git a/_ActiveRagdoll/PlayerDeath.cs b/_ActiveRagdoll/Actions/PlayerDeath.cs index ec0813a..637e713 100644 --- a/_ActiveRagdoll/PlayerDeath.cs +++ b/_ActiveRagdoll/Actions/PlayerDeath.cs @@ -1,5 +1,6 @@ using UnityEngine; +//Player PlayerDeath 动作-角色死亡 public class PlayerDeath : MonoBehaviour { public bool dead; diff --git a/_ActiveRagdoll/PlayerKnockback.cs b/_ActiveRagdoll/Actions/PlayerKnockback.cs index 89fffb8..d4839bf 100644 --- a/_ActiveRagdoll/PlayerKnockback.cs +++ b/_ActiveRagdoll/Actions/PlayerKnockback.cs @@ -1,8 +1,9 @@ using UnityEngine; +//Player PlayerKnockback 动作-击退 public class PlayerKnockback : MonoBehaviour { - private RigidbodyHolder allRigs; + private RigidbodyHolder allRigs;//14 private StandingDataHandler standing; @@ -17,7 +18,7 @@ public class PlayerKnockback : MonoBehaviour private void Update() { - if (Input.GetKeyDown(KeyCode.K)) + if (Input.GetKeyDown(KeyCode.K)) //kill { AddSeriousKnockback(); } diff --git a/_ActiveRagdoll/SetAnimationByInput.cs b/_ActiveRagdoll/Actions/SetAnimationByInput.cs index cc50e5a..41948ec 100644 --- a/_ActiveRagdoll/SetAnimationByInput.cs +++ b/_ActiveRagdoll/Actions/SetAnimationByInput.cs @@ -1,5 +1,6 @@ using UnityEngine; +//Player SetAnimationByInput 根据键盘输入切换动作 public class SetAnimationByInput : MonoBehaviour { private InputHandler input; diff --git a/_ActiveRagdoll/SetAnimationByVelocity.cs b/_ActiveRagdoll/Actions/SetAnimationByVelocity.cs index c737363..c737363 100644 --- a/_ActiveRagdoll/SetAnimationByVelocity.cs +++ b/_ActiveRagdoll/Actions/SetAnimationByVelocity.cs diff --git a/_ActiveRagdoll/StayInPlace.cs b/_ActiveRagdoll/Actions/StayInPlace.cs index d10ebba..c8bdf4b 100644 --- a/_ActiveRagdoll/StayInPlace.cs +++ b/_ActiveRagdoll/Actions/StayInPlace.cs @@ -1,12 +1,13 @@ using UnityEngine; +//Player StayInPlace 动作-移动到停止时停下来 public class StayInPlace : MonoBehaviour { private InputHandler input; - public Rigidbody rig; + public Rigidbody rig; // Hip - public float force; + public float force;// 100 private Vector3 stopPosition; @@ -33,12 +34,12 @@ public class StayInPlace : MonoBehaviour return; } strength = str.strength; - if (input.inputMovementDirection.magnitude > 0.1f) + if (input.inputMovementDirection.magnitude > 0.1f) // 移动 { stopPosition = rig.position + rig.velocity * 0.25f; isBroken = false; } - else if (!isBroken) + else if (!isBroken) // 移动到停下 { if (Vector3.Distance(stopPosition, rig.position) > 1f) { diff --git a/_ActiveRagdoll/Handlers/AnimationHandler.cs b/_ActiveRagdoll/Handlers/AnimationHandler.cs index 382b3a5..437a8dd 100644 --- a/_ActiveRagdoll/Handlers/AnimationHandler.cs +++ b/_ActiveRagdoll/Handlers/AnimationHandler.cs @@ -3,7 +3,14 @@ using UnityEngine; //Player AnimationHandler 记录当前动作状态编号 public class AnimationHandler : MonoBehaviour { - public int animationState; + /* + 0 Stand + 1 Sprint + 2 Run + 3 Jump + */ + + public int animationState; private void Start() { diff --git a/_ActiveRagdoll/DragHandler.cs b/_ActiveRagdoll/Handlers/DragHandler.cs index adb8df4..5f6556c 100644 --- a/_ActiveRagdoll/DragHandler.cs +++ b/_ActiveRagdoll/Handlers/DragHandler.cs @@ -1,5 +1,6 @@ using UnityEngine; +// 设置当前骨骼的drag和angularDrag public class DragHandler : MonoBehaviour { private float drag; diff --git a/_ActiveRagdoll/FootHandler.cs b/_ActiveRagdoll/Handlers/FootHandler.cs index 7343e21..7343e21 100644 --- a/_ActiveRagdoll/FootHandler.cs +++ b/_ActiveRagdoll/Handlers/FootHandler.cs diff --git a/_ActiveRagdoll/HeadCollisionHandler.cs b/_ActiveRagdoll/Handlers/HeadCollisionHandler.cs index c929f0e..c929f0e 100644 --- a/_ActiveRagdoll/HeadCollisionHandler.cs +++ b/_ActiveRagdoll/Handlers/HeadCollisionHandler.cs diff --git a/_ActiveRagdoll/RagdollHandler.cs b/_ActiveRagdoll/Handlers/RagdollHandler.cs index ca52b8d..29daa68 100644 --- a/_ActiveRagdoll/RagdollHandler.cs +++ b/_ActiveRagdoll/Handlers/RagdollHandler.cs @@ -2,9 +2,9 @@ using UnityEngine; public class RagdollHandler : MonoBehaviour { - public float ragdollValue = 1f; + public float ragdollValue = 1f;//1 - private RigidbodyHolder rigs; + private RigidbodyHolder rigs;//14 private void Start() { diff --git a/_ActiveRagdoll/RigidbodyHolder.cs b/_ActiveRagdoll/Handlers/RigidbodyHolder.cs index 796f77a..3ef0c54 100644 --- a/_ActiveRagdoll/RigidbodyHolder.cs +++ b/_ActiveRagdoll/Handlers/RigidbodyHolder.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using UnityEngine; +// 保存所有14个骨骼 public class RigidbodyHolder : MonoBehaviour { private Rigidbody[] allRigs; diff --git a/_ActiveRagdoll/RotationHandler.cs b/_ActiveRagdoll/Handlers/RotationHandler.cs index ee33545..ee33545 100644 --- a/_ActiveRagdoll/RotationHandler.cs +++ b/_ActiveRagdoll/Handlers/RotationHandler.cs diff --git a/_ActiveRagdoll/StandingDataHandler.cs b/_ActiveRagdoll/Handlers/StandingDataHandler.cs index 10a1473..a72ec09 100644 --- a/_ActiveRagdoll/StandingDataHandler.cs +++ b/_ActiveRagdoll/Handlers/StandingDataHandler.cs @@ -4,7 +4,7 @@ public class StandingDataHandler : MonoBehaviour { public Rigidbody mainRig; - public float sinceGrounded; + public float sinceGrounded; // 离地时间 public float sinceLanded; diff --git a/_ActiveRagdoll/WeaponHandler.cs b/_ActiveRagdoll/Handlers/WeaponHandler.cs index 7b3d80f..7b3d80f 100644 --- a/_ActiveRagdoll/WeaponHandler.cs +++ b/_ActiveRagdoll/Handlers/WeaponHandler.cs diff --git a/_ActiveRagdoll/HasControl.cs b/_ActiveRagdoll/HasControl.cs index dde8ad6..0759eb1 100644 --- a/_ActiveRagdoll/HasControl.cs +++ b/_ActiveRagdoll/HasControl.cs @@ -1,10 +1,11 @@ using UnityEngine; +// 批量控制某些go的显示和隐藏 public class HasControl : MonoBehaviour { public bool hasControl = true; - public GameObject[] objectsToRemove; + public GameObject[] objectsToRemove;//MainCamera ScreenShake private void Awake() { diff --git a/_ActiveRagdoll/SetRigidbodySettings.cs b/_ActiveRagdoll/SetRigidbodySettings.cs index 2521b75..5f8695a 100644 --- a/_ActiveRagdoll/SetRigidbodySettings.cs +++ b/_ActiveRagdoll/SetRigidbodySettings.cs @@ -2,9 +2,9 @@ using UnityEngine; public class SetRigidbodySettings : MonoBehaviour { - public float maxAngular; + public float maxAngular;//1000 - private void Start() + private void Start() { Rigidbody[] componentsInChildren = GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody rigidbody in componentsInChildren) diff --git a/_Debug/REPL.cs b/_Debug/REPL.cs index 5dd99e4..8e714ae 100644 --- a/_Debug/REPL.cs +++ b/_Debug/REPL.cs @@ -8,6 +8,8 @@ class REPL public static void StartREPL() { + //return; + AddHeightBox(); AddCamera(); AddRigidbodyDebug(); @@ -42,19 +44,19 @@ class REPL public static void AddRigidbodyDebug() { - string[] targets = { - //"Head", - //"Neck", - //"Torso", - //"Arm_Right", - //"Arm_Left", - //"Hand_Right", - //"Hand_Left", - //"Hip", - //"Leg_Left", - //"Leg_Right", - //"Foot_Left", - //"Foot_Right", + string[] targets = { + "Head", + "Neck", + "Torso", + "Arm_Right", + "Arm_Left", + "Hand_Right", + "Hand_Left", + "Hip", + "Leg_Left", + "Leg_Right", + "Foot_Left", + "Foot_Right", "Knee_Left", "Knee_Right", }; |