示例#1
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.GetComponent <BarrierController>() && coll.gameObject.GetComponent <BarrierController>().isSpicky)
     {
         bubble.BrokenOut();
     }
     else if (coll.gameObject.GetComponent <BarrierController>())
     {
         Stop();
     }
     else if (coll.gameObject.GetComponent <RubbishController>())
     {
         RubbishController sampahController = coll.gameObject.GetComponent <RubbishController>();
         if (bubble.CanLift(sampahController) && !bubble.thrownRubbishes.Contains(sampahController))
         {
             bubble.LiftRubbish(sampahController);
         }
         else if (bubble.CanLiftWithThrowFirst(sampahController) && !bubble.thrownRubbishes.Contains(sampahController))
         {
             bubble.ThrowFirstRubbish();
             bubble.LiftRubbish(sampahController);
         }
         else
         {
             Stop();
             Physics2D.IgnoreCollision(bubble.realCollider, coll);
         }
     }
 }
示例#2
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.GetComponent <BarrierController>() && coll.gameObject.GetComponent <BarrierController>().isSpicky)
     {
         bubble.BrokenOut();
     }
     else if (coll.gameObject.GetComponent <BarrierController>())
     {
         Stop();
     }
     else if (coll.gameObject.GetComponent <RubbishController>())
     {
         RubbishController sampahController = coll.gameObject.GetComponent <RubbishController>();
         if (bubble.CanLift(sampahController) && !bubble.thrownRubbishes.Contains(sampahController) && !bubble.rubbishes.Contains(sampahController))
         {
             bubble.LiftRubbish(sampahController);
         }
         else if (bubble.CanLiftWithThrowFirst(sampahController) && !bubble.thrownRubbishes.Contains(sampahController) && !bubble.rubbishes.Contains(sampahController))
         {
             bubble.ThrowFirstRubbish();
             bubble.LiftRubbish(sampahController);
         }
         else if (!bubble.rubbishes.Contains(sampahController))
         {
             this.StickyOnRubbish(coll.gameObject);
         }
     }
     else if (coll.gameObject.GetComponent <OrangeBubbleController>())
     {
         this.MergeBubble(coll.gameObject.GetComponent <BubbleController>());
     }
 }
示例#3
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.GetComponent <BarrierController>() && coll.gameObject.GetComponent <BarrierController>().isSpicky)
     {
         bubble.BrokenOut();
     }
     else if (coll.gameObject.GetComponent <RubbishController>())
     {
         RubbishController sampahController = coll.gameObject.GetComponent <RubbishController>();
         if (!sampahController.IsLifted() && bubble.CanLift(sampahController) && !bubble.thrownRubbishes.Contains(sampahController))
         {
             bubble.LiftRubbish(sampahController);
         }
         else if (!sampahController.IsLifted() && bubble.CanLiftWithThrowFirst(sampahController) && !bubble.thrownRubbishes.Contains(sampahController))
         {
             bubble.ThrowFirstRubbish();
             bubble.LiftRubbish(sampahController);
         }
     }
 }