コード例 #1
0
    /// <summary>
    /// Equip the 0th upgrade to the selected gun.
    /// </summary>
    /// <param name="gunType"></param>
    public void EquipTopUpgrade(int gunType)
    {
        IUpgrade upgrade = upgrades[0];

        // Get the gun object and parent the upgrade to it. This actually doesn't really serve a point... but it may later
        upgrade.GetGameObject().transform.parent = GunManagement.instance.guns[(GunManagement.Guns)gunType].transform;
        upgrade.SetGun(GunManagement.instance.guns[(GunManagement.Guns)gunType].GetComponent <Pistol>());
        upgrade.Equip();
        // Remove the upgrade from our list
        upgrades.RemoveAt(0);
        PopulateUI();
    }