cleaned up scripts a little bit

This commit is contained in:
slevy14
2023-04-17 16:47:12 -07:00
parent 275763628b
commit cb059613f9
7 changed files with 170 additions and 346 deletions

View File

@@ -7,18 +7,11 @@ public class PlayerBehavior : MonoBehaviour
{
[Header("Physics:")]
public float moveSpeed;
public float jumpSpeed;
public float airSpeed;
private float _hInput;
private Rigidbody2D _rb;
private int forward = 1;
public PlayerInput playerInput;
public LayerMask groundLayer;
public Vector2 boxSize;
public float maxDistanceFromGround;
[Header("Tambourine:")]
[SerializeField] private Launch launcher;
[HideInInspector] public bool hasTambourine = true;
@@ -37,7 +30,6 @@ public class PlayerBehavior : MonoBehaviour
void Start()
{
_rb = GetComponent<Rigidbody2D>();
airSpeed = .5f * moveSpeed;
stateController = GameObject.Find("StateController").GetComponent<StateController>();
}
@@ -112,4 +104,25 @@ public class PlayerBehavior : MonoBehaviour
}
grapplingGun.ReleaseGrapple();
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = col.gameObject;
}
else if (col.tag == "instaDeath")
{
this.stateController.SetDeathCanvasActive(true);
Destroy(this.gameObject);
}
}
void OnTriggerExit2D(Collider2D col)
{
if (col.tag == "grappleSurface")
{
grappleSurface = null;
}
}
}