Repair particle and jump

This commit is contained in:
haitem 2022-01-29 02:01:10 +01:00
parent ccd4d70b1e
commit 4a9967baa9
3 changed files with 14 additions and 4821 deletions

View File

@ -5000,6 +5000,7 @@ MonoBehaviour:
rotationX: 0
jump: {x: 0, y: 2, z: 0}
jumpForce: 2
isRunning: 0
--- !u!1 &3244356567246256140
GameObject:
m_ObjectHideFlags: 0
@ -5569,7 +5570,7 @@ ParticleSystem:
startSpeed:
serializedVersion: 2
minMaxState: 0
scalar: 25
scalar: 15
minScalar: 5
maxCurve:
serializedVersion: 2
@ -6062,14 +6063,14 @@ ParticleSystem:
serializedVersion: 6
enabled: 1
type: 4
angle: 8.11
angle: 16.79864
length: 5
boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 0.16
radiusThickness: 1
donutRadius: 0.2
m_Position: {x: 0.00000039157, y: 0, z: 4.4790387}
m_Rotation: {x: -0, y: 180, z: 0}
m_Scale: {x: 1, y: 1, z: 0.40484464}
m_Scale: {x: 1, y: 1, z: 1}
placementMode: 0
m_MeshMaterialIndex: 0
m_MeshNormalOffset: 0
@ -6148,7 +6149,7 @@ ParticleSystem:
sphericalDirectionAmount: 0
randomPositionAmount: 0
radius:
value: 1.72
value: 1.9294227
mode: 0
spread: 0
speed:
@ -10161,7 +10162,7 @@ ParticleSystemRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10301, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: c0667a1cdf6cc7340beaefe094996e44, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ public class PlayerController : MonoBehaviour
public Vector3 jump;
public float jumpForce = 2.0f;
private bool isGoundet = false;
public bool isRunning = false;
void Start()
{
@ -38,22 +39,22 @@ public class PlayerController : MonoBehaviour
playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0);
bool isRunning = Input.GetKey(KeyCode.LeftShift);
isRunning = Input.GetKey(KeyCode.LeftShift);
float curSpeedX = canMove ? (isRunning ? runningSpeed : walkSpeed) * Input.GetAxis("Vertical") : 0;
float curSpeedY = canMove ? (isRunning ? runningSpeed : walkSpeed) * Input.GetAxis("Horizontal") : 0;
moveDirection = (transform.forward * curSpeedX * Time.deltaTime) + (transform.right * curSpeedY * Time.deltaTime);
if (isRunning && !runningParticles.isPlaying)
if (isRunning && !runningParticles.isPlaying && Input.GetKey(KeyCode.W))
{
runningParticles.Play();
runningParticles.Play(true);
}
else if (!isRunning && runningParticles.isPlaying)
else if ((!isRunning && runningParticles.isPlaying) || !Input.GetKey(KeyCode.W))
{
runningParticles.Stop();
runningParticles.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
}
if (Input.GetKeyUp(KeyCode.Space) && isGoundet)
if (Input.GetKeyDown(KeyCode.Space) && isGoundet)
{
Debug.Log("Jump");
rb.AddForce(transform.up * jumpSpeed * 500 * Time.deltaTime, ForceMode.Impulse);