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

View File

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

View File

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

View File

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

View File

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