ai fix along wit new music

This commit is contained in:
Glence 2023-03-26 13:27:42 +08:00
parent 44bbdf5f82
commit 2da73f12d0
10 changed files with 361 additions and 337 deletions

Binary file not shown.

View File

@ -9354,7 +9354,7 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 5 Collision Tag: 5
Type: Box Type: Box
Half Extents: {x: 0.600000024, y: 1.79999995, z: 1.5} Half Extents: {x: 1, y: 1.79999995, z: 1.5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1

View File

@ -17145,7 +17145,7 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 5 Collision Tag: 5
Type: Box Type: Box
Half Extents: {x: 0.600000024, y: 1.79999995, z: 1.5} Half Extents: {x: 1, y: 1.79999995, z: 1.5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1

View File

@ -6,7 +6,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: -4.64838362, y: 2.94342947, z: 0.209690213} Translate: {x: -4.64838362, y: 2.94342947, z: 0.209690213}
Rotate: {x: 0.5, y: 0.5, z: 6.5} Rotate: {x: -1.48352981, y: 0.5, z: 6.5}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Light Component: Light Component:
@ -8951,7 +8951,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.806008875, y: 0, z: 1.30613756} Translate: {x: 4.1322155, y: 0, z: 1.85982013}
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
@ -8962,7 +8962,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.513795853, y: 0, z: 5.17213631} Translate: {x: 3.66769528, y: 0, z: 5.17213631}
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
@ -8973,7 +8973,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -0.497500449, y: 0, z: 7.26010561} Translate: {x: 5.12931681, y: 0, z: 7.53852272}
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
@ -8984,7 +8984,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -0.380023897, y: 0, z: 9.58513737} Translate: {x: 5.37614918, y: 0, z: 9.58513737}
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
@ -8995,7 +8995,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 4.76827145, y: 0, z: 9.12785816} Translate: {x: -0.473824114, y: 0, z: 9.12785816}
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
@ -9006,7 +9006,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 5.0583787, y: 0, z: 4.71819115} Translate: {x: -0.366229892, y: 0, z: 4.99889755}
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
@ -9017,7 +9017,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.53010821, y: 0, z: 4.63929033} Translate: {x: 0.666945934, y: 0, z: 4.45493603}
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
@ -9028,7 +9028,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.64600039, y: 0, z: 2.86434269} Translate: {x: 0.605797768, y: 0, z: 2.86434269}
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
@ -9039,7 +9039,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.50184393, y: 0, z: 0.390250444} Translate: {x: 0.566371024, y: 0, z: 1.71020806}
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
@ -15112,7 +15112,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.667429447, y: 0, z: 1.10868871} Translate: {x: 3.96016145, y: 0, z: 1.54417288}
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
@ -15217,7 +15217,7 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 5 Collision Tag: 5
Type: Box Type: Box
Half Extents: {x: 0.800000012, y: 1.79999995, z: 1.5} Half Extents: {x: 1, y: 1.79999995, z: 1.5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1

View File

@ -31,6 +31,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
public AnimationClipAsset atkSeqAnim; public AnimationClipAsset atkSeqAnim;
private Vector3 startPos; private Vector3 startPos;
public bool atk { get; set; }
[NonSerialized] [NonSerialized]
public IEnumerable<Transform> patrolPointPool; public IEnumerable<Transform> patrolPointPool;
@ -73,11 +74,13 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
startPos = transform.GlobalPosition; startPos = transform.GlobalPosition;
} }
atk = false;
} }
protected override void start() protected override void start()
{ {
attackHitbox.SetActive(false); //attackHitbox.SetActive(false);
} }

View File

@ -13,14 +13,18 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{ {
public GameObject aiGO; public GameObject aiGO;
private bool raccoonFound = false;
Transform transform; Transform transform;
Transform aiTransform; Transform aiTransform;
private PlayerController pc;
private HomeOwnerAI ai;
protected override void start() protected override void start()
{ {
transform = GetComponent<Transform>(); transform = GetComponent<Transform>();
aiTransform = aiGO.GetComponent<Transform>(); aiTransform = aiGO.GetComponent<Transform>();
ai = aiGO.GetScript<HomeOwnerAI>();
} }
protected override void update() protected override void update()
@ -32,27 +36,26 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles; transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
} }
}
if (raccoonFound && pc && ai)
protected override void onTriggerStay(CollisionInfo info)
{
PlayerController pc = info.GameObject.GetScript<PlayerController>();
HomeOwnerAI ai = aiGO.GetScript<HomeOwnerAI>();
if (pc)
{ {
pc.currentState = RaccoonStates.CAUGHT; pc.currentState = RaccoonStates.CAUGHT;
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState))) if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState)))
pc.stateMachine.SetState(typeof(PlayerCaughtState)); pc.stateMachine.SetState(typeof(PlayerCaughtState));
pc.GotCaught(); pc.GotCaught();
if (ai)
{
ai.Reset(); ai.Reset();
GameObject.SetActive(false); raccoonFound = false;
}
} }
protected override void onTriggerStay(CollisionInfo info)
{
pc = info.GameObject.GetScript<PlayerController>();
if (ai && ai.atk && pc)
{
raccoonFound = true;
} }
} }

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SHADE_Scripting.Audio;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
{ {
@ -12,10 +13,11 @@ 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;
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");
} }
public override void OnEnter() public override void OnEnter()
@ -27,6 +29,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
} }
SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected"); SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected");
AudioHandler.audioClipHandlers["raccoondetected"].Play();
} }
public override void OnExit() public override void OnExit()
{ {

View File

@ -23,6 +23,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
bool seq = false; bool seq = false;
bool end = false; bool end = false;
public AttackState(StateMachine machine) : base(machine) public AttackState(StateMachine machine) : base(machine)
{ {
@ -61,7 +62,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
} }
ai.attackHitbox.SetActive(false); //ai.attackHitbox.SetActive(false);
} }
@ -76,7 +77,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
} }
ai.attackHitbox.SetActive(false); //ai.attackHitbox.SetActive(false);
machine.GetScript<HomeOwnerAI>().atk = false;
} }
@ -91,7 +93,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
hold = true; hold = true;
animator.Play(ai.atkHoldAnim); animator.Play(ai.atkHoldAnim);
timer = holdTime; timer = holdTime;
ai.attackHitbox.SetActive(true); //ai.attackHitbox.SetActive(true);
//machine.GetScript<HomeOwnerAI>().atk = true;
} }
} }
else if (hold) else if (hold)
@ -109,7 +112,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
if (timer <= 1.0f / 30.0f) if (timer <= 1.0f / 30.0f)
{ {
ai.attackHitbox.SetActive(true); //ai.attackHitbox.SetActive(true);
machine.GetScript<HomeOwnerAI>().atk = true;
} }
if (timer <= 0.0f) if (timer <= 0.0f)

View File

@ -1,5 +1,6 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.Gameplay.AIBehaviour.AIRework;
using System; using System;
public class Item : Script public class Item : Script
{ {
@ -155,7 +156,7 @@ public class Item : Script
emitter.Emit(); emitter.Emit();
} }
if (info.GameObject.GetScript<Homeowner1>() && homeownerOnce) if (info.GameObject.GetScript<HomeOwnerAI>() && homeownerOnce)
{ {
homeownerOnce = false; homeownerOnce = false;
returnBack = true; returnBack = true;

View File

@ -51,6 +51,8 @@ public class GameManager : Script
private bool goingToWin; private bool goingToWin;
private bool goingToLose; private bool goingToLose;
private bool playSpeedUp = false;
protected override void awake() protected override void awake()
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
@ -91,6 +93,7 @@ public class GameManager : Script
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored"); AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
AudioHandler.audioClipHandlers["RaccoonScored"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_scored"); AudioHandler.audioClipHandlers["RaccoonScored"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_scored");
Audio.SetParameterWithLabel("PlaybackSpeed", "Normal");
} }
protected override void start() protected override void start()
@ -123,6 +126,13 @@ public class GameManager : Script
if (currGameState == GameState.START) if (currGameState == GameState.START)
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if (timer < 30.0f && !playSpeedUp)
{
Audio.SetParameterWithLabel("PlaybackSpeed", "ToTransition");
playSpeedUp = true;
}
if(scoreText) if(scoreText)
scoreText.GetComponent<TextRenderable>().Text = $"{Score}"; scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
if(timeText) if(timeText)