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

64 lines
1.3 KiB
C#

using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static PlayerController;
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{
public class HomeOwnerAttackHitbox : Script
{
public GameObject aiGO;
public bool raccoonFound = false;
Transform transform;
Transform aiTransform;
[NonSerialized]
public PlayerController pc;
private HomeOwnerAI ai;
protected override void start()
{
transform = GetComponent<Transform>();
aiTransform = aiGO.GetComponent<Transform>();
ai = aiGO.GetScript<HomeOwnerAI>();
}
protected override void update()
{
if (transform && aiTransform)
{
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 0.7f;
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
}
if (raccoonFound && pc && ai)
{
if (!ai.atk)
raccoonFound = false;
}
}
protected override void onTriggerStay(CollisionInfo info)
{
if(info.GameObject.GetScript<PlayerController>())
pc = info.GameObject.GetScript<PlayerController>();
if (ai && ai.atk && pc)
{
raccoonFound = true;
}
}
}
}