示例#1
0
    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);
            }
        }
    }