Files
project-reset/Assets/Scripts/Units/Graph Tasks/CheckIfSpawnmate.cs

35 lines
1018 B
C#

using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace Reset.Units {
[Category("Reset/Units")]
[Description("Returns true if this unit is in the same spawn group as the provided value.")]
public class CheckIfSpawnmate : ConditionTask<Enemy>{
protected override string info{ get => $"{target} is spawnmate"; }
public BBParameter<GameObject> target;
//Use for initialization. This is called only once in the lifetime of the task.
//Return null if init was successfull. Return an error string otherwise
protected override string OnInit(){
return null;
}
//Called whenever the condition gets enabled.
protected override void OnEnable() {
}
//Called whenever the condition gets disabled.
protected override void OnDisable() {
}
//Called once per frame while the condition is active.
//Return whether the condition is success or failure.
protected override bool OnCheck(){
return agent.relatedSpawner.enemies.Contains(target.value);
}
}
}