protected virtual void fireWeapon()
    {
        if (getAmmoCount() > 0)
        {
            m_ammoCount--;
            // GameObject Tempprojectile = GameObject.Instantiate(projectile, m_gunFireingPoint, this.transform.rotation);
            GameObject Tempprojectile = m_projectilePool.getPoolObject(ProjectilePool.POOL_OBJECT_TYPE.BasicProjectile);
            Tempprojectile.transform.position = m_gunFireingPoint;
            Tempprojectile.transform.rotation = this.transform.rotation;


            Tempprojectile.transform.forward = (m_target.transform.position - m_gunFireingPoint).normalized;

            Tempprojectile.SetActive(true);
            ProjectileBasic projetcileBasic = Tempprojectile.GetComponent <ProjectileBasic>();
            projetcileBasic.speed = 1f;
            projetcileBasic.setFiredFrom(m_ownersFaction);
            projetcileBasic.setTargetTransfrom(m_target.transform);
            if (playerWeapon)
            {
                projetcileBasic.setFollowTarget(true);
            }


            if (this.isActiveAndEnabled)
            {
                StartCoroutine(waitAndRecoil());
            }
        }
        else
        {
            m_audioScource.PlayOneShot(m_soundManager.getEmptyGunSound());
        }
    }
Exemple #2
0
    private bool OnCollisionEvent(Fixture fixtureA, Fixture fixtureB, Contact contact)
    {
        GameObject fixObject = fixtureB.Body.UserFSBodyComponent.gameObject;

        if (fixObject.tag == "Bullet")
        {
            ProjectileBasic projComponent = fixObject.GetComponent <ProjectileBasic>();
            if (projComponent != null)
            {
                projComponent.Disarm();
            }
        }
        return(true);
    }
Exemple #3
0
    public void weaponFireForAI()
    {
        //.getBasicProjectie();
        GameObject Tempprojectile = ProjectilePool.getInstance().getPoolObject(ProjectilePool.POOL_OBJECT_TYPE.BasicProjectile);

        Tempprojectile.transform.position = m_droneRigitBody.transform.position;
        Tempprojectile.transform.rotation = m_droneRigitBody.transform.rotation;
        Tempprojectile.SetActive(true);
        Tempprojectile.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);


        Tempprojectile.transform.forward = (m_target.transform.position - this.transform.position).normalized;
        ProjectileBasic tempProjectile = Tempprojectile.GetComponent <ProjectileBasic>();

        tempProjectile.speed = 1f;
        tempProjectile.setFiredFrom(m_faction);
        tempProjectile.resetToMicroBeam();

        m_audioSource.Play();
    }