Exemplo n.º 1
0
    IEnumerator ResetEnemy()
    {
        yield return(new WaitForSecondsRealtime(m_HitSuspensionDuration));

        m_CustomCrosshair.SetCrosshairColor(Color.white);
        // m_EnemyAIBossController.m_IsNavMeshAgentUpdating = true;
    }
    private void ProcessRaycast()
    {
        RaycastHit hit;

        if (Physics.Raycast(m_Camera.transform.position, m_Camera.transform.forward, out hit, m_Range, m_LayerMask))
        {
            Debug.Log("hit collider gameobject " + hit.collider.gameObject);
            if (hit.transform.tag == "Enemy")
            {
                m_CustomCrosshair.SetCrosshairColor(Color.red);
                Debug.Log("HIT " + hit);
                CreateHitImpact(m_HitEffect, hit);
                Target target = hit.transform.GetComponent <Target>();
                target.TakeDamage(m_Damage);
            }
            else
            {
                m_CustomCrosshair.SetCrosshairColor(Color.white);
                CreateHitImpact(m_MissEffect, hit);
            }
        }
        else
        {
            return;
        }
    }
Exemplo n.º 3
0
    private void ProcessRaycast()
    {
        RaycastHit hit;
        Vector3    direction = m_Camera.transform.forward;

        direction.x += Random.Range(-m_SprayFactor, m_SprayFactor);
        direction.y += Random.Range(-m_SprayFactor, m_SprayFactor);
        direction.z += Random.Range(-m_SprayFactor, m_SprayFactor);

        if (Physics.Raycast(m_Camera.transform.position, direction, out hit, m_Range, m_LayerMask))
        {
            if (hit.transform.tag == "Enemy")
            {
                m_CustomCrosshair.SetCrosshairColor(Color.red);
                // CreateHitImpact(m_HitEffect, hit);
                Target target = hit.transform.GetComponent <Target> ();
                target.TakeDamage(m_Damage, hit.point);
            }
            else
            {
                m_CustomCrosshair.SetCrosshairColor(Color.white);
                CreateHitImpact(m_MissEffect, hit);
            }
        }
        else
        {
            return;
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        m_CustomCrosshair.SetCrosshairColor(Color.white);

        if (Input.GetButtonDown("Fire1"))
        {
            m_CustomCrosshair.SetCrosshairColor(Color.red);
            // needed so we can attack in mid-air
            m_Animator.SetTrigger("isInterruptingJump");
            m_Animator.ResetTrigger("jump");
            m_Animator.SetTrigger("lightSwordAttack");
            // if (!m_Animator.GetBool("isGrounded"))
            // {
            //   m_PlayerController.m_GravityMultiplier = .3f;
            // }
            // else
            // {
            //   m_PlayerController.m_GravityMultiplier = 1f;
            // }
            // var direction = new Vector3(Vector3.forward, 0f, m_Camera.transform.position.z);
            // m_PlayerController.AddImpact(Vector3.forward, 5f);
            // var moveDir = new Vector3(m_Camera.transform.position.x, 0, m_Camera.transform.position.z);
            // m_CharacterController.Move(Vector3.forward * 10f * Time.deltaTime);


            // if (!m_Animator.GetBool("isChargingUppercutAttack"))
            // {
            //   m_Animator.SetBool("isChargingUppercutAttack", true);
            // }
            // m_CurrentChargeDuration += Time.deltaTime;
            // Debug.Log("CURRENTCHARGET" + m_CurrentChargeDuration);
        }

        if (Input.GetButton("Fire2"))
        {
            if (!m_Animator.GetBool("isChargingHeavySwordAttack"))
            {
                m_Animator.SetBool("canSwitchWeapon", false);
                m_Animator.SetBool("isChargingHeavySwordAttack", true);
            }
            m_CurrentChargeDuration += Time.deltaTime;
        }

        if (Input.GetButtonUp("Fire2") || m_CurrentChargeDuration >= m_MaxChargeDuration)
        {
            m_CustomCrosshair.SetCrosshairColor(Color.red);
            m_Animator.SetBool("isChargingHeavySwordAttack", false);
            m_Animator.SetTrigger("heavySwordAttack");
            m_Animator.SetBool("canSwitchWeapon", true);
            m_CurrentChargeDuration = 0f;
            // m_PlayerController.ToggleHitboxColliders("UppercutAttack", true);
            // StartCoroutine(EndUppercutAttack());
        }
    }
Exemplo n.º 5
0
    IEnumerator ResetEnemy()
    {
        yield return(new WaitForSecondsRealtime(m_HitSuspensionDuration));

        m_CustomCrosshair.SetCrosshairColor(Color.white);

        if (!m_EnemyNavMeshAgent.enabled)
        {
            m_EnemyNavMeshAgent.enabled = true;
        }
        if (!m_EnemyRigidBody.isKinematic)
        {
            m_EnemyRigidBody.isKinematic = true;
        }
    }
Exemplo n.º 6
0
    IEnumerator ResetEnemy()
    {
        yield return(new WaitForSecondsRealtime(m_HitSuspensionDuration));

        m_CustomCrosshair.SetCrosshairColor(Color.white);
        m_EnemyRigidBody.transform.position = new Vector3(m_EnemyRigidBody.transform.position.x, 0f, m_EnemyRigidBody.transform.position.z);
        if (!m_EnemyRigidBody.isKinematic)
        {
            m_EnemyRigidBody.isKinematic = true;
        }
        if (!m_EnemyNavMeshAgent.updatePosition)
        {
            m_EnemyNavMeshAgent.nextPosition   = m_EnemyRigidBody.gameObject.transform.position;
            m_EnemyNavMeshAgent.updatePosition = true;
        }
    }
Exemplo n.º 7
0
    private void OnTriggerEnter(Collider otherCollider)
    {
        if (otherCollider.gameObject.tag == "Enemy")
        {
            m_CustomCrosshair.SetCrosshairColor(Color.red);
            m_EnemyRigidBody    = otherCollider.gameObject.GetComponent <Rigidbody>();
            m_EnemyNavMeshAgent = otherCollider.gameObject.GetComponent <NavMeshAgent>();
            Target enemyTarget = otherCollider.gameObject.GetComponent <Target>();

            Vector3 direction = m_BaseHitBox.GetDirection(m_EnemyRigidBody);
            Damage  damage    = m_BaseHitBox.m_DamageHash[m_CurrentComboType.ToString()];
            float   force     = damage.m_KnockbackForce;

            m_EnemyRigidBody.isKinematic = false;
            m_EnemyNavMeshAgent.enabled  = false;
            StartCoroutine(ResetEnemy());

            m_EnemyRigidBody.AddForce(direction * force, ForceMode.Impulse);
            enemyTarget.TakeDamage(damage);
        }
    }