private Player player; // Get the Player class. // Also need to change the circle collider? Here's an example how to achieve this: // public class DefaultHitbox { // ... // public float circleRadius; // public Vector2 circleSize; // } // // Inside the ChangeHitbox function: // circleCollider.radius = defaultHitbox.circleRadius; // circleCollider.size = defaultHitbox.circleSize; // Use this for initialization. void Start () { // Setting up references. boxCollider = GetComponent<BoxCollider2D>(); circleCollider = GetComponent<CircleCollider2D>(); player = GetComponent<Player>(); // Set default hitbox. ChangeHitbox("default"); }
private bool snappedToMiddle = false; // Variable that determines if the player is snapped to the middle. // Use this for initialization. void Start () { // Setting up references. player = GetComponent<Player>(); boxCollider = GetComponent<BoxCollider2D>(); }
private bool canJumpDown = false; // Determines if the player is allowed to jump down. // Use this for initialization. void Start() { // Setting up references. player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent<Player>(); platform = GetComponentInParent<PlatformJumpThrough>(); }
private Player player; // Get the Player class. // Use this for initialization. void Start () { // Setting up references. player = GetComponent<Player>(); }
private float enableTimer; // Used to count down before the collisions are enabled. // Use this for initialization. void Start () { // Setting up references. player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent<Player>(); cols = player.GetComponents<Collider2D>(); }