Esempio n. 1
0
 public void SetWeaponAttachment(eWeaponType _WeaponType, GameObject gameobject)
 {
     if (m_pLinkActor != null)
     {
         m_pLinkActor.SetWeaponAttachment(_WeaponType, gameobject);
     }
 }
    void Init()
    {
        m_charCon             = GetComponent <CharacterController>();
        m_animator            = GetComponent <Animator>();
        m_crouchCheckPos      = m_groundCheck.localPosition + new Vector3(0f, 0.2f, 0f); //앉을때 그라운드체크 포지션이 바닥밑으로 깔리는것을 방지하기 위함.
        m_normalCheckPos      = m_groundCheck.localPosition;
        m_isGrounded          = false;
        m_isCrouching         = false;
        m_isWalking           = false;
        m_crouchAccuracyApply = false;
        m_jumpAccruacyApply   = false;
        m_isLeanQ             = false;
        m_isLeanE             = false;
        m_isLeanDouble        = false;

        // Default Weapon Setting.
        for (int i = 0; i < m_weapons.Length; i++)
        {
            m_weapons[i].SetActive(false);
        }
        m_weapons[0].SetActive(true);
        m_WPType = eWeaponType.AR;
        SetCurrentWeapon(m_weapons[0].GetComponent <Weapon>());
        // Default Weapon Setting END

        m_HpText.text = m_hp.ToString();
    }
    public void GiveWeapon(eWeaponType weapType)
    {
        //Find weapon slot
        int openSlotIdx = -1;

        for (int i = 0; i < Weapons.Length; i++)
        {
            if (Weapons[i] == null)
            {
                openSlotIdx = i;
                break;
            }
            else if (Weapons[i].WeaponType == weapType)
            {
                //Player already owns weapon (give ammo)
                Weapons[i].Ammo += 10;
            }
        }

        if (openSlotIdx != -1)
        {
            PhotonViewComponent.RPC("RpcGiveWeapon", PhotonTargets.AllViaServer, weapType, openSlotIdx);

            //Equip new weapon (if auto-equip enabled)
            if (RZNetworkManager.LocalController.AutoPickupEnabled)
            {
                EquipWeapon(openSlotIdx);
            }
        }
        else
        {
            //Not enough space in inv
        }
    }
Esempio n. 4
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="name">weapon name/description.</param>
 /// <param name="type">Weapon type.</param>
 /// <param name="minDamage">Minimum amount of damage this weapon cen inflict.</param>
 /// <param name="maxDamage">Maximum amount of damage this weapon cen inflict.</param>
 public Weapon(string name, eWeaponType type, int minDamage, int maxDamage)
 {
     _name      = name;
     _type      = type;
     _minDamage = minDamage;
     _maxDamage = maxDamage;
 }
Esempio n. 5
0
    private void BuildWeapons()
    {
        bool weapon1NotAssigned = (m_weaponType1 == eWeaponType.NONE);
        bool weapon2NotAssigned = (m_weaponType2 == eWeaponType.NONE);

        do
        {
            if (weapon1NotAssigned)
            {
                m_weaponType1 = (eWeaponType)Random.Range(0, 3);
            }

            if (weapon2NotAssigned)
            {
                m_weaponType2 = (eWeaponType)Random.Range(0, 3);
            }
        } while (m_weaponType1 == m_weaponType2);

        if (m_weaponType1 == eWeaponType.BUSTER)
        {
            m_attack1 = GetComponent <BusterAttack>();
        }

        else if (m_weaponType1 == eWeaponType.SABER)
        {
            m_attack1 = GetComponent <SaberAttack>();
        }

        else if (m_weaponType1 == eWeaponType.SHIELD)
        {
            m_attack1 = GetComponent <ShieldAttack>();
        }

        else if (m_weaponType1 == eWeaponType.TONFA)
        {
            m_attack1 = GetComponent <TonfaAttack>();
        }

        if (m_weaponType2 == eWeaponType.BUSTER)
        {
            m_attack2 = GetComponent <BusterAttack>();
        }

        else if (m_weaponType2 == eWeaponType.SABER)
        {
            m_attack2 = GetComponent <SaberAttack>();
        }

        else if (m_weaponType2 == eWeaponType.SHIELD)
        {
            m_attack2 = GetComponent <ShieldAttack>();
        }

        else if (m_weaponType2 == eWeaponType.TONFA)
        {
            m_attack2 = GetComponent <TonfaAttack>();
        }
    }
    public void RpcGiveWeapon(int typeIdx, int weaponSlot, PhotonMessageInfo msgInfo)
    {
        eWeaponType newWeapType = (eWeaponType)typeIdx;

        if (msgInfo.sender == PhotonViewComponent.owner)
        {
            //Give server me a weapon
            Weapons[weaponSlot] = RZWeapon.GetWeaponByEnum(typeIdx);
        }
    }
Esempio n. 7
0
 public void InitData()
 {
     if (weaponData == null)
     {
         Debug.LogError("This Weapon Doesn't have a WeaponData(Scriptable Object)");
         return;
     }
     attackDamage = weaponData.attackDamage;
     coolTime     = weaponData.coolTime;
     attackRange  = weaponData.attackRange;
     eWeaponType  = weaponData.eWeaponType;
 }
Esempio n. 8
0
 public void SetWeaponWithType(eWeaponType iType)
 {
     type = iType;
     for (int i = 0; i < ListWeapon.Count; i++)
     {
         if (ListWeapon[i].type == type)
         {
             weapon = ListWeapon[i];
             return;
         }
     }
 }
Esempio n. 9
0
 public WeaponEntry(BinaryReader bin)
 {
     try
     {
         WeaponType = (eWeaponType)bin.ReadInt16();
     }
     catch (InvalidCastException e)
     {
         throw new DeserialisationException("Unrecognised weapon type: " + e, bin.BaseStream.Position);
     }
     ShortUnknown   = bin.ReadInt16();
     OriginPosition = Short3Coord.ReadShort3Coord64(bin);
 }
Esempio n. 10
0
    private void SwitchWeapons(int newWeapon)
    {
        for (int i = 0; i < m_weapons.Length; i++)
        {
            if (m_weapons[i].activeSelf)
            {
                m_weapons[i].SetActive(false);
                break;
            }
        }

        m_weapons[newWeapon].SetActive(true);
        m_WPType = (eWeaponType)newWeapon;
        SetCurrentWeapon(m_weapons[newWeapon].GetComponent <Weapon>());
    }
Esempio n. 11
0
    public static RZWeapon GetWeaponByEnum(int weapType)
    {
        eWeaponType targetType = ( eWeaponType )weapType;

        switch (targetType)
        {
        case eWeaponType.SHOTGUN:
            return(ScriptableObject.CreateInstance <RZWeapon_Shotgun>( ));

        case eWeaponType.MACHINE_GUN:
        case eWeaponType.ROCKET_LAUNCHER:
            break;
        }

        return(null);
    }
Esempio n. 12
0
 public EA_ItemAttackWeaponInfo()
 {
     weaponType               = eWeaponType.eWT_Unarmed;
     fKillDistance            = 50.0f;
     fFiringTime              = 0;
     uProjectileModelType     = "";
     m_objProjectileClassType = default(Type);
     fProjectileSpeed         = 0;
     bAutoMode                = true;
     projectileType           = eProjectileType.ePT_General;
     m_fTargetDistance        = 0;
     bForceMode               = false;
     m_TargetActorId          = CObjGlobal.InvalidObjID;
     m_strTargetActorBoneName = null;
     projectileRadius         = 0.0f;
     onExplosionEvent         = null;
 }
Esempio n. 13
0
 public void Copy(EA_ItemAttackWeaponInfo obj)
 {
     id                       = obj.id;
     weaponType               = obj.weaponType;
     fKillDistance            = obj.fKillDistance;
     fFiringTime              = obj.fFiringTime;
     uProjectileModelType     = obj.uProjectileModelType;
     m_objProjectileClassType = obj.m_objProjectileClassType;
     fProjectileSpeed         = obj.fProjectileSpeed;
     bAutoMode                = obj.bAutoMode;
     projectileType           = obj.projectileType;
     m_fTargetDistance        = obj.m_fTargetDistance;
     bForceMode               = obj.bForceMode;
     m_TargetActorId          = obj.m_TargetActorId;
     m_strTargetActorBoneName = obj.m_strTargetActorBoneName;
     projectileRadius         = obj.projectileRadius;
     onExplosionEvent         = obj.onExplosionEvent;
 }
Esempio n. 14
0
    public void ChangeWeapon(int Type)
    {
        PlayerWeaponType = (eWeaponType)Type;
        if (PlayerCurWeaponType != PlayerWeaponType)
        {
            switch (PlayerWeaponType)
            {
            case eWeaponType.WEAPON_PISTOL:
                AttackDelay    = 1.0f;
                Reload         = 2.1f;
                BulletCount    = 7;
                MaxBulletCount = 7;
                PlayerAtt      = 2;
                SubBulletCount = 56;
                MaxWeaponCount = 4;
                WeaponCount    = 1;
                break;

            case eWeaponType.WEAPON_SUBMACHINE_GUN:
                AttackDelay    = 0.2f;
                Reload         = 3.1f;
                BulletCount    = 20;
                MaxBulletCount = 20;
                PlayerAtt      = 2;
                SubBulletCount = 80;
                MaxWeaponCount = 3;
                WeaponCount    = 1;
                break;

            case eWeaponType.WEAPON_MACHINE_GUN:
                AttackDelay    = 0.15f;
                Reload         = 2.9f;
                BulletCount    = 30;
                MaxBulletCount = 30;
                PlayerAtt      = 3;
                SubBulletCount = 90;
                MaxWeaponCount = 2;
                WeaponCount    = 1;
                break;

            case eWeaponType.WEAPON_SINPER_RIFLE:
                AttackDelay    = 2.0f;
                Reload         = 4.6f;
                BulletCount    = 5;
                MaxBulletCount = 5;
                PlayerAtt      = 10;
                SubBulletCount = 15;
                MaxWeaponCount = 1;
                WeaponCount    = 1;
                break;

            case eWeaponType.WEAPON_HEAVY_MACHINE_GUN:
                AttackDelay    = 0.07f;
                Reload         = 8.2f;
                BulletCount    = 100;
                MaxBulletCount = 100;
                PlayerAtt      = 1;
                SubBulletCount = 100;
                MaxWeaponCount = 1;
                WeaponCount    = 1;
                break;
            }
            ActiveWeapon();
            PlayerCurWeaponType = PlayerWeaponType;
        }
    }
Esempio n. 15
0
 public void AssignWeapons(eWeaponType weapon1, eWeaponType weapon2)
 {
     m_weaponType1 = weapon1;
     m_weaponType2 = weapon2;
 }
Esempio n. 16
0
 public WeaponEntry(BinaryReader bin)
 {
     try
     {
       WeaponType = (eWeaponType)bin.ReadInt16();
     }
     catch (InvalidCastException e)
     {
       throw new DeserialisationException("Unrecognised weapon type: " + e, bin.BaseStream.Position);
     }
     ShortUnknown = bin.ReadInt16();
     OriginPosition = Short3Coord.ReadShort3Coord64(bin);
 }
Esempio n. 17
0
 /// <summary>
 /// Works before DoSwitchWeapon
 /// </summary>
 /// <param name="_WeaponType"></param>
 /// <param name="gameobject"></param>
 /// <returns></returns>
 public virtual bool SetWeaponAttachment(eWeaponType _WeaponType, GameObject gameobject)
 {
     return(true);
 }