Remake moving in air

This commit is contained in:
haitem 2021-01-30 14:29:14 +01:00
parent 16720de0d1
commit a6971e9669
4 changed files with 32 additions and 61 deletions

View File

@ -251,7 +251,7 @@ BoxCollider:
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.8, y: 0.8, z: 0.8}
m_Size: {x: 0.9, y: 0.8, z: 0.9}
m_Center: {x: 0, y: -0.2, z: 0}
--- !u!114 &7094923891560833916
MonoBehaviour:

View File

@ -58,7 +58,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -3033667219593020291, guid: a2c33b905bb71c74aacdeca187b58abf, type: 3}
- {fileID: 2100000, guid: b5a0edef0c6a0d649871a5d54e0a52bb, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -90,6 +90,7 @@ GameObject:
- component: {fileID: 9203772316689128559}
- component: {fileID: 9080541236209420060}
- component: {fileID: 5580451219914191876}
- component: {fileID: 3881240002875110222}
m_Layer: 0
m_Name: SkillCube
m_TagString: Objects
@ -104,7 +105,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8426673075699058389}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.38, y: 0.5, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_Children:
@ -142,3 +143,18 @@ MeshCollider:
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: -2432090755550338912, guid: a2c33b905bb71c74aacdeca187b58abf, type: 3}
--- !u!114 &3881240002875110222
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8426673075699058389}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 08fe7369accc1464499b2f2a75559298, type: 3}
m_Name:
m_EditorClassIdentifier:
powerType: 1
powerTime: 10
powerUnit: 0.2

View File

@ -306,27 +306,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &3881240002875110221 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8426673075699058389, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
m_PrefabInstance: {fileID: 4696517446902494616}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3881240002875110222
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3881240002875110221}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 08fe7369accc1464499b2f2a75559298, type: 3}
m_Name:
m_EditorClassIdentifier:
powerType: 1
powerTime: 10
powerUnit: 0.2
--- !u!1001 &4696517446902494616
PrefabInstance:
m_ObjectHideFlags: 0
@ -334,36 +313,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_CastShadows
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_MotionVectors
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_ReceiveShadows
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_LightProbeUsage
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_ReflectionProbeUsage
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7942378762641371369, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: b5a0edef0c6a0d649871a5d54e0a52bb, type: 2}
- target: {fileID: 8426673075699058389, guid: a81c7869040fbef4f8d5acf2c1499c42,
type: 3}
propertyPath: m_Name

View File

@ -89,7 +89,7 @@ public class PlayerManager : MonoBehaviour
void Animation()
{
float localSpeed = 5f;
if (Input.GetAxis("Horizontal") > 0)
if (Input.GetAxis("Horizontal") > 0 && onGround)
{
playerAnimator.SetBool("Walk", true);
playerAnimator.transform.rotation = Quaternion.Lerp(
@ -98,7 +98,7 @@ public class PlayerManager : MonoBehaviour
localSpeed * Time.deltaTime
);
}
else if (Input.GetAxis("Horizontal") < 0)
else if (Input.GetAxis("Horizontal") < 0 && onGround)
{
playerAnimator.SetBool("Walk", true);
playerAnimator.transform.rotation = Quaternion.Lerp(
@ -115,11 +115,13 @@ public class PlayerManager : MonoBehaviour
void Move()
{
if (onGround) {
rigidBody.MovePosition(
transform.position +
(transform.right * (run ? runSpeed : speed) * Input.GetAxis("Horizontal") * Time.deltaTime)
);
}
}
void Jump()
{
@ -127,7 +129,11 @@ public class PlayerManager : MonoBehaviour
{
if (rigidBody.velocity.y <= 1 && onGround)
{
rigidBody.AddForce(transform.up * jump * 10 * Time.deltaTime, ForceMode.VelocityChange);
rigidBody.AddForce(
(transform.right * (run ? runSpeed : speed) * 5 * Input.GetAxis("Horizontal") * Time.deltaTime) +
(transform.up * jump * 10 * Time.deltaTime),
ForceMode.VelocityChange
);
}
}
}