poprawki materialy unity 6, pajaki, podmiana katalogu FSM w AIControlerze, zmiana w Spider 2.0 Behaviours , skopane zycie bylo, ladowalo pajaka z zyciem 2.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
namespace Invector.vCharacterController.AI.FSMBehaviour
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vCharacterController.AI.FSMBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[vFSMHelpbox("Requires a AIMessageReceiver attached to your AI Controller - This will send a message to your Controller, so you can triggers custom Events", UnityEditor.MessageType.Info)]
|
||||
[vFSMHelpbox("Requires a vMessageReceiver attached to your AI Controller - This will send a message to your Controller, so you can trigger custom Events", UnityEditor.MessageType.Info)]
|
||||
#endif
|
||||
public class vAISendMessage : vStateAction
|
||||
{
|
||||
@@ -18,11 +20,24 @@
|
||||
{
|
||||
executionType = vFSMComponentExecutionType.OnStateEnter;
|
||||
}
|
||||
|
||||
public string listenerName;
|
||||
public string message;
|
||||
|
||||
public override void DoAction(vIFSMBehaviourController fsmBehaviour, vFSMComponentExecutionType executionType = vFSMComponentExecutionType.OnStateUpdate)
|
||||
{
|
||||
if (fsmBehaviour.messageReceiver) fsmBehaviour.messageReceiver.Send(listenerName, message);
|
||||
// Pobranie komponentu vMessageReceiver
|
||||
var receiver = fsmBehaviour.gameObject.GetComponent<vMessageReceiver>();
|
||||
|
||||
// Jeśli komponent istnieje, wysyła wiadomość
|
||||
if (receiver != null)
|
||||
{
|
||||
receiver.Send(listenerName, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"vMessageReceiver not found on {fsmBehaviour.gameObject.name}. Cannot send message.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user