public void dropObject() { if (carrying) { carriedObject.gameObject.GetComponent <BoxCollider>().enabled = true; carriedObject.gameObject.GetComponent <Rigidbody>().isKinematic = false; carriedObject.gameObject.GetComponent <Rigidbody>().useGravity = true; carriedObject = null; carrying = false; gameController.SpawnNewCan(); } }
/* * void checkIfStacked() { * * if (scoreControll.hasBeenStacked == true) * { * * Destroy(gameObject, 3f); * scoreControll.hasBeenStacked = false; * * } * * }*/ void OnTriggerEnter(Collider other) { if (!hasScored) { if (other.gameObject.tag == "Can" || other.gameObject.tag == "Coaster") { scoreControll.SpawnNewCan(); scoreControll.AddScore(scoreValue); hasScored = true; gameObject.GetComponent <Rigidbody>().isKinematic = true; } } }