コード例 #1
0
    public void buildBehaviorTree()
    {
        Task[] tasks = new Task[2];

        tasks[0] = new DoorUnlocked(door);
        tasks[1] = new OpenDoor(door);
        Task sequence = new Sequence(tasks);

        tasks    = new Task[2];
        tasks[0] = new DoorClosed(door);
        tasks[1] = new BargeDoor(door);
        Task sequence2 = new Sequence(tasks);

        tasks    = new Task[2];
        tasks[0] = sequence;
        tasks[1] = sequence2;
        Task selector = new Selector(tasks);

        tasks    = new Task[2];
        tasks[0] = new DoorOpen(door);
        tasks[1] = new MoveRoom(this.transform);
        sequence = new Sequence(tasks);

        tasks     = new Task[3];
        tasks[0]  = new MoveDoor(this.transform);
        tasks[1]  = selector;
        tasks[2]  = new MoveRoom(this.transform);
        sequence2 = new Sequence(tasks);

        tasks    = new Task[2];
        tasks[0] = sequence;
        tasks[1] = sequence2;

        task = new Selector(tasks);
    }
コード例 #2
0
ファイル: MoveRoom.cs プロジェクト: zhizhiyu/fragment
    private MoveRoom self;                              //组件自身

    void Start()
    {
        canMove                = true;
        self                   = GetComponent <MoveRoom>();
        realRigidbody          = real.GetComponent <Rigidbody2D>();
        realRigidbody.bodyType = RigidbodyType2D.Static;
        realTransform          = real.GetComponent <Transform>();
        self.enabled           = false;
    }
コード例 #3
0
 public ActionResult MoveRoom(MoveRoom model)
 {
     // model.Points is an int[][2] in JSON format
     // model.Points[0][0] is the first point's x value
     // model.Points[0][1] is the first point's y value
     // model.Points[1][0] is the second point's x value
     // model.Points[1][1] is the second point's y value
     // model.Points[2][0] is the third point's x value
     // and so on...
     return(Content(model.Points, "application/json"));
 }