protected virtual void Bumper(GameObject a_bumper) { if (a_bumper != null) { //Set the bumper to active BumperScript script = a_bumper.GetComponent <BumperScript>(); script.isAlive = true; script.lifeSpan = maxLifeSpan; a_bumper.SetActive(true); } }
void OnTriggerEnter2D(Collider2D otherCollider) { // Is this a bumper? BumperScript bumper = otherCollider.gameObject.GetComponent <BumperScript>(); if (bumper != null) { if (movementX == -1 && bumper.bumperSide == BumperScript.Bumpers.left) { movementX = 1; } else if (movementX == 1 && bumper.bumperSide == BumperScript.Bumpers.right) { movementX = -1; } } }