Exemple #1
0
 void ManageCrawling(KeyCode input)
 {
     if (crawling && !Input.GetKey(input) && !collisions.getCollisions().above)
     {
         crawling          = false;
         spriteRend.sprite = standingSprite;
         collider.size     = new Vector2(1, 2);
         collisions.CalculateRaySpacing();
         transform.position += new Vector3(0, 0.5f); //Don't really like this solution, but it works so I'll leave it for now
     }
     if (Input.GetKeyDown(input))
     {
         crawling          = true;
         spriteRend.sprite = crawlingSprite;
         collider.size     = new Vector2(1, 1);
         collisions.CalculateRaySpacing();
         transform.position += new Vector3(0, -0.5f); //Don't really like this solution, but it works so I'll leave it for now
     }
 }