disable movement when pop out is in place

This commit is contained in:
Glence 2023-03-01 00:51:57 +08:00
parent 4e56061ebe
commit ab92d56cf0
8 changed files with 102 additions and 73 deletions

View File

@ -4530,7 +4530,7 @@
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -4581,7 +4581,7 @@
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -4632,7 +4632,7 @@
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -5090,7 +5090,7 @@
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: true Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: true
Freeze Rotation Y: true Freeze Rotation Y: true
@ -5124,6 +5124,8 @@
lightMultiper: 0.75 lightMultiper: 0.75
mediumMultiper: 0.5 mediumMultiper: 0.5
heavyMultiper: 0.25 heavyMultiper: 0.25
silhouettePlayer: 462
silhouetteBag: 465
- Type: PickAndThrow - Type: PickAndThrow
Enabled: true Enabled: true
throwForce: [8, 10, 8] throwForce: [8, 10, 8]
@ -5131,8 +5133,6 @@
delayTimer: 1 delayTimer: 1
aimingLength: 0.899999976 aimingLength: 0.899999976
throwItem: false throwItem: false
silhouettePlayer: 462
silhouetteBag: 465
rayDistance: 0.5 rayDistance: 0.5
rayHeight: 0.100000001 rayHeight: 0.100000001
aimingFOV: 50 aimingFOV: 50

View File

@ -2321,7 +2321,7 @@
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: true Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: true
Freeze Rotation Y: true Freeze Rotation Y: true
@ -2355,6 +2355,8 @@
lightMultiper: 0.899999976 lightMultiper: 0.899999976
mediumMultiper: 0.699999988 mediumMultiper: 0.699999988
heavyMultiper: 0.5 heavyMultiper: 0.5
silhouettePlayer: 462
silhouetteBag: 465
- Type: PickAndThrow - Type: PickAndThrow
Enabled: true Enabled: true
throwForce: [10, 8, 10] throwForce: [10, 8, 10]
@ -2362,8 +2364,6 @@
delayTimer: 1 delayTimer: 1
aimingLength: 1 aimingLength: 1
throwItem: false throwItem: false
silhouettePlayer: 462
silhouetteBag: 465
rayDistance: 0.75 rayDistance: 0.75
rayHeight: 0.100000001 rayHeight: 0.100000001
aimingFOV: 50 aimingFOV: 50
@ -4782,7 +4782,7 @@
- Type: JumpPad - Type: JumpPad
Enabled: true Enabled: true
- EID: 10 - EID: 10
Name: Canvas Name: PauseCanvas
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 3
Components: Components:
@ -13297,4 +13297,51 @@
Mesh: 136373407 Mesh: 136373407
Material: 131956078 Material: 131956078
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 174
Name: TweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
Enabled: true
- EID: 172
Name: StealFoodCanvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 173
Name: StealFoodLogo
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0, y: 0, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 127459277
IsActive: true
UI Component:
Canvas ID: 172
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.StealFoodPopUp
Enabled: true
popInDuration: 0.5
popOutDuration: 0.5
stayDuration: 1
rotationAmt: 1800
scaleAmtX: 538
scaleAmtY: 377

View File

@ -28,11 +28,6 @@ public class PickAndThrow : Script
public bool throwItem = false; public bool throwItem = false;
private Vector3 prevTargetOffSet; private Vector3 prevTargetOffSet;
public GameObject silhouettePlayer;
public Renderable silhouettePlayerRend;
public GameObject silhouetteBag;
public Renderable silhouetteBagRend;
[Tooltip("Lenght of ray")] [Tooltip("Lenght of ray")]
public float rayDistance = 1; public float rayDistance = 1;
@ -58,41 +53,17 @@ public class PickAndThrow : Script
if(!tpc) if(!tpc)
Debug.LogError("TPC EMPTY"); Debug.LogError("TPC EMPTY");
if(!silhouettePlayer)
Debug.LogError("silhouettePlayer EMPTY");
else
silhouettePlayerRend = silhouettePlayer.GetComponent<Renderable>();
if (!silhouetteBag)
Debug.LogError("silhouetteBag EMPTY");
else
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw"); AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
timer = delayTimer; timer = delayTimer;
} }
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || GameManager.Instance.stealFoodPopUp)
{ {
return; return;
} }
if (silhouettePlayerRend && silhouetteBagRend)
{
//wait for daniel
//0.00075f;
Vector3 dis = Camera.GetMainCamera().Position - GameObject.GetComponent<Transform>().LocalPosition;
float disSqr = dis.GetSqrMagnitude();
float ratio = System.Math.Clamp(1 - (disSqr / (1 + disSqr)), 0, 1.0f);
float temp = (1 - ratio) * 0.00075f;
if (temp <= 0.0006f)
temp = 0.1f;
silhouettePlayerRend.Material.SetProperty<float>("data.offset", temp);
silhouetteBagRend.Material.SetProperty<float>("data.offset", temp);
}
if (timer <= delayTimer) if (timer <= delayTimer)
timer += Time.DeltaTimeF; timer += Time.DeltaTimeF;
@ -171,7 +142,7 @@ public class PickAndThrow : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || GameManager.Instance.stealFoodPopUp)
{ {
return; return;
} }

View File

@ -17,15 +17,6 @@ public class PlayerController : Script
TOTAL TOTAL
} }
/* public enum WalkingState
{
CARRY,
AIMING,
THROW,
WALK,
TOTAL
}*/
public RigidBody rb { get; set; } public RigidBody rb { get; set; }
public Transform tranform { get; set; } public Transform tranform { get; set; }
public Camera cam { get; set; } public Camera cam { get; set; }
@ -85,6 +76,12 @@ public class PlayerController : Script
[Tooltip("How heavy item will affect player jump")] [Tooltip("How heavy item will affect player jump")]
public float heavyMultiper = 0.25f; public float heavyMultiper = 0.25f;
//silhouette=====================================================================
public GameObject silhouettePlayer;
public Renderable silhouettePlayerRend;
public GameObject silhouetteBag;
public Renderable silhouetteBagRend;
protected override void awake() protected override void awake()
{ {
//default setup //default setup
@ -119,6 +116,21 @@ public class PlayerController : Script
dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine)); dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine));
stateMachine.InitStateMachine(dictionary); stateMachine.InitStateMachine(dictionary);
if (!silhouettePlayer)
Debug.LogError("silhouettePlayer EMPTY");
else
{
silhouettePlayerRend = silhouettePlayer.GetComponent<Renderable>();
silhouettePlayerRend.Material.SetProperty<float>("data.offset", 0.1f);
}
if (!silhouetteBag)
Debug.LogError("silhouetteBag EMPTY");
else
{
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
}
} }
protected override void lateUpdate() protected override void lateUpdate()
@ -127,26 +139,23 @@ public class PlayerController : Script
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || GameManager.Instance.stealFoodPopUp)
{ {
return; return;
} }
if (delayTimer <= 1) if (silhouettePlayerRend && silhouetteBagRend)
delayTimer += Time.DeltaTimeF; {
Vector3 dis = Camera.GetMainCamera().Position - GameObject.GetComponent<Transform>().LocalPosition;
float disSqr = dis.GetSqrMagnitude();
float ratio = System.Math.Clamp(1 - (disSqr / (1 + disSqr)), 0, 1.0f);
float temp = (1 - ratio) * 0.00075f;
if (temp <= 0.0006f)
temp = 0.1f;
silhouettePlayerRend.Material.SetProperty<float>("data.offset", temp);
silhouetteBagRend.Material.SetProperty<float>("data.offset", temp);
}
if (delayTimer < 1)
{
if (tranform && respawnPoint && rb)
{
rb.LinearVelocity = Vector3.Zero;
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
}
}
else
{
rb.FreezePositionY = false;
}
//PickAndThrow check //PickAndThrow check
if (!pat) if (!pat)
{ {
@ -160,9 +169,7 @@ public class PlayerController : Script
if(!camArm) if(!camArm)
camArm = GetComponentInChildren<CameraArm>(); camArm = GetComponentInChildren<CameraArm>();
//tempFix
if (tranform)
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
GotCaught(); GotCaught();
Rotation(); Rotation();
@ -178,7 +185,7 @@ public class PlayerController : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || GameManager.Instance.stealFoodPopUp)
{ {
return; return;
} }
@ -336,7 +343,7 @@ public class PlayerController : Script
if (isMoveKeyPress && tranform && !isAiming) if (isMoveKeyPress && tranform && !isAiming)
{ {
Quaternion currentRotation = tranform.LocalRotation; Quaternion currentRotation = tranform.LocalRotation;
Quaternion targetRotation = Quaternion.LookRotation(new Vector3(axisMove.x, 0.0f, axisMove.y), new Vector3(0.0f, 1.0f, 0.0f)); Quaternion targetRotation = Quaternion.LookRotation(new Vector3(axisMove.x, 0.0f, axisMove.y), Vector3.Up);
tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime); tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime);
} }
else if (camArm && tranform && isAiming) else if (camArm && tranform && isAiming)

View File

@ -41,7 +41,7 @@ namespace SHADE_Scripting
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || GameManager.Instance.stealFoodPopUp)
{ {
return; return;
} }

View File

@ -40,6 +40,7 @@ public class GameManager : Script
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
public bool GamePause { get; set; } public bool GamePause { get; set; }
public bool stealFoodPopUp { get; set; }
public bool itemShatter { get; set; } public bool itemShatter { get; set; }
@ -58,6 +59,8 @@ public class GameManager : Script
currMultiplierDuration = 0; currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration); fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
itemShatter = false; itemShatter = false;
GamePause = false;
stealFoodPopUp = true;
AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win"); AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win");
AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose"); AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose");

View File

@ -86,7 +86,7 @@ public class PauseMenu : Script
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause) if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause && !GameManager.Instance.stealFoodPopUp)
{ {
GameManager.Instance.GamePause = true; GameManager.Instance.GamePause = true;
AudioHandler.pauseAllSounds(true); AudioHandler.pauseAllSounds(true);

View File

@ -79,6 +79,7 @@ namespace SHADE_Scripting.UI
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted()) if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
{ {
GameObject.SetActive(false); GameObject.SetActive(false);
GameManager.Instance.stealFoodPopUp = false;
} }
} }
} }