コード例 #1
0
 //利用该函数,静态地从仍何存在的IControllable建立控制器
 static public Controller From <T>(Existing <T> obj)
     where T : class, IControllable
 {
     return(new Controller(
                new Existing <IControllable>((IControllable)obj.Unwrap())
                ));
 }
コード例 #2
0
 public void Watch(Existing <Bird> some_bird)
 {
     if (this.birdUnderWatch == null)
     {
         this.birdUnderWatch = some_bird.Unwrap();
         Debug.Log("Watch bird");
     }
 }
コード例 #3
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(Existing <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 = new Vector3(
             positioner.position.x,
             positioner.position.y,
             this.bullet.transform.position.z
             );
     }
 }
コード例 #4
0
 //为控制器绑定新的可控制对象
 public void BindsTo <T>(Existing <T> obj)
     where T : class, IControllable
 {
     this.control = (IControllable)obj.Unwrap();
 }
コード例 #5
0
 Controller(Existing <IControllable> control)
 {
     this.control = control.Unwrap();
 }
コード例 #6
0
ファイル: CentralControl.cs プロジェクト: cre-chan/AngryBird
 private void Kill(Existing <Bird> bird)
 {
     bird.Unwrap().isDead = true;
 }