// Use this for initialization void Awake() { playerRb = playerJoint.GetComponent <Rigidbody2D>(); playerBehaviour = playerRb.GetComponent <CSS_MonoBehaviour2D>(); endRb = whipEnd.GetComponent <Rigidbody2D>(); CheckForMissingComponents(); playerTrans = playerRb.transform; playerJoint.enabled = false; whipLine.positionCount = 2; whipLine.enabled = false; }
void WatchForWhipCollisions() { GameObject whipGo = whipEnd.gameObject; CSS_MonoBehaviour2D watchable = whipEnd.GetComponent <CSS_MonoBehaviour2D>(); if (watchable == null) { watchable = whipGo.AddComponent <CSS_MonoBehaviour2D>(); } watchable.contactEvents.CollisionEnter2D.AddListener(OnWhipCollisionEnter2D); watchable.contactEvents.TriggerEnter2D.AddListener(OnWhipTriggerEnter2D); }