Added Homeowner VO and small UI changes

This commit is contained in:
maverickdgg 2023-04-01 15:36:02 +08:00
parent fada41174d
commit 2e20b295b5
16 changed files with 194 additions and 73 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9256,7 +9256,7 @@
Enabled: true Enabled: true
player: 65775 player: 65775
range: 5 range: 5
angle: 30 angle: 45
angleBetween: 0 angleBetween: 0
distance: 0 distance: 0
heightLimit: 1 heightLimit: 1
@ -9298,7 +9298,7 @@
- EID: 627 - EID: 627
Name: AttackHitbox Name: AttackHitbox
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254} Translate: {x: 0, y: -0.10252738, z: -2.20271254}
@ -9322,6 +9322,17 @@
Enabled: true Enabled: true
aiGO: 65771 aiGO: 65771
raccoonFound: false raccoonFound: false
- EID: 609
Name: NetPosition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.329473495}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 131271 - EID: 131271
Name: Gameplay Canvas Name: Gameplay Canvas
IsActive: true IsActive: true

View File

@ -3886,6 +3886,7 @@
Score: 0 Score: 0
timer: 200 timer: 200
scoreText: 237 scoreText: 237
scoreTextBG: 568
timeText: 131278 timeText: 131278
minusTimerText: 131211 minusTimerText: 131211
Results: 624 Results: 624
@ -6073,7 +6074,7 @@
Enabled: true Enabled: true
player: 2 player: 2
range: 5 range: 5
angle: 30 angle: 45
angleBetween: 0 angleBetween: 0
distance: 0 distance: 0
heightLimit: 1 heightLimit: 1
@ -17338,7 +17339,12 @@
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: SHADE_Scripting.UI.SingleScaleBounce
Enabled: true
durationUp: 0.150000006
durationDown: 0.300000012
scaleSize: 1.20000005
- EID: 66150 - EID: 66150
Name: ParticlesDeco Name: ParticlesDeco
IsActive: true IsActive: true
@ -17450,11 +17456,11 @@
- EID: 627 - EID: 627
Name: AttackHitbox Name: AttackHitbox
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254} Translate: {x: 0, y: -0.10252738, z: -2.20000005}
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
Collider Component: Collider Component:
@ -17474,6 +17480,17 @@
Enabled: true Enabled: true
aiGO: 158 aiGO: 158
raccoonFound: false raccoonFound: false
- EID: 609
Name: NetPosition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.329473495}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 624 - EID: 624
Name: Result Canvas Name: Result Canvas
IsActive: false IsActive: false

View File

@ -15560,7 +15560,7 @@
Enabled: true Enabled: true
player: 65775 player: 65775
range: 5 range: 5
angle: 30 angle: 45
angleBetween: 0 angleBetween: 0
distance: 0 distance: 0
heightLimit: 1 heightLimit: 1
@ -15602,7 +15602,7 @@
- EID: 627 - EID: 627
Name: AttackHitbox Name: AttackHitbox
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254} Translate: {x: 0, y: -0.10252738, z: -2.20271254}
@ -15626,6 +15626,17 @@
Enabled: true Enabled: true
aiGO: 66078 aiGO: 66078
raccoonFound: false raccoonFound: false
- EID: 230
Name: NetPosition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.329473495}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 66062 - EID: 66062
Name: Gameplay Canvas Name: Gameplay Canvas
IsActive: true IsActive: true

View File

@ -32,6 +32,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
public AnimationClipAsset atkHoldAnim; public AnimationClipAsset atkHoldAnim;
public AnimationClipAsset atkSeqAnim; public AnimationClipAsset atkSeqAnim;
private Vector3 startPos; private Vector3 startPos;
public bool atk { get; set; } public bool atk { get; set; }
@ -75,8 +78,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
} }
AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
SHADE.Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["HO_footsteps"], GameObject.EntityId);
patrolPointPool = patrolPointParent.GetComponentsInChildren<Transform>(); AudioHandler.audioClipHandlers["HO_bark"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_bark");
SHADE.Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["HO_bark"], GameObject.EntityId);
patrolPointPool = patrolPointParent.GetComponentsInChildren<Transform>();
pppList = patrolPointPool.ToList<Transform>(); pppList = patrolPointPool.ToList<Transform>();
transform = GetComponent<Transform>(); transform = GetComponent<Transform>();

View File

@ -12,12 +12,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
const float alertDuration = 16.0f / 30.0f + 1.0f; const float alertDuration = 16.0f / 30.0f + 1.0f;
float alertTimer = alertDuration; float alertTimer = alertDuration;
bool firstDetection;
public AlertState(StateMachine machine) : base(machine) public AlertState(StateMachine machine) : base(machine)
{ {
stateName = "Alert"; stateName = "Alert";
AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected"); AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected");
firstDetection = true;
} }
public override void OnEnter() public override void OnEnter()
@ -28,9 +28,33 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
animator.PlayOneShot(ai.alertAnim); animator.PlayOneShot(ai.alertAnim);
} }
SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected");
AudioHandler.audioClipHandlers["raccoondetected"].Play(); if(firstDetection)
} {
SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectFirst");
AudioHandler.audioClipHandlers["HO_bark"].Play();
firstDetection = false;
}
else
{
PlayerController pc = ai.player.GetScript<PlayerController>();
if (pc && pc.holdItem)
{
SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectFood");
AudioHandler.audioClipHandlers["HO_bark"].Play();
}
else
{
SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectAgain");
AudioHandler.audioClipHandlers["HO_bark"].Play();
}
}
}
public override void OnExit() public override void OnExit()
{ {
animator.Stop(); animator.Stop();

View File

@ -23,6 +23,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
bool seq = false; bool seq = false;
bool end = false; bool end = false;
bool raccoonCaught = true;
public AttackState(StateMachine machine) : base(machine) public AttackState(StateMachine machine) : base(machine)
{ {
@ -40,6 +42,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
end = false; end = false;
timer = windupTime; timer = windupTime;
raccoonCaught = false;
RotateToVelocity rotate = machine.GetScript<RotateToVelocity>(); RotateToVelocity rotate = machine.GetScript<RotateToVelocity>();
if (rotate) if (rotate)
rotate.active = false; rotate.active = false;
@ -86,11 +90,18 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
if (ai.hitboxScript.raccoonFound) if (ai.hitboxScript.raccoonFound)
{ {
machine.SetState(typeof(CaughtRaccoonState)); raccoonCaught = true;
} Transform pcTransform = ai.player.GetComponent<Transform>();
Transform netTransform = ai.attackHitbox.GetComponentInChildren<Transform>();
if (pcTransform && netTransform)
{
pcTransform.GlobalPosition = netTransform.GlobalPosition;
}
}
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if (windUp) if (windUp)
{ {
if (timer <= 0.0f) if (timer <= 0.0f)
@ -137,15 +148,24 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
if (timer <= 0.0f) if (timer <= 0.0f)
{ {
end = false; end = false;
AILineOfSight los = ai.GetScript<AILineOfSight>();
if (los && los.withinSight) if(raccoonCaught)
{ {
machine.SetState(typeof(ChaseState)); machine.SetState(typeof(CaughtRaccoonState));
} }
else else
{ {
machine.SetState(typeof(TimeoutState)); AILineOfSight los = ai.GetScript<AILineOfSight>();
} if (los && los.withinSight)
{
machine.SetState(typeof(ChaseState));
}
else
{
machine.SetState(typeof(TimeoutState));
}
}
} }

View File

@ -25,6 +25,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
pc = ai.hitboxScript.pc; pc = ai.hitboxScript.pc;
timer = ai.caughtDuration; timer = ai.caughtDuration;
if (pc)
pc.Caught();
} }
@ -40,14 +42,22 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
if (pc) if (pc)
{ {
pc.currentState = RaccoonStates.CAUGHT;
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) pc.Reset();
pc.stateMachine.SetState(typeof(PlayerCaughtState));
pc.GotCaught();
} }
ai.Reset(); ai.Reset();
} }
else
{
Transform pcTransform = pc.GetComponent<Transform>();
Transform netTransform = ai.attackHitbox.GetComponentInChildren<Transform>();
if (pcTransform && netTransform)
{
pcTransform.GlobalPosition = netTransform.GlobalPosition;
}
}
} }

View File

@ -22,10 +22,16 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
float footStepInterval = 12.0f / 30.0f; float footStepInterval = 12.0f / 30.0f;
float footStepTimer = 0.0f; float footStepTimer = 0.0f;
float barkTimer = 0.0f;
Random rand;
public ChaseState(StateMachine machine): base(machine) public ChaseState(StateMachine machine): base(machine)
{ {
stateName = "Chase"; stateName = "Chase";
rand = new Random();
} }
public override void OnEnter() public override void OnEnter()
@ -42,6 +48,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
footStepTimer = footStepInterval * 0.5f; footStepTimer = footStepInterval * 0.5f;
barkTimer = (float)rand.Next(0, 2) + (float)rand.NextDouble();
} }
public override void OnExit() public override void OnExit()
@ -57,11 +66,25 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
rotate.lookAround = false; rotate.lookAround = false;
} }
} }
public override void update() public override void update()
{ {
Navigation nav = machine.GetComponent<Navigation>(); barkTimer -= Time.DeltaTimeF;
if(barkTimer <= 0.0f)
{
barkTimer = (float)rand.Next(4, 6) + (float)rand.NextDouble();
SHADE.Audio.SetParameterWithLabel("HomeownerBark", "Chase");
AudioHandler.audioClipHandlers["HO_bark"].Play();
}
Navigation nav = machine.GetComponent<Navigation>();
AILineOfSight los = ai.GetScript<AILineOfSight>(); AILineOfSight los = ai.GetScript<AILineOfSight>();
RigidBody rigid = machine.GetComponent<RigidBody>(); RigidBody rigid = machine.GetComponent<RigidBody>();
if (los && nav) if (los && nav)

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
@ -23,7 +24,10 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
timer = 0.0f; timer = 0.0f;
animator.Play(ai.idleAnim); animator.Play(ai.idleAnim);
} SHADE.Audio.SetParameterWithLabel("HomeownerBark", "DetectLost");
AudioHandler.audioClipHandlers["HO_bark"].Play();
}
public override void update() public override void update()
{ {

View File

@ -22,7 +22,9 @@ public class PlayerController : Script
public Transform tranform { get; set; } public Transform tranform { get; set; }
public Camera cam { get; set; } public Camera cam { get; set; }
public CameraArm camArm { get; set; } public CameraArm camArm { get; set; }
private PickAndThrow pat;
[NonSerialized]
public PickAndThrow pat;
public StateMachine stateMachine { get; set; } public StateMachine stateMachine { get; set; }
public ParticleEmitter Leftsmoke { get; set; } public ParticleEmitter Leftsmoke { get; set; }
public ParticleEmitter Rightsmoke { get; set; } public ParticleEmitter Rightsmoke { get; set; }
@ -227,7 +229,7 @@ public class PlayerController : Script
} }
} }
GotCaught();
Rotation(); Rotation();
MoveKey(); MoveKey();
Sprint(); Sprint();
@ -254,6 +256,10 @@ public class PlayerController : Script
private void MoveKey() private void MoveKey()
{ {
if (currentState == RaccoonStates.CAUGHT)
return;
axisMove = Vector2.Zero; axisMove = Vector2.Zero;
if (Input.GetKey(Input.KeyCode.W)) if (Input.GetKey(Input.KeyCode.W))
{ {
@ -290,7 +296,7 @@ public class PlayerController : Script
axisMove.Normalise(); axisMove.Normalise();
isMoveKeyPress = axisMove.x != 0 || axisMove.y != 0; isMoveKeyPress = axisMove.x != 0 || axisMove.y != 0;
if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift)) if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift) && currentState != RaccoonStates.CAUGHT)
{ {
currentState = RaccoonStates.WALKING; currentState = RaccoonStates.WALKING;
@ -334,6 +340,9 @@ public class PlayerController : Script
private void Sprint() private void Sprint()
{ {
if (currentState == RaccoonStates.CAUGHT)
return;
if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded) if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded)
{ {
currentState = RaccoonStates.RUNNING; currentState = RaccoonStates.RUNNING;
@ -505,41 +514,10 @@ public class PlayerController : Script
} }
} }
public void GotCaught()
{
if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint)
{
AudioHandler.audioClipHandlers["RaccoonCaught"].Play();
currentState = RaccoonStates.IDLE;
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(PlayerIdleState));
tranform.GlobalPosition = respawnPoint.GetComponent<Transform>().GlobalPosition;
GameManager.Instance.RacoonCaught();
if (pat && pat.item)
{
if (holdItem)
{
holdItem = false;
pat.item.GetScript<Item>().returnBack = true;
pat.SetItemGravityBack();
pat.ResetItemObject();
}
if (isAiming)
{
isAiming = false;
cam.FOV = Settings.cameraFOV;
camArm.TargetOffset = pat.prevTargetOffSet;
camArm.ArmLength = pat.tpc.armLength;
}
}
}
}
public void Caught() public void Caught()
{ {
//Debug.Log("PlayerController: Raccoon Caught");
currentState = RaccoonStates.CAUGHT; currentState = RaccoonStates.CAUGHT;
if (stateMachine && !stateMachine.IsState(typeof(PlayerCaughtState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerCaughtState)))
stateMachine.SetState(typeof(PlayerCaughtState)); stateMachine.SetState(typeof(PlayerCaughtState));
@ -566,9 +544,12 @@ public class PlayerController : Script
public void Reset() public void Reset()
{ {
//Debug.Log("PlayerController: Raccon Reset " + currentState);
if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint) if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint)
{ {
currentState = RaccoonStates.IDLE; //Debug.Log("PlayerController: Raccon Reset inside if " + currentState);
currentState = RaccoonStates.IDLE;
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(PlayerIdleState)); stateMachine.SetState(typeof(PlayerIdleState));

View File

@ -25,6 +25,7 @@ public class GameManager : Script
public float timer; public float timer;
public GameObject scoreText; public GameObject scoreText;
public GameObject scoreTextBG;
public GameObject timeText; public GameObject timeText;
public GameObject minusTimerText; public GameObject minusTimerText;
@ -234,17 +235,25 @@ public class GameManager : Script
AudioHandler.audioClipHandlers["SFXItemScore"].Play(); AudioHandler.audioClipHandlers["SFXItemScore"].Play();
AudioHandler.audioClipHandlers["RaccoonScored"].Play(); AudioHandler.audioClipHandlers["RaccoonScored"].Play();
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>(); SingleScaleBounce textBounce = scoreText.GetScript<SingleScaleBounce>();
SingleScaleBounce textBGBounce = scoreTextBG.GetScript<SingleScaleBounce>();
//if (textBounce)
// textBounce.ScaleBounceOnce();
if (textBGBounce)
textBGBounce.ScaleBounceOnce();
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>();
if (fx) if (fx)
{ {
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration); fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
} }
SingleScaleBounce sb = scoreText.GetScript<SingleScaleBounce>();
if(sb)
{
sb.ScaleBounceOnce();
}
} }

View File

@ -37,7 +37,7 @@ namespace SHADE_Scripting.UI
protected override void start() protected override void start()
{ {
if(thread != null)
thread = TweenManager.CreateTweenThread(0.0f, 1.0f, 1.0f, EASING_METHOD.EASE_IN_SINE); thread = TweenManager.CreateTweenThread(0.0f, 1.0f, 1.0f, EASING_METHOD.EASE_IN_SINE);
} }
@ -66,6 +66,10 @@ namespace SHADE_Scripting.UI
thread.duration = durationUp; thread.duration = durationUp;
thread.Reset(1.0f, scaleSize); thread.Reset(1.0f, scaleSize);
} }
else
{
Debug.Log("Single Scale Bounce: thread is null");
}
} }