added a jumppad to the game
This commit is contained in:
parent
7afbc33861
commit
dfe4d047e9
|
@ -9671,6 +9671,7 @@
|
||||||
maxJumpHeight: 2
|
maxJumpHeight: 2
|
||||||
maxJumpTime: 0.75
|
maxJumpTime: 0.75
|
||||||
fallMultipler: 3
|
fallMultipler: 3
|
||||||
|
jumpPadMultiplayer: 1.20000005
|
||||||
lightMultiper: 0.75
|
lightMultiper: 0.75
|
||||||
mediumMultiper: 0.5
|
mediumMultiper: 0.5
|
||||||
heavyMultiper: 0.25
|
heavyMultiper: 0.25
|
||||||
|
@ -9682,6 +9683,7 @@
|
||||||
aimingLength: 1
|
aimingLength: 1
|
||||||
throwItem: false
|
throwItem: false
|
||||||
rayDistance: 0.75
|
rayDistance: 0.75
|
||||||
|
rayHeight: 0.100000001
|
||||||
- EID: 3
|
- EID: 3
|
||||||
Name: HoldingPoint
|
Name: HoldingPoint
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -10483,11 +10485,11 @@
|
||||||
Translate: {x: 2.70000005, y: 0.100000001, z: -2}
|
Translate: {x: 2.70000005, y: 0.100000001, z: -2}
|
||||||
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: false
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 140697366
|
Mesh: 140697366
|
||||||
Material: 129495479
|
Material: 129495479
|
||||||
IsActive: true
|
IsActive: false
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Drag: 0.00999999978
|
Drag: 0.00999999978
|
||||||
|
@ -10501,7 +10503,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: false
|
Freeze Rotation Y: false
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -10513,7 +10515,7 @@
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: Homeowner1
|
- Type: Homeowner1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -10526,3 +10528,28 @@
|
||||||
distanceToCapture: 0.5
|
distanceToCapture: 0.5
|
||||||
captureTime: 0.5
|
captureTime: 0.5
|
||||||
footstepSFXIntervalMultiplier: 0.5
|
footstepSFXIntervalMultiplier: 0.5
|
||||||
|
- EID: 16
|
||||||
|
Name: Default
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 3.43332767, y: 0.149463654, z: 6.84711409}
|
||||||
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
|
Collider Component:
|
||||||
|
Colliders:
|
||||||
|
- Is Trigger: false
|
||||||
|
Collision Tag: 0
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 1, y: 0.25, z: 1}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: 0, y: 0, z: 0}
|
||||||
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
|
IsActive: true
|
||||||
|
Scripts:
|
||||||
|
- Type: JumpPad
|
||||||
|
Enabled: true
|
|
@ -65,7 +65,7 @@ public class PlayerController : Script
|
||||||
//Jumping vars==================================================================
|
//Jumping vars==================================================================
|
||||||
[Tooltip("max height of the jump")]
|
[Tooltip("max height of the jump")]
|
||||||
public float maxJumpHeight = 1.0f;
|
public float maxJumpHeight = 1.0f;
|
||||||
[Tooltip("max amt of time it will take for the jump")]
|
[Tooltip("max amount of time it will take for the jump")]
|
||||||
public float maxJumpTime = 0.5f;
|
public float maxJumpTime = 0.5f;
|
||||||
[Tooltip("increase gravity when falling")]
|
[Tooltip("increase gravity when falling")]
|
||||||
public float fallMultipler = 3.0f;
|
public float fallMultipler = 3.0f;
|
||||||
|
@ -73,6 +73,9 @@ public class PlayerController : Script
|
||||||
private bool isGrounded = true;
|
private bool isGrounded = true;
|
||||||
private float gravity = -9.8f;
|
private float gravity = -9.8f;
|
||||||
private float groundGravity = -0.5f;
|
private float groundGravity = -0.5f;
|
||||||
|
public bool landedOnJumpPad { get; set; }
|
||||||
|
[Tooltip("multiply height on Jump Pad ")]
|
||||||
|
public float jumpPadMultiplayer = 2.0f;
|
||||||
|
|
||||||
//ItemMultipler==================================================================
|
//ItemMultipler==================================================================
|
||||||
[Tooltip("How light item will affect player jump")]
|
[Tooltip("How light item will affect player jump")]
|
||||||
|
@ -88,6 +91,7 @@ public class PlayerController : Script
|
||||||
isMoveKeyPress = false;
|
isMoveKeyPress = false;
|
||||||
holdItem = false;
|
holdItem = false;
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
|
landedOnJumpPad = false;
|
||||||
|
|
||||||
//Jump setup
|
//Jump setup
|
||||||
float timeToApex = maxJumpTime / 2;
|
float timeToApex = maxJumpTime / 2;
|
||||||
|
@ -287,7 +291,7 @@ public class PlayerController : Script
|
||||||
{
|
{
|
||||||
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Space) && isGrounded && rb != null)
|
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null)
|
||||||
{
|
{
|
||||||
currentState = RaccoonStates.JUMP;
|
currentState = RaccoonStates.JUMP;
|
||||||
Vector3 v = rb.LinearVelocity;
|
Vector3 v = rb.LinearVelocity;
|
||||||
|
@ -302,6 +306,12 @@ public class PlayerController : Script
|
||||||
if (item != null && item.currCategory == ItemCategory.HEAVY)
|
if (item != null && item.currCategory == ItemCategory.HEAVY)
|
||||||
v.y *= heavyMultiper;
|
v.y *= heavyMultiper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (landedOnJumpPad)
|
||||||
|
{
|
||||||
|
v.y *= jumpPadMultiplayer;
|
||||||
|
landedOnJumpPad = false;
|
||||||
|
}
|
||||||
rb.LinearVelocity = v;
|
rb.LinearVelocity = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public class JumpPad : Script
|
||||||
|
{
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onCollisionEnter(CollisionInfo info)
|
||||||
|
{
|
||||||
|
if (info.GameObject.GetScript<PlayerController>() && info.GameObject.GetScript<PlayerController>().currentState == PlayerController.RaccoonStates.FALLING)
|
||||||
|
{
|
||||||
|
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_JumpPad
|
||||||
|
ID: 167326885
|
||||||
|
Type: 9
|
Loading…
Reference in New Issue