Scene Changes and bug fixes #431

Merged
glencelow merged 9 commits from PlayerController into main 2023-03-20 17:42:41 +08:00
6 changed files with 57 additions and 49 deletions
Showing only changes of commit 7510f8aa5b - Show all commits

View File

@ -7552,7 +7552,7 @@
moveForce: 50 moveForce: 50
sprintMultiplier: 1.5 sprintMultiplier: 1.5
rotationFactorPerFrame: 5 rotationFactorPerFrame: 5
maxJumpHeight: 3 maxJumpHeight: 2
maxJumpTime: 1 maxJumpTime: 1
fallMultipler: 2 fallMultipler: 2
jumpPadMultiplayer: 1.20000005 jumpPadMultiplayer: 1.20000005
@ -7573,8 +7573,9 @@
throwItem: false throwItem: false
rayDistance: 0.75 rayDistance: 0.75
rayHeight: 0.100000001 rayHeight: 0.100000001
tweenPickUpDuration: 0.5 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15
- Type: StateMachine - Type: StateMachine
Enabled: true Enabled: true
currentStateName: Idle State currentStateName: Idle State
@ -7628,7 +7629,7 @@
Camera Arm Component: Camera Arm Component:
Arm Pitch: 45 Arm Pitch: 45
Arm Yaw: -90 Arm Yaw: -90
Arm Length: 3 Arm Length: 2
Look At Camera Origin: true Look At Camera Origin: true
Target Offset: {x: 0, y: 0.75, z: 0} Target Offset: {x: 0, y: 0.75, z: 0}
Camera Collision: true Camera Collision: true
@ -7636,7 +7637,7 @@
Scripts: Scripts:
- Type: SHADE_Scripting.ThirdPersonCamera - Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true Enabled: true
armLength: 3 armLength: 2
turnSpeedPitch: 0.200000003 turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006 turnSpeedYaw: 0.400000006
inverseXControls: true inverseXControls: true

View File

@ -3102,7 +3102,7 @@
moveForce: 50 moveForce: 50
sprintMultiplier: 1.5 sprintMultiplier: 1.5
rotationFactorPerFrame: 5 rotationFactorPerFrame: 5
maxJumpHeight: 3 maxJumpHeight: 2
maxJumpTime: 1 maxJumpTime: 1
fallMultipler: 2 fallMultipler: 2
jumpPadMultiplayer: 1.20000005 jumpPadMultiplayer: 1.20000005
@ -3123,8 +3123,9 @@
throwItem: false throwItem: false
rayDistance: 0.75 rayDistance: 0.75
rayHeight: 0.100000001 rayHeight: 0.100000001
tweenPickUpDuration: 0.5 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15
- Type: PlayerAnimations - Type: PlayerAnimations
Enabled: true Enabled: true
playerIdleClip: 227450439 playerIdleClip: 227450439
@ -3174,7 +3175,7 @@
Camera Arm Component: Camera Arm Component:
Arm Pitch: 20 Arm Pitch: 20
Arm Yaw: 0 Arm Yaw: 0
Arm Length: 3 Arm Length: 2
Look At Camera Origin: true Look At Camera Origin: true
Target Offset: {x: 0, y: 0.75, z: 0} Target Offset: {x: 0, y: 0.75, z: 0}
Camera Collision: true Camera Collision: true
@ -3182,7 +3183,7 @@
Scripts: Scripts:
- Type: SHADE_Scripting.ThirdPersonCamera - Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true Enabled: true
armLength: 3 armLength: 2
turnSpeedPitch: 0.200000003 turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006 turnSpeedYaw: 0.400000006
inverseXControls: true inverseXControls: true
@ -5512,7 +5513,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: -1.92464328} Translate: {x: 0, y: 0, z: -2.93461704}
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

@ -8544,7 +8544,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2.16695547, y: 0.0687829852, z: 0.574704885} Translate: {x: 0.892607987, y: 0, z: 1.50168896}
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
@ -12050,10 +12050,10 @@
moveForce: 50 moveForce: 50
sprintMultiplier: 1.5 sprintMultiplier: 1.5
rotationFactorPerFrame: 5 rotationFactorPerFrame: 5
maxJumpHeight: 3 maxJumpHeight: 2
maxJumpTime: 1 maxJumpTime: 1
fallMultipler: 2 fallMultipler: 2
jumpPadMultiplayer: 1.39999998 jumpPadMultiplayer: 1.75
dropDuration: 0.5 dropDuration: 0.5
jumpPadFallMultipler: 0.75 jumpPadFallMultipler: 0.75
jumpPadMaxMoveVel: 1 jumpPadMaxMoveVel: 1
@ -12071,8 +12071,9 @@
throwItem: false throwItem: false
rayDistance: 0.75 rayDistance: 0.75
rayHeight: 0.100000001 rayHeight: 0.100000001
tweenPickUpDuration: 0.5 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15
- Type: PlayerAnimations - Type: PlayerAnimations
Enabled: true Enabled: true
playerIdleClip: 227450439 playerIdleClip: 227450439
@ -12122,7 +12123,7 @@
Camera Arm Component: Camera Arm Component:
Arm Pitch: 40 Arm Pitch: 40
Arm Yaw: 0 Arm Yaw: 0
Arm Length: 3 Arm Length: 2
Look At Camera Origin: true Look At Camera Origin: true
Target Offset: {x: 0, y: 0.75, z: 0} Target Offset: {x: 0, y: 0.75, z: 0}
Camera Collision: true Camera Collision: true
@ -12130,7 +12131,7 @@
Scripts: Scripts:
- Type: SHADE_Scripting.ThirdPersonCamera - Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true Enabled: true
armLength: 3 armLength: 2
turnSpeedPitch: 0.200000003 turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006 turnSpeedYaw: 0.400000006
inverseXControls: true inverseXControls: true

View File

@ -957,7 +957,7 @@
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 1 Slider Value: 1
Min Value: 45 Min Value: 30
Max Value: 120 Max Value: 120
IsActive: true IsActive: true
UI Component: UI Component:

View File

@ -39,14 +39,17 @@ public class PickAndThrow : Script
[NonSerialized] [NonSerialized]
private TweenThreadVec3 offSetCamTween; private TweenThreadVec3 offSetCamTween;
[NonSerialized] [NonSerialized]
private TweenThreadVec3 foodTween; private TweenThread FOVTween;
public float lerpPickUpDuration = 0.75f;
private float pickUptimer = 0.0f;
private bool foodHoldReach = false;
public float tweenPickUpDuration = 0.5f;
public float tweenAimDuration = 0.3f; public float tweenAimDuration = 0.3f;
private bool createFoodTween = true;
private bool createCamTween = true;
private bool camTweenUpdate = false; private bool camTweenUpdate = false;
public float aimingFOV = 15.0f;
protected override void awake() protected override void awake()
{ {
pc = GetScript<PlayerController>(); pc = GetScript<PlayerController>();
@ -86,8 +89,9 @@ public class PickAndThrow : Script
{ {
pc.camArm.TargetOffset = offSetCamTween.GetValue(); pc.camArm.TargetOffset = offSetCamTween.GetValue();
pc.camArm.ArmLength = camArmTween.GetValue(); pc.camArm.ArmLength = camArmTween.GetValue();
pc.cam.FOV = FOVTween.GetValue();
if (offSetCamTween.IsCompleted() && camArmTween.IsCompleted()) if (offSetCamTween.IsCompleted() && camArmTween.IsCompleted() && FOVTween.IsCompleted())
camTweenUpdate = false; camTweenUpdate = false;
} }
@ -105,10 +109,7 @@ public class PickAndThrow : Script
if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton)) if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{ {
pc.isAiming = true; pc.isAiming = true;
TweenAimCamArm(); TweenAimCamArm(true);
//pc.camArm.TargetOffset = cameraArmOffSet;
//pc.camArm.ArmLength = aimingLength;
pc.cam.FOV = Settings.cameraFOV + 5;
} }
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
@ -117,12 +118,9 @@ public class PickAndThrow : Script
itemRidigBody.IsGravityEnabled = true; itemRidigBody.IsGravityEnabled = true;
itemCollider.GetCollisionShape(0).IsTrigger = false; itemCollider.GetCollisionShape(0).IsTrigger = false;
pc.isAiming = false; pc.isAiming = false;
createCamTween = true; TweenAimCamArm(false);
pc.camArm.TargetOffset = prevTargetOffSet;
pc.camArm.ArmLength = tpc.armLength;
pc.cam.FOV = Settings.cameraFOV;
pc.holdItem = false; pc.holdItem = false;
createFoodTween = true; foodHoldReach = false;
inRange = false; inRange = false;
throwItem = true; throwItem = true;
PlayThrowAnimation(); PlayThrowAnimation();
@ -132,7 +130,7 @@ public class PickAndThrow : Script
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && !pc.isAiming) if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && !pc.isAiming)
{ {
pc.holdItem = false; pc.holdItem = false;
createFoodTween = true; foodHoldReach = false;
inRange = false; inRange = false;
itemRidigBody.IsGravityEnabled = true; itemRidigBody.IsGravityEnabled = true;
itemCollider.GetCollisionShape(0).IsTrigger = false; itemCollider.GetCollisionShape(0).IsTrigger = false;
@ -143,10 +141,7 @@ public class PickAndThrow : Script
{ {
pc.isAiming = false; pc.isAiming = false;
pc.cam.FOV = Settings.cameraFOV; pc.cam.FOV = Settings.cameraFOV;
createCamTween = true; TweenAimCamArm(false);
//TweenAimCamArm(false);
pc.camArm.TargetOffset = prevTargetOffSet;
pc.camArm.ArmLength = tpc.armLength;
} }
} }
@ -430,28 +425,38 @@ public class PickAndThrow : Script
private void TweenFood() private void TweenFood()
{ {
if (createFoodTween)
if (!foodHoldReach)
{ {
foodTween = TweenManager.CreateTweenThreadVec3(tweenPickUpDuration, itemTransform.LocalPosition, raccoonHoldLocation.GlobalPosition, EASING_METHOD.EASE_IN_SINE); pickUptimer += Time.DeltaTimeF;
createFoodTween = false; itemTransform.LocalPosition = Vector3.Lerp(itemTransform.LocalPosition, raccoonHoldLocation.GlobalPosition, pickUptimer / lerpPickUpDuration);
} }
else
itemTransform.LocalPosition = foodTween.GetValue();
if (foodTween.IsCompleted())
itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition; itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition;
if (pickUptimer >= lerpPickUpDuration)
{
foodHoldReach = true;
pickUptimer = 0.0f;
}
} }
private void TweenAimCamArm() private void TweenAimCamArm(bool aim)
{ {
if (createCamTween)
if (aim)
{ {
offSetCamTween = TweenManager.CreateTweenThreadVec3(tweenAimDuration, pc.camArm.TargetOffset, cameraArmOffSet, EASING_METHOD.EASE_IN_SINE); offSetCamTween = TweenManager.CreateTweenThreadVec3(tweenAimDuration, pc.camArm.TargetOffset, cameraArmOffSet, EASING_METHOD.EASE_IN_SINE);
camArmTween = TweenManager.CreateTweenThread(tweenPickUpDuration, pc.camArm.ArmLength, aimingLength, EASING_METHOD.EASE_IN_SINE); camArmTween = TweenManager.CreateTweenThread(tweenAimDuration, pc.camArm.ArmLength, aimingLength, EASING_METHOD.EASE_IN_SINE);
camTweenUpdate = true; FOVTween = TweenManager.CreateTweenThread(tweenAimDuration, pc.cam.FOV, Settings.cameraFOV + aimingFOV, EASING_METHOD.EASE_IN_SINE);
Debug.Log($"camera arm lenght: {pc.camArm.ArmLength} aimingLength:{aimingLength} ");
} }
else
{
offSetCamTween = TweenManager.CreateTweenThreadVec3(tweenAimDuration, pc.camArm.TargetOffset, prevTargetOffSet, EASING_METHOD.EASE_IN_SINE);
camArmTween = TweenManager.CreateTweenThread(tweenAimDuration, pc.camArm.ArmLength, tpc.armLength, EASING_METHOD.EASE_IN_SINE);
FOVTween = TweenManager.CreateTweenThread(tweenAimDuration, pc.cam.FOV, Settings.cameraFOV , EASING_METHOD.EASE_IN_SINE);
}
camTweenUpdate = true;
} }

View File

@ -8,7 +8,7 @@ static public class Settings
{ {
static public float cameraSensitivity = 100.0f; static public float cameraSensitivity = 100.0f;
static public float cameraFOV = 45.0f; static public float cameraFOV = 60.0f;
static public float masterVolume = 100.0f; static public float masterVolume = 100.0f;
static public float sfxVolume = 100.0f; static public float sfxVolume = 100.0f;