public override void OnStart() { if (!Blackboard.Contains(kHistoryKey)) { Blackboard.Set(kHistoryKey, new List <int>()); } }
protected override Status Update(Blackboard blackboard) { if (blackboard.Contains(Source) && blackboard.Get<object>(Source) != null) { if (Child != null) return Child.Tick(blackboard); return Status.Success; } return Status.Failure; }
public override bool Condition() { Blackboard bb = Blackboard; // If any of the keys is non-existant then return false. if (!bb.Contains(key1) || !bb.Contains(key2)) { return(false); } object val1 = bb.Get(key1); object val2 = bb.Get(key2); // Use the polymorphic equals so value types are properly tested as well // as taking into account custom equality operations. bool bResult = val1.Equals(val2); return(compareInequality ? !bResult : bResult); }
public override bool Condition() { if (type == null || !Blackboard.Contains(key)) { return(false); } object value = Blackboard.Get(key); // Value is unset, nothing to check. if (value == null) { return(false); } return(value.GetType() == type); }