コード例 #1
0
ファイル: PlayerAmmo.cs プロジェクト: MyNameIsRobert/DIDCode
    public int GetAmount(AmmoEnum.AmmoType type)
    {
        int ammoInt = -1;

        switch (type)
        {
        case AmmoEnum.AmmoType.Pistol:
            ammoInt = pistolAmmo;
            break;

        case AmmoEnum.AmmoType.AR:
            ammoInt = arAmmo;
            break;

        case AmmoEnum.AmmoType.Sniper_Heavy:
            ammoInt = sniperAmmo;
            break;

        case AmmoEnum.AmmoType.Shotgun:
            ammoInt = shotgunAmmo;
            break;

        case AmmoEnum.AmmoType.Special:
            ammoInt = specialAmmo;
            break;

        case AmmoEnum.AmmoType.Grenade:
            ammoInt = grenadeAmmo;
            break;
        }
        return(ammoInt);
    }
コード例 #2
0
ファイル: PlayerAmmo.cs プロジェクト: MyNameIsRobert/DIDCode
    public void RemoveAmmo(int amount, AmmoEnum.AmmoType type)
    {
        switch (type)
        {
        case AmmoEnum.AmmoType.Pistol:
            pistolAmmo -= amount;
            break;

        case AmmoEnum.AmmoType.AR:
            arAmmo -= amount;
            break;

        case AmmoEnum.AmmoType.Sniper_Heavy:
            sniperAmmo -= amount;
            break;

        case AmmoEnum.AmmoType.Shotgun:
            shotgunAmmo -= amount;
            break;

        case AmmoEnum.AmmoType.Special:
            specialAmmo -= amount;
            break;

        case AmmoEnum.AmmoType.Grenade:
            grenadeAmmo -= amount;
            break;
        }
    }
コード例 #3
0
    public void CopyFrom(Shoot shoot)
    {
        damage     = shoot.damage;
        weaponType = shoot.weaponType;

        attackSound         = shoot.attackSound;
        silencedAttackSound = shoot.silencedAttackSound;
        isSilenced          = shoot.isSilenced;


        reticle = shoot.reticle;

        fireRate            = shoot.fireRate;
        magazineSize        = shoot.magazineSize;
        zoomAmount          = shoot.zoomAmount;
        critMultiplier      = shoot.critMultiplier;
        currentMagazine     = shoot.currentMagazine;
        accuracyModifier    = shoot.accuracyModifier;
        aimingDivider       = shoot.aimingDivider;
        defaultAngle        = shoot.defaultAngle;
        maxSpreadAngle      = shoot.maxSpreadAngle;
        maxAngleMultiplier  = shoot.maxAngleMultiplier;
        reloadSpeed         = shoot.reloadSpeed;
        reloadSpeedModifier = shoot.reloadSpeedModifier;
        aimSpeed            = shoot.aimSpeed;
        kickBackAmount      = shoot.kickBackAmount;
        horizontalKickBack  = shoot.horizontalKickBack;
        hitParticle         = shoot.hitParticle;
        ammoType            = shoot.ammoType;
        for (int i = 0; i < attachmentPos.Length; i++)
        {
            if (shoot.attachmentPos[i] != null && attachmentPos[i] != null)
            {
                attachmentPos[i].localPosition = shoot.attachmentPos[i].localPosition;
                attachmentPos[i].localRotation = shoot.attachmentPos[i].localRotation;
                attachmentPos[i].localScale    = shoot.attachmentPos[i].localScale;
            }
        }
        for (int i = 0; i < attachments.Length; i++)
        {
            attachments[i] = shoot.attachments[i];
            if (attachments[i] != null && attachments[i].itemName != "N/A" && shoot.attachmentPos[i] != null && attachmentPos[i] != null)
            {
                SpawnAttachments(i);
            }
        }
    }
コード例 #4
0
    public override void CopyFrom(Weapon weapon)
    {
        base.CopyFrom(weapon);
        if (weapon.weaponType == WeaponType.Gun)
        {
            Shoot shoot = (Shoot)weapon;
            damage     = shoot.damage;
            weaponType = shoot.weaponType;

            attackSound         = shoot.attackSound;
            silencedAttackSound = shoot.silencedAttackSound;
            isSilenced          = shoot.isSilenced;


            reticle = shoot.reticle;

            fireRate            = shoot.fireRate;
            magazineSize        = shoot.magazineSize;
            zoomAmount          = shoot.zoomAmount;
            critMultiplier      = shoot.critMultiplier;
            currentMagazine     = shoot.currentMagazine;
            accuracyModifier    = shoot.accuracyModifier;
            aimingDivider       = shoot.aimingDivider;
            defaultAngle        = shoot.defaultAngle;
            maxSpreadAngle      = shoot.maxSpreadAngle;
            maxAngleMultiplier  = shoot.maxAngleMultiplier;
            reloadSpeed         = shoot.reloadSpeed;
            reloadSpeedModifier = shoot.reloadSpeedModifier;
            aimSpeed            = shoot.aimSpeed;
            kickBackAmount      = shoot.kickBackAmount;
            horizontalKickBack  = shoot.horizontalKickBack;
            hitParticle         = shoot.hitParticle;
            ammoType            = shoot.ammoType;
            for (int i = 0; i < attachmentPos.Length; i++)
            {
                if (shoot.attachmentPos[i] != null && attachmentPos[i] != null)
                {
                    attachmentPos[i].localPosition = shoot.attachmentPos[i].localPosition;
                    attachmentPos[i].localRotation = shoot.attachmentPos[i].localRotation;
                    attachmentPos[i].localScale    = shoot.attachmentPos[i].localScale;
                }
            }
        }
    }