Пример #1
0
        void OpenFire()
        {
            //Debug.Log("Open Fire called!");

            if (Physics.Raycast(camTransform.TransformPoint(startPosition), camTransform.forward, out hit, range))
            {
                //gunMaster.CallEventShotDefault(hit.point, hit.transform);

                //if (hit.transform.CompareTag(GameManager_References._enemyTag))
                //{
                //    //Debug.Log("Enemy hit!");
                //    gunMaster.CallEventShotEnemy(hit.point, hit.transform);
                //}

                if (hit.transform.GetComponent <NPC_TakeDamage>() != null)
                {
                    gunMaster.CallEventShotEnemy(hit, hit.transform);
                }

                else
                {
                    gunMaster.CallEventShotDefault(hit, hit.transform);
                }
            }
        }
Пример #2
0
        void NPCFireGun(float randomRange)
        {
            Vector3 startPosition = new Vector3(Random.Range(-randomRange, randomRange), Random.Range(-randomRange, randomRange), 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);
                }
            }
        }