void Start() { sr = GetComponent <SpriteRenderer>(); a = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); rc = GetComponent <RewindCore>(); DistanceToTheGround = normCollider.bounds.extents.y + duckCollider.bounds.extents.y; DistanceToSide = normCollider.bounds.extents.x; }
void OnCollisionEnter2D(Collision2D other) { Debug.Log("COlide"); if (other.gameObject.tag == "Player") { RewindCore rewindCore = other.gameObject.GetComponent <RewindCore>(); if (rewindCore.getRewinding()) { return; } else { rewindCore.startRewind(); } Destroy(this.gameObject); } }
void shoot() { RaycastHit2D ray; ray = Physics2D.Linecast(this.transform.position, player.transform.position); if (ray.collider != null) { RewindCore rewindCore = ray.collider.gameObject.GetComponent <RewindCore>(); if (rewindCore.getRewinding()) { return; } else { rewindCore.startRewind(); } } }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Player") { RewindCore rewindCore = other.gameObject.GetComponent <RewindCore>(); if (rewindCore.getRewinding()) { return; } else { rewindCore.startRewind(); } } else if (other.gameObject.tag == "Enemy") { return; } else { Destroy(this.gameObject); } }