//利用该函数,静态地从仍何存在的IControllable建立控制器 static public Controller From <T>(Existence <T> obj) where T : class, IControllable { return(new Controller( new Existence <IControllable>((IControllable)obj.Unwrap()) )); }
//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; } }
//为控制器绑定新的可控制对象 public void BindsTo <T>(Existence <T> obj) where T : class, IControllable { this.control = (IControllable)obj.Unwrap(); }
Controller(Existence <IControllable> control) { this.control = control.Unwrap(); }
public ActionOnce(Existence <Action> action) { this.action = action.Unwrap(); }
public FnOnce(Existence <Func <R> > func) { this.func = func.Unwrap(); }