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
player: 65775
range: 5
angle: 30
angle: 45
angleBetween: 0
distance: 0
heightLimit: 1
@ -9298,7 +9298,7 @@
- EID: 627
Name: AttackHitbox
IsActive: true
NumberOfChildren: 0
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254}
@ -9322,6 +9322,17 @@
Enabled: true
aiGO: 65771
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
Name: Gameplay Canvas
IsActive: true

View File

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

View File

@ -15560,7 +15560,7 @@
Enabled: true
player: 65775
range: 5
angle: 30
angle: 45
angleBetween: 0
distance: 0
heightLimit: 1
@ -15602,7 +15602,7 @@
- EID: 627
Name: AttackHitbox
IsActive: true
NumberOfChildren: 0
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254}
@ -15626,6 +15626,17 @@
Enabled: true
aiGO: 66078
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
Name: Gameplay Canvas
IsActive: true

View File

@ -32,6 +32,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
public AnimationClipAsset atkHoldAnim;
public AnimationClipAsset atkSeqAnim;
private Vector3 startPos;
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");
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>();
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;
float alertTimer = alertDuration;
bool firstDetection;
public AlertState(StateMachine machine) : base(machine)
{
stateName = "Alert";
AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected");
firstDetection = true;
}
public override void OnEnter()
@ -28,9 +28,33 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
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()
{
animator.Stop();

View File

@ -23,6 +23,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
bool seq = false;
bool end = false;
bool raccoonCaught = true;
public AttackState(StateMachine machine) : base(machine)
{
@ -40,6 +42,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
end = false;
timer = windupTime;
raccoonCaught = false;
RotateToVelocity rotate = machine.GetScript<RotateToVelocity>();
if (rotate)
rotate.active = false;
@ -86,11 +90,18 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
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 (timer <= 0.0f)
@ -137,15 +148,24 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
if (timer <= 0.0f)
{
end = false;
AILineOfSight los = ai.GetScript<AILineOfSight>();
if (los && los.withinSight)
if(raccoonCaught)
{
machine.SetState(typeof(ChaseState));
machine.SetState(typeof(CaughtRaccoonState));
}
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;
timer = ai.caughtDuration;
if (pc)
pc.Caught();
}
@ -40,14 +42,22 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
if (pc)
{
pc.currentState = RaccoonStates.CAUGHT;
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState)))
pc.stateMachine.SetState(typeof(PlayerCaughtState));
pc.GotCaught();
pc.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 footStepTimer = 0.0f;
float barkTimer = 0.0f;
Random rand;
public ChaseState(StateMachine machine): base(machine)
{
stateName = "Chase";
rand = new Random();
}
public override void OnEnter()
@ -42,6 +48,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
footStepTimer = footStepInterval * 0.5f;
barkTimer = (float)rand.Next(0, 2) + (float)rand.NextDouble();
}
public override void OnExit()
@ -57,11 +66,25 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{
rotate.lookAround = false;
}
}
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>();
RigidBody rigid = machine.GetComponent<RigidBody>();
if (los && nav)

View File

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

View File

@ -22,7 +22,9 @@ public class PlayerController : Script
public Transform tranform { get; set; }
public Camera cam { get; set; }
public CameraArm camArm { get; set; }
private PickAndThrow pat;
[NonSerialized]
public PickAndThrow pat;
public StateMachine stateMachine { get; set; }
public ParticleEmitter Leftsmoke { get; set; }
public ParticleEmitter Rightsmoke { get; set; }
@ -227,7 +229,7 @@ public class PlayerController : Script
}
}
GotCaught();
Rotation();
MoveKey();
Sprint();
@ -254,6 +256,10 @@ public class PlayerController : Script
private void MoveKey()
{
if (currentState == RaccoonStates.CAUGHT)
return;
axisMove = Vector2.Zero;
if (Input.GetKey(Input.KeyCode.W))
{
@ -290,7 +296,7 @@ public class PlayerController : Script
axisMove.Normalise();
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;
@ -334,6 +340,9 @@ public class PlayerController : Script
private void Sprint()
{
if (currentState == RaccoonStates.CAUGHT)
return;
if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded)
{
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()
{
//Debug.Log("PlayerController: Raccoon Caught");
currentState = RaccoonStates.CAUGHT;
if (stateMachine && !stateMachine.IsState(typeof(PlayerCaughtState)))
stateMachine.SetState(typeof(PlayerCaughtState));
@ -566,9 +544,12 @@ public class PlayerController : Script
public void Reset()
{
//Debug.Log("PlayerController: Raccon Reset " + currentState);
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)))
stateMachine.SetState(typeof(PlayerIdleState));

View File

@ -25,6 +25,7 @@ public class GameManager : Script
public float timer;
public GameObject scoreText;
public GameObject scoreTextBG;
public GameObject timeText;
public GameObject minusTimerText;
@ -234,17 +235,25 @@ public class GameManager : Script
AudioHandler.audioClipHandlers["SFXItemScore"].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)
{
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()
{
if(thread != null)
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.Reset(1.0f, scaleSize);
}
else
{
Debug.Log("Single Scale Bounce: thread is null");
}
}