Re-Implemented check for whether the player can unshrink

main
thoopchuk26 4 years ago
parent 9799336752
commit 32bc813722

@ -34,7 +34,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 374150667840124763}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.9691858, y: -0.41703698, z: 0}
m_LocalPosition: {x: -1.9691858, y: 0.993, z: 0}
m_LocalScale: {x: 1.5, y: 1.5, z: 1}
m_Children: []
m_Father: {fileID: 0}

@ -40,6 +40,17 @@ public class Shrink : MonoBehaviour
public void startShrinking()
{
RaycastHit2D ceiling = Physics2D.Raycast(rb2d.transform.position, transform.TransformDirection(Vector2.up), 2f);
if (ceiling)
{
Debug.Log("Unable to Shrink");
cantShrinkCheck();
}
else
{
canShrinkCheck();
}
StartCoroutine(shrinkLogic());
}
@ -76,25 +87,13 @@ public class Shrink : MonoBehaviour
}
private void OnTriggerEnter2D(Collider2D collision)
{
//Debug.Log("Can't Shrink");
shrinkFunctionCheck();
}
private void OnTriggerExit2D(Collider2D collision)
{
//Debug.Log("Can Shrink");
unShrinkCheck();
}
public void shrinkFunctionCheck()
public void cantShrinkCheck()
{
canShrink = false;
canUnShrink = true;
}
public void unShrinkCheck()
public void canShrinkCheck()
{
canShrink = true;
canUnShrink = false;

@ -79,12 +79,6 @@ public class movement : MonoBehaviour
{
deceleration();
}
/*
if(rb2d.velocity.y)
{
}
*/
rb2d.velocity = new Vector2(_Velocity, rb2d.velocity.y);
JumpAnimation();
@ -129,6 +123,7 @@ public class movement : MonoBehaviour
scaler.x *= -1;
transform.localScale = scaler;
}
/*
private void OnCollisionEnter2D(Collision2D collision)
{

Loading…
Cancel
Save