1
This commit is contained in:
@@ -7,19 +7,22 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class EntityBehaviourTree :EntityComponent, IHealthCallback,IEntityOverrideCallback
|
||||
public class EntityBehaviourTree :EntityComponent
|
||||
{
|
||||
public BehaviourTreeOwner behaviourTree;
|
||||
[SerializeField] private Blackboard blackboard;
|
||||
|
||||
private readonly ValidHandle _allow=new();
|
||||
|
||||
[Inject] private IHealth _health;
|
||||
[Inject(true)] private IEntityOverride _override;
|
||||
public override void OnAwake()
|
||||
{
|
||||
entity.RegisterCallback<IHealthCallback>(this);
|
||||
entity.RegisterCallback<IEntityOverrideCallback>(this);
|
||||
|
||||
_allow.AddListener(OnAllow);
|
||||
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
_health.OnSetHealthPoint += OnSetHP;
|
||||
|
||||
_override.OnOverride += OnEntryOverride;
|
||||
}
|
||||
|
||||
public void OnSetAlive(bool alive)
|
||||
|
38
Src/UnityPluginsSupport/NodeCanvas/InvokeEntityCommand.cs
Normal file
38
Src/UnityPluginsSupport/NodeCanvas/InvokeEntityCommand.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
using NodeCanvas.Tasks;
|
||||
using NodeCanvas.Framework;
|
||||
using BITKit.SubSystems;
|
||||
using BITKit.SubSystems.Quest;
|
||||
namespace BITKit
|
||||
{
|
||||
public class InvokeEntityCommand : ActionTask
|
||||
{
|
||||
public BBParameter<Entity> entity;
|
||||
public BBParameter<string> command;
|
||||
public BBParameter<int> intParameter;
|
||||
public BBParameter<int> floatParameter;
|
||||
public BBParameter<string> stringParameter;
|
||||
|
||||
protected override void OnExecute()
|
||||
{
|
||||
var cmd = command.isNoneOrNull ? Constant.System.Internal : command.value;
|
||||
if (intParameter.isNoneOrNull is false)
|
||||
{
|
||||
entity.value.Invoke<int>(cmd, intParameter.value);
|
||||
}
|
||||
if (floatParameter.isNoneOrNull is false)
|
||||
{
|
||||
entity.value.Invoke<float>(cmd, floatParameter.value);
|
||||
}
|
||||
if(stringParameter.isNoneOrNull is false)
|
||||
{
|
||||
entity.value.Invoke<string>(cmd, stringParameter.value);
|
||||
}
|
||||
entity.value.Invoke(cmd);
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b915382c0103e6f46a83a573d1de6e74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -15,6 +15,7 @@ namespace BITKit
|
||||
public BBParameter<GameObject> target;
|
||||
protected override bool OnCheck()
|
||||
{
|
||||
if (target.isNoneOrNull) return false;
|
||||
if (target.value.transform.TryGetComponent<IHealth>(out var health))
|
||||
{
|
||||
return health.HealthPoint >= 0;
|
||||
|
Reference in New Issue
Block a user