30 lines
647 B
C#
30 lines
647 B
C#
using UnityEngine;
|
|
|
|
public class Charge : AI_Action
|
|
{
|
|
public GameObject m_Resource;
|
|
public override bool PrePerform()
|
|
{
|
|
m_Resource = AI_World.Instance.RemoveCharger();
|
|
if (m_Resource == null)
|
|
{
|
|
return false; // No charger available
|
|
}
|
|
|
|
inventory.AddItem(m_Resource);
|
|
target = m_Resource;
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
public override bool PostPerform()
|
|
{
|
|
agentWorldStates.RemoveState("Depleted");
|
|
AI_World.Instance.AddCharger(m_Resource);
|
|
m_Resource = null; // Clear the resource after use
|
|
|
|
return true;
|
|
}
|
|
}
|