Navigation and AI merge for level 3 #445

Merged
maverickdgg merged 6 commits from Navigation into main 2023-03-25 18:49:20 +08:00
2 changed files with 54 additions and 13 deletions
Showing only changes of commit 89bfbf3100 - Show all commits

View File

@ -15459,7 +15459,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: -2.93461704} Translate: {x: 0.667429447, y: 0, z: 1.10868871}
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
@ -15487,7 +15487,7 @@
- Is Trigger: false - Is Trigger: false
Collision Tag: 5 Collision Tag: 5
Type: Box Type: Box
Half Extents: {x: 0.600000024, y: 1.79999995, z: 0.400000006} Half Extents: {x: 0.200000003, y: 1.79999995, z: 0.200000003}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
@ -15548,4 +15548,30 @@
- Type: StateMachine - Type: StateMachine
Enabled: true Enabled: true
currentStateName: "" currentStateName: ""
currentAnimName: "" currentAnimName: ""
- EID: 627
Name: AttackHitbox
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -0.10252738, z: -2.20271254}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: true
Collision Tag: 5
Type: Box
Half Extents: {x: 0.800000012, y: 1.79999995, z: 1.5}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 1, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts:
- Type: SHADE_Scripting.Gameplay.AIBehaviour.AIRework.HomeOwnerAttackHitbox
Enabled: true
aiGO: 66078

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using static PlayerController; using static PlayerController;
@ -11,15 +12,25 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
public class HomeOwnerAttackHitbox : Script public class HomeOwnerAttackHitbox : Script
{ {
public GameObject aiGO; public GameObject aiGO;
Transform transform;
Transform aiTransform;
protected override void start()
{
transform = GetComponent<Transform>();
aiTransform = aiGO.GetComponent<Transform>();
}
protected override void update() protected override void update()
{ {
Transform transform = GetComponent<Transform>(); if (transform && aiTransform)
Transform aiTransform = aiGO.GetComponent<Transform>();
if (transform)
{ {
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 2.2f; ;
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 0.7f;
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles; transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
} }
} }
@ -31,13 +42,17 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
HomeOwnerAI ai = aiGO.GetScript<HomeOwnerAI>(); HomeOwnerAI ai = aiGO.GetScript<HomeOwnerAI>();
if (pc) 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) if (ai)
ai.Reset(); {
ai.Reset();
GameObject.SetActive(false);
}
} }
} }