コード例 #1
0
	// 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);
	
	}
コード例 #2
0
    // 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);
    }