private void OnTriggerEnter(Collider col) { if (col.gameObject.CompareTag("Ennemi")) { SC_EnnemiRef = col.gameObject.GetComponent <SC_Ennemi>(); v_HitDirection = getHitDir(col.transform); SC_EnnemiRef.death(v_HitDirection, f_StrenghtRef, 1, SC_playerComboCounterRef.i_killCount, SC_PlayerRef); SC_PlayerRef.CaCHasTouched(col.gameObject); _MainCam.GetComponent <SC_CameraBehavior>().setTilt(v_HitDirection); Transform _swordStrikeTEMP = Instantiate(_swordStrikePrefab, new Vector3(col.transform.position.x, col.transform.position.y, col.transform.position.z + 0.01f), Quaternion.Euler(new Vector3(t_parentRoot.transform.rotation.x, t_parentRoot.transform.rotation.y, t_parentRoot.transform.rotation.z + Random.Range(-90, 90)))) as Transform; _swordStrikeTEMP.renderer.material.color = SC_PlayerRef.s_brightColor; float f_valueForIncrease = Mathf.Clamp(SC_playerComboCounterRef.i_killCount / 10, 0, 2.5f); if (SC_playerComboCounterRef.i_killCount > 1) { _swordStrikeTEMP.localScale = new Vector3(_swordStrikeTEMP.localScale.x + f_valueForIncrease, _swordStrikeTEMP.localScale.y + f_valueForIncrease, _swordStrikeTEMP.localScale.z + f_valueForIncrease); } } }
private void OnTriggerEnter(Collider col) { if (col.gameObject.CompareTag("Ennemi")) { SC_EnnemiRef = col.gameObject.GetComponent <SC_Ennemi>(); v_HitDirection = getHitDir(col.transform); SC_EnnemiRef.death(v_HitDirection, f_StrenghtRef, 0, SC_playerComboCounterRef.i_killCount, SC_playerComboCounterRef.SC_PlayerRef); SC_ScoreCounterRef.IncreaseScore(SC_EnnemiRef.i_ScoreValue * Mathf.Clamp(SC_playerComboCounterRef.i_killCount, 1, 999)); } }
private void OnTriggerEnter(Collider col) { if (col.gameObject.CompareTag("Ennemi")) { SC_EnnemiRef = col.gameObject.GetComponent <SC_Ennemi>(); SC_EnnemiRef.death(new Vector3(0, 0, 0), 1, 0, SC_playerComboCounterRef.i_killCount, SC_playerComboCounterRef.SC_PlayerRef); SC_ScoreCounterRef.IncreaseScore(SC_EnnemiRef.i_ScoreValue * Mathf.Clamp(SC_playerComboCounterRef.i_killCount, 1, 999)); SC_EnnemiRef.tag = null; } }
public void killEnnemy() { Vector3 v_HitDirection; v_HitDirection = -(transform.position - _Destination.transform.position); v_HitDirection = new Vector3(v_HitDirection.x, v_HitDirection.y, 0); v_HitDirection = v_HitDirection.normalized; SC_EnnemiRef = _Destination.GetComponent <SC_Ennemi>(); SC_EnnemiRef.death(v_HitDirection, f_pushStrenght, 0, SC_playerComboCounterRef.i_killCount, SC_playerComboCounterRef.SC_PlayerRef); SC_ScoreCounterRef.IncreaseScore(SC_EnnemiRef.i_ScoreValue * Mathf.Clamp(SC_playerComboCounterRef.i_killCount, 1, 999)); }
// Update is called once per frame void Update() { if (b_isActive) { a_CloseEnemies = Physics.OverlapSphere(transform.position, f_DeathRadius); if (a_CloseEnemies.Length > 0) { foreach (Collider EnnemyInZone in a_CloseEnemies) { if (EnnemyInZone.transform.tag == "Ennemi" || EnnemyInZone.transform.tag == "particule") { b_inEnnemyZone = true; SC_DamageRef = EnnemyInZone.gameObject.GetComponent <SC_Damage>(); f_damageReceived += SC_DamageRef.Damage(); } else { b_inEnnemyZone = false; } } f_LifeAmount -= f_damageReceived * Time.deltaTime; f_damageReceived = 0; } if (b_inEnnemyZone == false && f_LifeAmount < f_LifeAmountMax) { f_damageReceived = 0; f_LifeAmount += f_LifeRegenSpeed * Time.deltaTime; if (f_LifeAmount > f_LifeAmountMax) { f_LifeAmount = f_LifeAmountMax; } } if (f_LifeAmount <= 0 && b_Alive == true) { foreach (Collider EnnemyInZone in a_CloseEnemies) { if (EnnemyInZone.transform.tag == "Ennemi") { SC_EnnemiRef = EnnemyInZone.gameObject.GetComponent <SC_Ennemi>(); SC_EnnemiRef.death(SC_TriggerRef.getHitDir(EnnemyInZone.transform), 10, 1, 0, SC_PlayerRef); } } Death(); } l_LifeLamp.spotAngle = (f_LifeAmount * f_LifeLampMax) / f_LifeAmountMax; } }