Beispiel #1
0
    void CurrentTPVGun(bool local = false)
    {
        if (GManager == null)
        {
            return;
        }

        //Get the current gun ID local and sync with remote
        for (int i = 0; i < NetworkGuns.Count; i++)
        {
            bl_NetworkGun guns = NetworkGuns[i];
            if (guns == null)
            {
                continue;
            }

            int currentID = (local) ? GManager.GetCurrentWeapon().GunID : CurNetGun;
            if (guns.GetWeaponID == currentID)
            {
                guns.gameObject.SetActive(true);
                if (!local)
                {
                    CurrenGun = guns.gameObject.GetComponent <bl_NetworkGun>();
                    CurrenGun.SetUpType();
                }
            }
            else
            {
                if (guns != null)
                {
                    guns.gameObject.SetActive(false);
                }
            }
        }
    }
Beispiel #2
0
 void SyncOffAmmoGrenade(bool active)
 {
     if (CurrenGun == null)
     {
         Debug.LogError("Grenade is not active on TPS Player");
         return;
     }
     CurrenGun.GetComponent <bl_NetworkGun>().DesactiveGrenade(active, InvicibleMat);
 }
Beispiel #3
0
    void FireSync(int m_type, Vector3 hitPosition)
    {
        if (CurrenGun == null)
        {
            return;
        }
        GunType t = (GunType)(m_type);

        switch (t)
        {
        case GunType.Machinegun:
            CurrenGun.Fire(hitPosition);
            m_PlayerAnimation.PlayFireAnimation(GunType.Machinegun);
            break;

        case GunType.Pistol:
            CurrenGun.Fire(hitPosition);
            m_PlayerAnimation.PlayFireAnimation(GunType.Pistol);
            break;

        case GunType.Burst:
        case GunType.Sniper:
        case GunType.Shotgun:
            CurrenGun.Fire(hitPosition);
            break;

        case GunType.Knife:
            CurrenGun.KnifeFire();    //if you need add your custom fire launcher in networkgun
            m_PlayerAnimation.PlayFireAnimation(GunType.Knife);
            break;

        default:
            Debug.LogWarning("Not defined weapon type to sync bullets.");
            break;
        }
    }
Beispiel #4
0
 void FireGrenadeRpc(float m_spread, Vector3 pos, Quaternion rot, Vector3 angular)
 {
     CurrenGun.GetComponent <bl_NetworkGun>().GrenadeFire(m_spread, pos, rot, angular);
 }