Exemplo n.º 1
0
    void Update()
    {
        if (prevNumberUpgrades != PlayerUpgrades.revolvingCannonUpgrades.Count)
        {
            prevNumberUpgrades = PlayerUpgrades.revolvingCannonUpgrades.Count;
            applyUpgrades();
            weaponScript.setTemplate();
        }

        if (cartridgeUpgrade == false)
        {
            if (numberRoundsStockPiled < maxRounds)
            {
                if (weaponScript.coolDownPeriod <= 0)
                {
                    weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                    numberRoundsStockPiled++;
                    weaponScript.onCooldown            = true;
                    weaponScript.weaponNumberText.text = numberRoundsStockPiled.ToString();
                }
            }
            else
            {
                weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                weaponScript.onCooldown     = false;
            }
        }
        else
        {
            if (numberRoundsStockPiled <= 0)
            {
                if (weaponScript.coolDownPeriod <= 0)
                {
                    weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                    numberRoundsStockPiled      = maxRounds;
                    if (PlayerUpgrades.revolvingCannonUpgrades.Count >= 6)
                    {
                        numberRoundsStockPiled += bonusRounds;
                    }
                    bonusRounds = 0;

                    weaponScript.weaponNumberText.text = numberRoundsStockPiled.ToString();
                }
            }
            else
            {
                weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                weaponScript.onCooldown     = false;
            }
        }

        if (weaponScript.mouseHovering == true && PlayerProperties.playerScript.playerDead == false && PlayerProperties.playerScript.windowAlreadyOpen == false)
        {
            if (Input.GetMouseButtonDown(0))
            {
                inFocus = true;
            }

            if (Input.GetMouseButton(0) && numberRoundsStockPiled > 0 && canFire && inFocus)
            {
                weaponScript.forceFire();
                numberRoundsStockPiled--;
                weaponScript.weaponNumberText.text = numberRoundsStockPiled.ToString();
                StartCoroutine(canFireRoutine());
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            inFocus = false;
            canFire = true;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (prevNumberUpgrades != PlayerUpgrades.fireworkUpgrades.Count)
        {
            prevNumberUpgrades = PlayerUpgrades.fireworkUpgrades.Count;
            applyUpgrades();
            weaponScript.setTemplate();
            if (stockpileUnlocked)
            {
                weaponScript.weaponIcon.sprite = stockPileIcons[numberRocketsStockpiled];
            }
        }

        if (isOnlyFirework() == false && (stockpileUnlocked == true || largerExplosionsUnlocked == true))
        {
            largerExplosionsUnlocked       = false;
            stockpileUnlocked              = false;
            weaponScript.weaponPlume       = origFireworkPlume;
            weaponScript.weaponIcon.sprite = origFireworkIcon;
            numberStockPile             = 0;
            numberRocketsStockpiled     = 0;
            weaponScript.noFireNormally = false;
            applyUpgrades();
        }

        if (largerExplosionsUnlocked)
        {
            if (weaponScript.weaponPlume != empoweredWeaponFlare)
            {
                weaponScript.weaponPlume       = empoweredWeaponFlare;
                weaponScript.weaponIcon.sprite = largerExplosionsUnlockedIcon;
            }
        }

        if (stockpileUnlocked)
        {
            weaponScript.noFireNormally = true;

            if (numberRocketsStockpiled < numberStockPile)
            {
                if (weaponScript.coolDownPeriod <= 0)
                {
                    weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                    numberRocketsStockpiled++;
                    weaponScript.onCooldown        = true;
                    weaponScript.weaponIcon.sprite = stockPileIcons[numberRocketsStockpiled];
                }
            }
            else
            {
                weaponScript.coolDownPeriod = weaponScript.coolDownThreshold;
                weaponScript.onCooldown     = false;
            }

            if (weaponScript.mouseHovering == true && Input.GetMouseButtonDown(0) && PlayerProperties.playerScript.playerDead == false && PlayerProperties.playerScript.windowAlreadyOpen == false)
            {
                if (numberRocketsStockpiled > 0)
                {
                    weaponScript.forceFire();
                    numberRocketsStockpiled--;
                    weaponScript.weaponIcon.sprite = stockPileIcons[numberRocketsStockpiled];
                }
            }

            if (numberPrevShots != weaponScript.numberShots)
            {
                numberPrevShots = weaponScript.numberShots;
            }
        }
    }