コード例 #1
0
 //Check the location of the falling dude after a collision, determine which bounce value will be used on the rider
 void checkHit(Collision2D col)
 {
     if (teeterSide == 'l')
     {
         if (col.transform.position.x >= rightMid.transform.position.x)             //Right side, big bounce
         {
             bouncerScript.setBounce(1);
         }
         else               //Right side, small bounce
         {
             bouncerScript.setBounce(2);
         }
         teeterSide = 'r';             //Switch the side, used for determining which seesaw image is shown and which side the rider is placed
     }
     else
     {
         if (col.transform.position.x <= rightMid.transform.position.x)             //Left side, big bounce
         {
             bouncerScript.setBounce(1);
         }
         else               //Left side, small bounce
         {
             bouncerScript.setBounce(2);
         }
         teeterSide = 'l';             //Switch the side, used for determining which seesaw image is shown and which side the rider is placed
     }
 }