void TriggerNormalHit() { RaycastHit hit; Physics.Raycast(CapperBody.position, CapperBody.TransformDirection(Vector3.down), out hit, 5f); if (hit.transform.gameObject.tag == "Coke" || hit.transform.gameObject.tag == "Poison" || hit.transform.gameObject.tag == "Soda") { Debug.Log("Normal Hit"); hit.transform.gameObject.GetComponent <Animator>().SetTrigger("Cap"); CokeShader cokeShader = hit.transform.gameObject.GetComponent <CokeShader>(); cokeShader.CapCan(); cokeShader.isCapped = true; } }
void TriggerBadHit() { RaycastHit hit; Physics.Raycast(CapperBody.position, CapperBody.TransformDirection(Vector3.down), out hit, 5f); if (hit.transform.gameObject.tag == "Coke" || hit.transform.gameObject.tag == "Poison" || hit.transform.gameObject.tag == "Soda") { Debug.Log("Bad Hit"); StartCoroutine(cameraChanger.Shake(.15f, .05f)); CokeShader cokeShader = hit.transform.gameObject.GetComponent <CokeShader>(); cokeShader.CapCan(); hit.transform.gameObject.GetComponent <Animator>().SetTrigger("Crush"); cokeShader.SplashLiquid(); cokeShader.isCrushed = true; if (hit.transform.gameObject.tag == "Coke") { cokeCollector.DestroyCokePenalty(); } } }