private void AbsorbHeal() { powerValue += lastHabilitieContact.GetPowerValue(); transform.localScale *= 1.3f; GetComponent <Renderer>().material.color = Color.green; Debug.Log("Absoption ball has absorb de power of: " + lastHabilitieContact.name); Destroy(lastHabilitieContact.gameObject); }
private void ReflectHabilitie() { Vector3 habilitieOpositeDir = -lastHabilitieContact.transform.forward; float angleWithZAxis = Vector3.Angle(habilitieOpositeDir, transform.forward); float angleWithXAxis = Vector3.Angle(habilitieOpositeDir, transform.right); lastHabilitieContact.transform.forward = transform.forward; if (angleWithXAxis < 90) { lastHabilitieContact.transform.Rotate(Vector3.up * -angleWithZAxis); } else { lastHabilitieContact.transform.Rotate(Vector3.up * angleWithZAxis); } lastHabilitieContact.SetPowerValue(lastHabilitieContact.GetPowerValue() + powerValue); }