Added Attack animation, Fix Edge case for path finding. Added footsteps. Level 2 merge #444
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -5727,7 +5727,7 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: -300, z: 0}
|
Translate: {x: 0, y: -300, z: 0}
|
||||||
Rotate: {x: -1.48352981, y: 0.5, z: 0.5}
|
Rotate: {x: 1.48352981, y: 0.5, z: 0.5}
|
||||||
Scale: {x: 400, y: 100, z: 500}
|
Scale: {x: 400, y: 100, z: 500}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Reflection.PortableExecutable;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States;
|
using SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States;
|
||||||
|
|
||||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||||
|
@ -68,6 +64,8 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||||
machine.InitStateMachine(dictionary);
|
machine.InitStateMachine(dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
||||||
|
|
||||||
patrolPointPool = patrolPointParent.GetComponentsInChildren<Transform>();
|
patrolPointPool = patrolPointParent.GetComponentsInChildren<Transform>();
|
||||||
Transform transform = GetComponent<Transform>();
|
Transform transform = GetComponent<Transform>();
|
||||||
if (transform)
|
if (transform)
|
||||||
|
|
|
@ -40,6 +40,13 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
if (rotate)
|
if (rotate)
|
||||||
rotate.active = false;
|
rotate.active = false;
|
||||||
|
|
||||||
|
RigidBody rigid = machine.GetComponent<RigidBody>();
|
||||||
|
if(rigid)
|
||||||
|
{
|
||||||
|
rigid.LinearVelocity = Vector3.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ai.attackHitbox.SetActive(false);
|
ai.attackHitbox.SetActive(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
using SHADE.Test;
|
using SHADE.Test;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -18,6 +19,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
|
|
||||||
bool run = true;
|
bool run = true;
|
||||||
|
|
||||||
|
float footStepInterval = 12.0f / 30.0f;
|
||||||
|
float footStepTimer = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
public ChaseState(StateMachine machine): base(machine)
|
public ChaseState(StateMachine machine): base(machine)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +39,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
{
|
{
|
||||||
r.rotateToPlayerLastKnown = true;
|
r.rotateToPlayerLastKnown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
footStepTimer = footStepInterval * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExit()
|
public override void OnExit()
|
||||||
|
@ -125,7 +132,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
footStepTimer -= Time.DeltaTimeF;
|
||||||
|
if (footStepTimer <= 0.0f)
|
||||||
|
{
|
||||||
|
footStepTimer += footStepInterval;
|
||||||
|
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void fixedUpdate()
|
public override void fixedUpdate()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -16,6 +17,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
float stuckTimer;
|
float stuckTimer;
|
||||||
bool run = true;
|
bool run = true;
|
||||||
|
|
||||||
|
float footStepInterval = 12.0f / 30.0f;
|
||||||
|
float footStepTimer = 0.0f;
|
||||||
|
|
||||||
public PatrolState(StateMachine machine) : base(machine)
|
public PatrolState(StateMachine machine) : base(machine)
|
||||||
{
|
{
|
||||||
stateName = "Patrol";
|
stateName = "Patrol";
|
||||||
|
@ -45,6 +49,9 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
|
|
||||||
|
|
||||||
animator.Play(ai.walkingAnim);
|
animator.Play(ai.walkingAnim);
|
||||||
|
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||||
|
footStepTimer = footStepInterval;
|
||||||
|
|
||||||
|
|
||||||
RotateToVelocity r = machine.GetScript<RotateToVelocity>();
|
RotateToVelocity r = machine.GetScript<RotateToVelocity>();
|
||||||
if(r)
|
if(r)
|
||||||
|
@ -90,7 +97,12 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||||
{
|
{
|
||||||
machine.SetState(typeof(AlertState));
|
machine.SetState(typeof(AlertState));
|
||||||
}
|
}
|
||||||
|
footStepTimer -= Time.DeltaTimeF;
|
||||||
|
if(footStepTimer <= 0.0f)
|
||||||
|
{
|
||||||
|
footStepTimer += footStepInterval;
|
||||||
|
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,10 @@ namespace SHADE
|
||||||
NavigationGridIndex nxtPoint = comp.path.front();
|
NavigationGridIndex nxtPoint = comp.path.front();
|
||||||
SHVec3 nxtPointPos = GetGridWorldPos(nxtPoint);
|
SHVec3 nxtPointPos = GetGridWorldPos(nxtPoint);
|
||||||
|
|
||||||
SHVec3 direction = nxtPointPos - transform->GetWorldPosition();
|
NavigationGridIndex currPoint = GetNavigationGridIndex(transform->GetWorldPosition());
|
||||||
|
SHVec3 currPointPos = GetGridWorldPos(currPoint);
|
||||||
|
|
||||||
|
SHVec3 direction = nxtPointPos - currPointPos;
|
||||||
direction.y = 0.0f;
|
direction.y = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue