Exemplo n.º 1
0
 //利用该函数,静态地从仍何存在的IControllable建立控制器
 static public Controller From <T>(Existence <T> obj)
     where T : class, IControllable
 {
     return(new Controller(
                new Existence <IControllable>((IControllable)obj.Unwrap())
                ));
 }
Exemplo n.º 2
0
 //load the bird onto SlingShot. The slingshot's bullet cannot be NULL!!!
 //The existence simplify the implemantation. It ensures the load to change states.
 public void Load(Existence <Bird> bullet)
 {
     //since the bullet reflects the state, this ensures call only works under unloaded state
     if (!this.IsLoaded)
     {
         this.bullet                    = bullet.Unwrap();
         this.bullet.physicsLock        = true;
         this.bullet.transform.position = positioner.position;
     }
 }
Exemplo n.º 3
0
 //为控制器绑定新的可控制对象
 public void BindsTo <T>(Existence <T> obj)
     where T : class, IControllable
 {
     this.control = (IControllable)obj.Unwrap();
 }
Exemplo n.º 4
0
 Controller(Existence <IControllable> control)
 {
     this.control = control.Unwrap();
 }
Exemplo n.º 5
0
 public ActionOnce(Existence <Action> action)
 {
     this.action = action.Unwrap();
 }
Exemplo n.º 6
0
 public FnOnce(Existence <Func <R> > func)
 {
     this.func = func.Unwrap();
 }