コード例 #1
0
 private void EquipWeapon(WeaponPattern weapon)
 {
     if (currentWeapon != null)
     {
         inventory.Add(currentWeapon);
     }
     currentWeapon = weapon;
     inventory.Remove(weapon);
 }
コード例 #2
0
    public static WeaponPattern GetWeaponPattern(WeaponType weaponType)
    {
        WeaponPattern weaponPattern = null;

        switch (weaponType)
        {
        case WeaponType.Melee:
            weaponPattern = new MeleePattern();
            break;

        case WeaponType.SingleShot:
            weaponPattern = new SingleShotPattern();
            break;

        case WeaponType.MultipleShot:
            weaponPattern = new MultipleShotPattern();
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(weaponType), weaponType, null);
        }

        return(weaponPattern);
    }
コード例 #3
0
    private void SetWeaponInfo(WeaponPattern item, PlayerController player)
    {
        firstTextEq.text = firstText.text = "Dps:";
        // item info
        float percent = (item.damage * (item.damageFactor / 100f));
        float minDps  = (item.damage - percent) / item.attackSpeed;
        float maxDps  = (item.damage + percent) / item.attackSpeed;

        firstAmount.text = Mathf.Round(minDps).ToString() + " - " + Mathf.Round(maxDps).ToString();

        // equipped info
        if (player.data.equipment.currentWeapon != null)
        {
            eqWindow.gameObject.SetActive(true);
            percent            = (player.data.equipment.currentWeapon.damage * (player.data.equipment.currentWeapon.damageFactor / 100f));
            minDps             = (player.data.equipment.currentWeapon.damage - percent) / player.data.equipment.currentWeapon.attackSpeed;
            maxDps             = (player.data.equipment.currentWeapon.damage + percent) / player.data.equipment.currentWeapon.attackSpeed;
            firstAmountEq.text = Mathf.Round(minDps).ToString() + " - " + Mathf.Round(maxDps).ToString();
        }
        else
        {
            eqWindow.gameObject.SetActive(false);
        }
    }
コード例 #4
0
 private void SetWeaponPattern(WeaponPattern weaponPattern)
 {
     _weaponPattern = weaponPattern;
 }