コード例 #1
0
 public override void OnThink()
 {
     if (DateTime.Now >= m_NextTalk)
     {
         foreach (Item anvil in this.GetItemsInRange(1))
         {
             if (anvil is RockHit)
             {
                 if (this.FindItemOnLayer(Layer.FirstValid) != null && !(this.FindItemOnLayer(Layer.FirstValid) is Pickaxe))
                 {
                     this.Delete();
                 }
                 else if (this.FindItemOnLayer(Layer.OneHanded) != null && !(this.FindItemOnLayer(Layer.OneHanded) is Pickaxe))
                 {
                     this.Delete();
                 }
                 else if (this.FindItemOnLayer(Layer.TwoHanded) != null)
                 {
                     this.FindItemOnLayer(Layer.TwoHanded).Delete();
                 }
                 RockHit smith = (RockHit)anvil;
                 smith.OnDoubleClick(this);
                 m_NextTalk = (DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5)));
             }
         }
     }
 }
コード例 #2
0
ファイル: Level3State.cs プロジェクト: naomijub/SNESGoofTroop
 public void Enter()
 {
     levelSndInstance = levelSnd.CreateInstance();
     //levelSndInstance.Play();
     rectangles = state.levelManager.levels[2].rectangles;
     //gate
     gateRectangle = new RectangleObjects(336, 24, 96, 72);
     rectangles.Add(gateRectangle);
     //reset
     resetRectangle = new Rectangle(336, 662, 98, 10);
     collide        = new Collision(rectangles, actors, state);
     grabThrow      = new GrabThrow(actors);
     patrol         = new Patroling(rectangles, actors, resetRectangle);
     rockHit        = new RockHit(actors, grabThrow);
     checkWin       = new CheckWin(actors);
     pursue         = new Pursue(actors, state);
 }