void OnCollisionEnter(Collision collision) { GameObject player = GameObject.FindGameObjectWithTag("Player"); spaceshipLogic spaceshipLogicScript = player.GetComponent <spaceshipLogic>(); spaceshipLogicScript.playerPower = increasePower; spaceshipLogicScript.playerPower(); }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { GameObject player = GameObject.FindGameObjectWithTag("Player"); spaceshipLogic spaceshipLogicScript = player.GetComponent <spaceshipLogic>(); spaceshipLogicScript.playerPower = decreasePower; spaceshipLogicScript.playerPower(); transform.localScale *= 2; } }