Bug fixes for textrenderable and sterilization, added base for game pause #354

Merged
glencelow merged 5 commits from PlayerController into main 2023-02-21 15:49:10 +08:00
4 changed files with 69 additions and 7 deletions
Showing only changes of commit dfe4d047e9 - Show all commits

View File

@ -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
@ -10525,4 +10527,29 @@
eyeOffset: [0, 1.64999998, 0] eyeOffset: [0, 1.64999998, 0]
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

View File

@ -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;
} }
} }

View File

@ -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;
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_JumpPad
ID: 167326885
Type: 9