void OnTriggerStay(Collider collider) { if (collider.tag == CommonValues.tagTriggers && onGround) { if (!rewarded) { CommonValues.moneyReward(this.gameObject.tag, CommonValues.REWARD); rewarded = true; } } }
void OnCollisionEnter(Collision col) { if (col.gameObject.GetComponent <Rigidbody>() != null) { velocityImpact = +col.gameObject.GetComponent <Rigidbody>().velocity.magnitude; } if (velocityImpact > MaxImpactForce) { Instantiate(breakBreaked, transform.position, transform.rotation); CommonValues.moneyReward(this.gameObject.tag, CommonValues.PUNISH); CommonValues.MessageManager.DrawMsgBox("VocĂȘ estragou esse material. Manusei com cuidado, os materiais devem ser guardados em segurança.", CommonValues.ERROR); Destroy(this.gameObject); } if (GetComponent <ScrTransportableBehaviour>().wasCaught == true) { onGround = true; } }