added upwards force on jumpPad

This commit is contained in:
Glence 2023-03-24 21:28:33 +08:00
parent 33ba73c298
commit 6ce807b878
2 changed files with 16 additions and 2 deletions

View File

@ -5,7 +5,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: -4.64838362, y: 2.94342947, z: 0.209690213} Translate: {x: -4.64838362, y: 2.94342947, z: 0.209690213}
Rotate: {x: 4.70589209, y: 2.37206268, z: 7.50559092} Rotate: {x: 0.5, y: 0.5, z: -2.5}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Light Component: Light Component:
@ -3694,6 +3694,7 @@
Enabled: true Enabled: true
scaleYMaxSize: 2 scaleYMaxSize: 2
scaleDuration: 0.25 scaleDuration: 0.25
itemUpwardForce: 6
- EID: 172 - EID: 172
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3725,6 +3726,7 @@
Enabled: true Enabled: true
scaleYMaxSize: 2 scaleYMaxSize: 2
scaleDuration: 0.25 scaleDuration: 0.25
itemUpwardForce: 6
- EID: 173 - EID: 173
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3756,6 +3758,7 @@
Enabled: true Enabled: true
scaleYMaxSize: 2 scaleYMaxSize: 2
scaleDuration: 0.25 scaleDuration: 0.25
itemUpwardForce: 6
- EID: 174 - EID: 174
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3787,6 +3790,7 @@
Enabled: true Enabled: true
scaleYMaxSize: 2 scaleYMaxSize: 2
scaleDuration: 0.25 scaleDuration: 0.25
itemUpwardForce: 6
- EID: 176 - EID: 176
Name: KitchenetteCounter Name: KitchenetteCounter
IsActive: true IsActive: true
@ -12625,7 +12629,7 @@
NumberOfChildren: 8 NumberOfChildren: 8
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: -3} Translate: {x: 0, y: -0.976091027, z: -1.69895518}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true

View File

@ -12,6 +12,7 @@ public class JumpPad : Script
public float scaleDuration = 0.25f; public float scaleDuration = 0.25f;
private bool landed = false; private bool landed = false;
private bool scaleUpDone = false; private bool scaleUpDone = false;
public float itemUpwardForce = 6.0f;
[NonSerialized] [NonSerialized]
private TweenThread scaleYUp; private TweenThread scaleYUp;
@ -73,6 +74,15 @@ public class JumpPad : Script
scaleYUp.Reset(); scaleYUp.Reset();
scaleXZUp.Reset(); scaleXZUp.Reset();
} }
else if (info.GameObject.GetComponent<RigidBody>())
{
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
info.GameObject.GetComponent<RigidBody>().AddForce(new Vector3(0, itemUpwardForce, 0));
landed = true;
scaleYUp.Reset();
scaleXZUp.Reset();
}
} }
} }