示例#1
0
    public void OnUpgradeSwap(FirstUpgrade firstUpgrade, SecondUpgrade secondUpgrade)
    {
        Debug.Log("Upgrade Swapped");

        if (firstUpgrade != Enums.FirstUpgrade.None)
        {
            if (FirstUpgradeImages != null && FirstUpgradeNames != null && BorderImages != null)
            {
                var index = (int)firstUpgrade;
                FirstUpgrade.sprite       = FirstUpgradeImages[index > 3 ? 2 : index > 0 ? 1 : 0];
                FirstUpgradeBorder.sprite = BorderImages[index % 3 == 0 ? 2 : index % 2 == 0 ? 1 : 0];
                FirstUpgradeName.text     = FirstUpgradeNames[index];
            }
        }
        else
        {
            if (SecondUpgradeImages != null && SecondUpgradeNames != null && BorderImages != null)
            {
                var index = (int)secondUpgrade;
                SecondUpgrade.sprite       = SecondUpgradeImages[index > 3 ? 2 : index > 0 ? 1 : 0];
                SecondUpgradeBorder.sprite = BorderImages[index % 3 == 0 ? 2 : index % 2 == 0 ? 1 : 0];
                SecondUpgradeName.text     = SecondUpgradeNames[index];
            }
        }

        AddScore(HeraldsBootstrap.Settings.ScorePerUpgrade);
    }
    private static float CalculateTimeToMove(SecondUpgrade secondUpgrade, float movementSpeed)
    {
        var baseMovementSpeed = movementSpeed;

        switch (secondUpgrade)
        {
        case SecondUpgrade.MovementSpeedMin:
            baseMovementSpeed -= baseMovementSpeed / 4f;
            break;

        case SecondUpgrade.MovementSpeedMed:
            baseMovementSpeed -= baseMovementSpeed / 2f;
            break;

        case SecondUpgrade.MovementSpeedMax:
            baseMovementSpeed = baseMovementSpeed / 4f;
            break;
        }

        return(baseMovementSpeed);
    }
示例#3
0
    private static int CalculateDamage(SecondUpgrade secondUpgrade, int damage)
    {
        var baseDamage = damage;

        switch (secondUpgrade)
        {
        case SecondUpgrade.ResistanceMin:
            baseDamage -= Mathf.RoundToInt(baseDamage / 4f);
            break;

        case SecondUpgrade.ResistanceMed:
            baseDamage -= Mathf.RoundToInt(baseDamage / 2f);
            break;

        case SecondUpgrade.ResistanceMax:
            baseDamage = Mathf.RoundToInt(baseDamage / 4f);
            break;
        }

        return(baseDamage);
    }