Ejemplo n.º 1
0
 public override void Action()
 {
     if (PlayerBonusStat.bonusPack[type] == 1)
     {
         Messenger <int> .Broadcast("TAKE_BONUS_" + type.ToString().ToUpper(), 2);
     }
 }
Ejemplo n.º 2
0
 private string Beautify(BonusType value)
 {
     if (BonusTypeMap.ContainsKey(value))
     {
         return(BonusTypeMap[value]);
     }
     return(value.ToString());
 }
Ejemplo n.º 3
0
    public string GetBonusTypeString(BonusType type)
    {
        if (commonLocalizationData.Count == 0)
        {
            LocalizationManager.LoadLocalization();
        }

        if (commonLocalizationData.TryGetValue("bonusType." + type.ToString(), out string output))
        {
            if (output == "")
            {
                output = ParseBonusTypeFallback(type.ToString());
            }
        }
        else
        {
            output = ParseBonusTypeFallback(type.ToString());
        }

        return(output);
    }
Ejemplo n.º 4
0
    public void SetBonusType(BonusType _bonusType)
    {
        bonusType      = _bonusType;
        bonusText.text = _bonusType.ToString();
        SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>();

        switch (_bonusType)
        {
        case BonusType.Armor:
            spriteRenderer.color = Color.grey;
            break;

        case BonusType.FireRate:
            spriteRenderer.color = Color.yellow;
            break;

        case BonusType.CannonUpgrade:
            spriteRenderer.color = Color.red;
            break;

        case BonusType.Health:
            spriteRenderer.color = Color.white;
            break;

        case BonusType.Life:
            spriteRenderer.color = Color.cyan;
            break;

        case BonusType.Shield:
            spriteRenderer.color = Color.black;
            break;

        case BonusType.Speed:
            spriteRenderer.color = Color.blue;
            break;

        case BonusType.ClearAll:
            spriteRenderer.color = Color.magenta;
            break;

        case BonusType.FullRegen:
            spriteRenderer.color = new Color(0.5f, 0.3f, 0.7f);
            break;

        case BonusType.CrazyBomb:
            spriteRenderer.color = new Color(0.1f, 0.2f, 0.6f);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 5
0
    public void PlayPickUpSuccess(BonusType bonus, Direction pickupDirection)
    {
        if (pickupDirection == Direction.Left)
        {
            leftHandAnimator.Play("Drink");
        }
        if (pickupDirection == Direction.Right)
        {
            rightHandAnimator.Play("Drink");
        }

        if (bonus == BonusType.Alco)
        {
            Drink += 0.1f;
        }
        else if (bonus == BonusType.NotAlco)
        {
            Drink -= 0.1f;
        }

        Debug.Log("Pickup success " + bonus.ToString() + " " + pickupDirection.ToString());
    }
Ejemplo n.º 6
0
 public Bonus(BonusList bonus, BonusType type, int value)
 {
     this.bonus = bonus.ToString();
     this.type  = type.ToString();
     this.value = value;
 }
Ejemplo n.º 7
0
 public void PlayPickUpSuccess(BonusType bonus, Direction pickupDirection)
 {
     Debug.Log("Pickup success " + bonus.ToString() + " " + pickupDirection.ToString());
 }
Ejemplo n.º 8
0
        public static string GetBonusTypeString(BonusType b, ModifyType m, float min, float max, GroupType restriction)
        {
            string key = "bonusType." + b.ToString();

            if (LocalizationDict.TryGetValue(key, out string s))
            {
                if (s == "")
                {
                    s = b.ToString();
                }
            }
            else
            {
                s = b.ToString();
            }

            if (restriction != GroupType.NO_GROUP)
            {
                s = GetGroupTypeRestriction(restriction) + ", " + s;
            }

            string val;
            string sign = " +";

            if (min == max)
            {
                if (min < 0)
                {
                    sign = " ";
                }
                val = min.ToString();
            }
            else
            {
                val = "(" + min + "-" + max + ")";
            }

            switch (m)
            {
            case ModifyType.FLAT_ADDITION:
                s += sign + val;
                break;

            case ModifyType.ADDITIVE:
                s += sign + val + "%";
                break;

            case ModifyType.MULTIPLY:
            {
                if (min == max)
                {
                    s += " x" + (1 + min / 100d).ToString("F2");
                }
                else
                {
                    string minString = (1 + min / 100d).ToString("F2");
                    string maxString = (1 + max / 100d).ToString("F2");
                    s += " x(" + minString + "-" + maxString + ")";
                }

                break;
            }

            case ModifyType.FIXED_TO:
                s += " is " + val;
                break;
            }

            s += "\n";

            return(s);
        }
Ejemplo n.º 9
0
 // Create a bonus item
 public Bonus(string itemName, BonusType itemType, Sprite itemIcon, int space, int weight, int cost)
     : base(itemName, itemType.ToString(), itemIcon, 0, 0, space, weight, cost)
 {
     // Leave empty
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Gets the path of the bonus type.
 /// </summary>
 /// <param name="val">The value.</param>
 /// <returns></returns>
 public static string ToDescriptionString(BonusType val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
     return attributes.Length > 0 ? attributes[0].Description : string.Empty;
 }
Ejemplo n.º 11
0
 public static LocalisedString Localisable(BonusType bonus)
 => new LocalisedString(BASE_PATH + bonus.ToString().ToUpper());
Ejemplo n.º 12
0
 public string GetName()
 {
     return(ItemBonus.ToString() + "\n+" + BonusValue);
 }
 public UnknownRegionTypeException(BonusType bonusType) : base(bonusType.ToString())
 {
 }
Ejemplo n.º 14
0
 /// <summary>
 ///Initialise une nouvelle instance de la class <see cref="Bonus"/>.
 /// </summary>
 /// <param name="position">Position</param>
 /// <param name="speed">Vitesse</param>
 public Bonus(Vecteur2D position, double speed, int hp, BonusType bonus) : base(position, speed, hp, GameSprites.None)
 {
     this.bonusType = bonus;
     Sprite         = GetSpriteByTypde(bonus);
     Console.WriteLine(String.Format("Apparition d'un bonus en {0} Type. : {1}", position, bonus.ToString()));
 }
Ejemplo n.º 15
0
 public int GetBoughtBonus(BonusType bonusType)
 {
     return(PlayerPrefs.GetInt(bonusType.ToString()));
 }
Ejemplo n.º 16
0
 public void SetBoughtBonus(BonusType bonusType, int count)
 {
     PlayerPrefs.SetInt(bonusType.ToString(), count);
 }