// Use this for initialization void Start () { Memory = new BlackBoard(); Memory.Set<GameObject>("Player", GameObject.FindGameObjectWithTag("Player")); Conditional playerClose = new Conditional(isCloseToPlayer); Conditional playerMoving = new Conditional(isPlayerMoving); BehaviorAction MoveToPlayer = new BehaviorAction(moveToPlayer); BehaviorAction WanderAroundPlayer = new BehaviorAction(wanderAroundPlayer); Selector stayCloseToPlayer = new Selector( new Sequence( new Inverter(playerClose), playerMoving, MoveToPlayer ), WanderAroundPlayer ); behaviour = new BehaviorLibrary.Behavior(stayCloseToPlayer); }
// Use this for initialization void Start() { Memory = new BlackBoard(); Memory.Set <GameObject>("Player", GameObject.FindGameObjectWithTag("Player")); Conditional playerClose = new Conditional(isCloseToPlayer); Conditional playerMoving = new Conditional(isPlayerMoving); BehaviorAction MoveToPlayer = new BehaviorAction(moveToPlayer); BehaviorAction WanderAroundPlayer = new BehaviorAction(wanderAroundPlayer); Selector stayCloseToPlayer = new Selector( new Sequence( new Inverter(playerClose), playerMoving, MoveToPlayer ), WanderAroundPlayer ); behaviour = new BehaviorLibrary.Behavior(stayCloseToPlayer); }