SHADE_Y3/Assets/Scripts/Gameplay/AIBehaviour/AIRework/HomeOwnerAttackHitbox.cs

41 lines
966 B
C#
Raw Normal View History

2023-03-25 14:51:28 +08:00
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{
public class HomeOwnerAttackHitbox:Script
{
2023-03-25 16:52:26 +08:00
public GameObject aiGO;
protected override void update()
2023-03-25 14:51:28 +08:00
{
2023-03-25 16:52:26 +08:00
Transform transform = GetComponent<Transform>();
Transform aiTransform = aiGO.GetComponent<Transform>();
if(transform)
{
transform.GlobalPosition = aiTransform.GlobalPosition;
}
}
protected override void onTriggerStay(CollisionInfo info)
{
2023-03-25 14:51:28 +08:00
PlayerController pc = info.GameObject.GetScript<PlayerController>();
2023-03-25 16:52:26 +08:00
HomeOwnerAI ai = aiGO.GetScript<HomeOwnerAI>();
if (pc)
2023-03-25 14:51:28 +08:00
{
2023-03-25 16:52:26 +08:00
pc.GotCaught();
if(ai)
ai.Reset();
2023-03-25 14:51:28 +08:00
}
}
}
}