void OpenFire()
        {
            Physics.Raycast(camTransform.TransformPoint(startPos) + (camTransform.forward * 4), camTransform.forward, out hit, range);
            gunMaster.CallEventShotDefault(hit.point, hit.transform);

            if (hit.transform.CompareTag(GameManager_References._enemyTag))
            {
                gunMaster.CallEventShotEnemy(hit.point, hit.transform);
            }
        }
        void OpenFire()
        {
            //Debug.Log("Open Fire called");
            if (Physics.Raycast(camTransform.TransformPoint(startPosition), camTransform.forward, out hit, range))
            {
                if (hit.transform.GetComponent <NPC_TakeDamage>() != null)
                {
                    gunMaster.CallEventShotEnemy(hit, hit.transform);
                }

                else
                {
                    gunMaster.CallEventShotDefault(hit, hit.transform);
                }
            }
        }
Esempio n. 3
0
        void NpcFireGun(float randomness)
        {
            Vector3 startPosition = new Vector3(Random.Range(-randomness, randomness), Random.Range(-randomness, randomness), 0.5f);

            if (Physics.Raycast(myTransform.TransformPoint(startPosition), myTransform.forward, out hit, GetComponent <Gun_Shoot>().range, layersToDamage))
            {
                if (hit.transform.GetComponent <NPC_TakeDamage>() != null ||
                    hit.transform == GameManager_References._player.transform)
                {
                    gunMaster.CallEventShotEnemy(hit, hit.transform);
                }

                else
                {
                    gunMaster.CallEventShotDefault(hit, hit.transform);
                }
            }
        }
Esempio n. 4
0
        void OpenFire()
        {
            //Debug.Log("Open Fire called");
            if (Physics.Raycast(camTransform.TransformPoint(startPosition), camTransform.forward, out hit, range))
            {
                //if (hit.transform.GetComponent<NPC_TakeDamage>() != null) not working yet

                if (hit.transform.CompareTag(GameManager_References._enemyTag))

                {
                    gunMaster.CallEventShotEnemy(hit, hit.transform);
                }

                else
                {
                    gunMaster.CallEventShotDefault(hit, hit.transform);
                }
            }
        }