public void OnScore(GameObject obstacle) { if (!_grounded) { _scoreManager.AddBonusPoints(25, "Superman!"); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "PlayerObjectDropped") { bonus.DisplayBonusText(pointsForSmallStar); scoreManager.AddBonusPoints(pointsForSmallStar); Destroy(gameObject); } }
/* Change rendering when same block connecting: * public void SameNameConnecting(Collider other) * { * Object changeGOColour = Resources.Load ("btn_9slice_normal", typeof(Texture)); * Texture gOTextureChange = (Texture) changeGOColour; * * // check colour on trigger * if (gameObject.name == other.name && other.collider.tag != "Player") * { * // thisGOColour.color = new Color (100,100,100); * gameObject.renderer.material.mainTexture = gOTextureChange; * // thisGOColour.mainTexture = Resources.Load ("btn_9slice_normal", typeof(Texture)); * other.renderer.material.mainTexture = gOTextureChange; * * // Use coroutine to avoid getting multiple BonusPoints when colliders trigger * } * if (bonusPointWithinDelay == true) * { * BonusPoints (1); * // Debug.Log ("Same name connecting!"); * } * * StartCoroutine(BonusPointHitDelay()); * } */ public void BonusPoints(int regId) { // Bonuspoints: // // Debug.Log ("RegId is: " + regId); if (regId == 0) { } if (regId == 1) // 1 bonuspoint for hitting another block of the same { scoreManager.AddBonusPoints(1); } }