private void CalculateBonusInvert() { var dict = new Dictionary <Guid, decimal>(); foreach (var bonus in Cards.SelectMany(c => c.Bonuses)) { if (dict.ContainsKey(bonus.BonusTypeId)) { dict[bonus.BonusTypeId] += bonus.Value; } else { dict.Add(bonus.BonusTypeId, bonus.Value); } } foreach (var pair in dict) { var bonusType = BonusTypes.FirstOrDefault(bt => bt.Id == pair.Key); if (bonusType != null) { bonusType.Inverted = pair.Value < 0; } } }
override public void Destroy() { if (_bonus != null) { IBonus t = _bonus; _bonus = null; t.Activate(); } if (leaveBonus != BonusTypes.NONE) { Field.Score.AddScore(SCORE_VALUE); switch (leaveBonus) { case BonusTypes.LHOR: SetBonus(new LineBonus(LineBonus.LineType.HORIZONTAL)); break; case BonusTypes.LVERT: SetBonus(new LineBonus(LineBonus.LineType.VERTICAL)); break; case BonusTypes.BOMB: SetBonus(new BombBonus(Field, this)); break; } leaveBonus = BonusTypes.NONE; } else { Field.Score.AddScore(SCORE_VALUE); Field.DestroyCell(this); base.Destroy(); } }
private BonusMethod GetMethod(BonusTypes type) { string typeString = GetType().Namespace + "." + type.ToString(); dynamic product = Activator.CreateInstance(Type.GetType(typeString)); return(product as BonusMethod); }
public Bonus(Texture2D image, Vector2 position, int bonusNumber) : base(image, position) { switch (bonusNumber) { case 1: type = BonusTypes.ScoreUp; break; case 2: type = BonusTypes.Life; break; case 3: type = BonusTypes.PowerShoot; break; case 4: type = BonusTypes.MassiveDestruction; break; case 5: type = BonusTypes.HalfPoints; break; } }
private void FilterBox_Loaded2(object sender, RoutedEventArgs e) { ComboBox b = sender as ComboBox; b.IsTextSearchEnabled = false; b.ItemsSource = BonusTypes.ToList(); }
public void Remove(BonusTypes name) { if (_bonus.ContainsKey(name.ToString())) { _bonus.Remove(name.ToString()); } }
public void BonusCatched() { // не более 2 мячиков в игре do { bonusType = (BonusTypes)(int)Random.Range(0f, 4f); }while ((ballInstance != null) && (doubleBallInstance != null) && (bonusType == BonusTypes.BallDoubling)); switch (bonusType) { case BonusTypes.BallSlowing: BallsSpeedChange(-2f); Debug.Log("Balls Speed slowed down!"); break; case BonusTypes.BallAcceleration: BallsSpeedChange(2f); Debug.Log("Balls Speed growed up!"); break; case BonusTypes.BallDoubling: DoubleBall(); break; case BonusTypes.RacketWidening: RacketWidthChange(); break; } }
private BonusMethod CheckAvailabble(BonusTypes type) { if (AvaliableBonuses[type]) { return(GetMethod(type)); } return(GetMethod(defaultBonusMethodType)); }
public double GetBonus(BonusTypes type) { double bonus = 0.0d; if (Bonuses.ContainsKey(type)) { bonus = Bonuses[type].Amount; } return bonus; }
private BonusMethod GetRandomMethod() { int psb = rnd.Next(AvaliableBonuses.Count - 1); BonusTypes currentType = (BonusTypes)psb; return(CheckAvailabble(currentType)); }
/// <summary> /// Adds an amount (positive or negative) to the type specified. Passing in zero or null for the time will make this bonus never expire. /// </summary> /// <param name="name"></param> /// <param name="amount"></param> /// <param name="time"></param> public void Add(BonusTypes name, double amount, int time = 0) { if (_bonus.ContainsKey(name.ToString())) { _bonus[name.ToString()] = new Tuple<double, DateTime>(_bonus[name.ToString()].Item1 + amount, time == 0 ? DateTime.MaxValue : _bonus[name.ToString()].Item2.AddSeconds(time)); } else { _bonus.Add(name.ToString(), new Tuple<double, DateTime>(amount, time == 0 ? DateTime.MaxValue : DateTime.Now.AddSeconds(time))); } }
/// <summary> /// Adds an amount (positive or negative) to the type specified. Passing in zero or null for the time will make this bonus never expire. /// </summary> /// <param name="name"></param> /// <param name="amount"></param> /// <param name="time"></param> public void Add(BonusTypes name, double amount, int time = 0) { if (Bonuses.ContainsKey(name)) { Bonuses[name].Amount += amount; Bonuses[name].Time = time == 0 ? DateTime.MaxValue : DateTime.Now.AddSeconds(time); } else { Bonuses.Add(name, new Bonus() {Amount = amount, Time =(time == 0 ? DateTime.MaxValue : DateTime.Now.AddSeconds(time)) }); } }
public void ApplyBonus() { GameMaster.instance.PrintMessage("Запустили таймер"); timeLeft = timeLeft + bonusDuration; bonusType = BonusTypes.IncreasePlatform; timeLeft = bonusDuration; _platformIncrease = true; _platformDecrease = false; }
public double GetBonus(BonusTypes type) { double bonus = 0.0d; if (_bonus.ContainsKey(type.ToString())) { bonus = _bonus[type.ToString()].Item1; } return(bonus); }
/// <summary> /// Adds an amount (positive or negative) to the type specified. Passing in zero or null for the time will make this bonus never expire. /// </summary> /// <param name="name"></param> /// <param name="amount"></param> /// <param name="time"></param> public void Add(BonusTypes name, double amount, int time = 0) { if (_bonus.ContainsKey(name.ToString())) { _bonus[name.ToString()] = new Tuple <double, DateTime>(_bonus[name.ToString()].Item1 + amount, time == 0 ? DateTime.MaxValue : _bonus[name.ToString()].Item2.AddSeconds(time)); } else { _bonus.Add(name.ToString(), new Tuple <double, DateTime>(amount, time == 0 ? DateTime.MaxValue : DateTime.Now.AddSeconds(time))); } }
private static Brush GetBonusBrush(BonusTypes bonusType) { Image img = App.Current.Resources["RESOURCES"] as Image; ImageBrush brush = new ImageBrush(img.Source); brush.Stretch = Stretch.Fill; Point loc = GetBonusSpriteLocation(bonusType); brush.Viewbox = new Rect(loc.X * 34, loc.Y * 34, 30, 30); brush.ViewboxUnits = BrushMappingMode.Absolute; brush.Viewport = new Rect(0, 0, TileWidth * 3 / 5, TileHeight * 3 / 5); brush.ViewportUnits = BrushMappingMode.Absolute; return brush; }
public void Remove(IReadOnlyCollection <BonusType> bonusTypes) { if (bonusTypes == null) { throw new ArgumentNullException(nameof(bonusTypes)); } var list = BonusTypes.ToList(); list.RemoveAll(bonusTypes.Contains); BonusTypes = list.ToArray(); }
public void Add(BonusType bonusType) { if (bonusType == null) { throw new ArgumentNullException(nameof(bonusType)); } var list = BonusTypes.ToList(); list.Add(bonusType); BonusTypes = list.ToArray(); }
public static Bonus GenerateBonusFromXML(XmlNode node_Bonus, out bool needRefresh) { needRefresh = false; BonusTypes type = (BonusTypes)Enum.Parse(typeof(BonusTypes), node_Bonus.Attributes["bonusType"].Value); switch (type) { case BonusTypes.UnlockCardByID: { int cardID = int.Parse(node_Bonus.Attributes["cardID"].Value); if (!AllCards.CardDict.ContainsKey(cardID)) { needRefresh = true; return(null); } return(new Bonus_UnlockCardByID(cardID)); } case BonusTypes.UnlockCardByLevelNum: { int levelNum = int.Parse(node_Bonus.Attributes["levelNum"].Value); return(new Bonus_UnlockCardByLevelNum(levelNum)); } case BonusTypes.LifeUpperLimit: { int lifeUpperLimit = int.Parse(node_Bonus.Attributes["lifeUpperLimit"].Value); return(new Bonus_LifeUpperLimit(lifeUpperLimit)); } case BonusTypes.EnergyUpperLimit: { int energyUpperLimit = int.Parse(node_Bonus.Attributes["energyUpperLimit"].Value); return(new Bonus_EnergyUpperLimit(energyUpperLimit)); } case BonusTypes.Budget: { int budget = int.Parse(node_Bonus.Attributes["budget"].Value); return(new Bonus_Budget(budget)); } case BonusTypes.BudgetLifeEnergyMixed: { int value = int.Parse(node_Bonus.Attributes["value"].Value); return(new Bonus_BudgetLifeEnergyMixed(value)); } } return(null); }
public static Bonus Deserialize(DataStream reader) { BonusTypes type = (BonusTypes)reader.ReadSInt32(); Bonus bonus = null; switch (type) { case BonusTypes.UnlockCardByID: { int cardID = reader.ReadSInt32(); bonus = new Bonus_UnlockCardByID(cardID); break; } case BonusTypes.UnlockCardByLevelNum: { int levelNum = reader.ReadSInt32(); bonus = new Bonus_UnlockCardByLevelNum(levelNum); break; } case BonusTypes.LifeUpperLimit: { int lifeUpperLimit = reader.ReadSInt32(); bonus = new Bonus_LifeUpperLimit(lifeUpperLimit); break; } case BonusTypes.EnergyUpperLimit: { int energyUpperLimit = reader.ReadSInt32(); bonus = new Bonus_EnergyUpperLimit(energyUpperLimit); break; } case BonusTypes.Budget: { int budget = reader.ReadSInt32(); bonus = new Bonus_Budget(budget); break; } case BonusTypes.BudgetLifeEnergyMixed: { int value = reader.ReadSInt32(); bonus = new Bonus_BudgetLifeEnergyMixed(value); break; } } return(bonus); }
public void RemoveBonus(BonusTypes bonusType, Object changeObject) { switch (bonusType) { case BonusTypes.AddCurrency: Debug.Log("Noimpossible remove bonus AddCurrency"); break; case BonusTypes.Multiplier: bonus.RemoveMultiplier((AddCurrencyButton)changeObject); break; } }
public void ApplyBonus() { GameMaster.instance.PrintMessage("Запустили таймер"); timeLeft = timeLeft + bonusDuration; bonusType = BonusTypes.SpeedBoost; timeLeft = bonusDuration; foreach (BallController ball in GameMaster.instance.balls) { // GameObject speedBonus = Instantiate(new GameObject()); ball.SetSpeedMultyplier(1.4f); } }
public void DoBonus(BonusTypes bonusType, Object changeObject, int value) { switch (bonusType) { case BonusTypes.AddCurrency: bonus.AddCurrency(value); break; case BonusTypes.Multiplier: bonus.SetMultiplier((AddCurrencyButton)changeObject, value); break; } }
public void DoBonus(BonusTypes bonusType, int value) { switch (bonusType) { case BonusTypes.AddCurrency: bonus.AddCurrency(value); break; case BonusTypes.Multiplier: Debug.LogWarning("Button not found"); break; } }
protected override void CountBonus(long accruedSum, BonusTypes type) { if (type == BonusTypes.Addition) { this.Bonus += (int)((Sum + accruedSum) / Sum) + 1; } if (type == BonusTypes.Subtraction) { int temp = (int)((Sum + accruedSum) / Sum) + 1; if (this.Bonus - temp >= 0) { this.Bonus -= temp; } } }
public void SetBonus(BonusTypes bonusType) { switch (bonusType) { case BonusTypes.SpeedBoost: SpeedBoost speedBoost = GameObject.FindObjectOfType <SpeedBoost>(); if (speedBoost == null) { GameObject go = new GameObject(); go.name = "SpeedBoost"; speedBoost = go.AddComponent <SpeedBoost>(); } speedBoost.ApplyBonus(); break; case BonusTypes.IncreasePlatform: IncreasePlatform increasePlatform = GameObject.FindObjectOfType <IncreasePlatform>(); if (increasePlatform == null) { GameObject go = new GameObject(); go.name = "IncreasePlatform"; increasePlatform = go.AddComponent <IncreasePlatform>(); } increasePlatform.ApplyBonus(); break; case BonusTypes.CloneBall: CloneBall cloneBall = GameObject.FindObjectOfType <CloneBall>(); if (cloneBall == null) { GameObject go = new GameObject(); go.name = "CloneBall"; cloneBall = go.AddComponent <CloneBall>(); } cloneBall.ApplyBonus(); break; default: break; } }
public Bonus(PointF coord) { size = new Size(50, 50); coords = new PointF(coord.X, coord.Y); Random rand = new Random(); int i = rand.Next(0, 30); if (i < 6) { bonusType = BonusTypes.powerUpBomb; } else if (i < 20) { bonusType = BonusTypes.incrBombCount; } else { bonusType = BonusTypes.speedUp; } }
public Bonus(String name, BonusTypes bonusType, Int32 points) { this.name = name; this.points = points; this.bonusType = bonusType; }
public double GetBonus(BonusTypes type) { return StatBonus.GetBonus(type); }
public double GetBonus(BonusTypes type) { return Bonuses.GetBonus(type); }
[MethodImpl(MethodImplOptions.AggressiveInlining)] public Sprite GetBonusSprite(BonusTypes bonusType) => bonusSprites[(int)bonusType];
/// <summary> /// Create a weapon bonus /// </summary> /// <param name="_type">Weapon name the bonus contain</param> public Bonus(String bonusName) : base(Vector2.Zero, Rectangle.Empty, new Vector2(200, 200), new Vector2(0.25f, 0.25f), 0.0f, 15000.0f) { this.location = Vector2.Zero; //Bonus for weapon if (bonusName.Equals(typeof(MachineGun).Name)) { sRect = new Rectangle(688, 688, 330, 330); this.bonusWpn = new MachineGun(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(ShotGun).Name)) { sRect = new Rectangle(688, 0, 330, 330); this.bonusWpn = new ShotGun(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(Flamethrower).Name)) { sRect = new Rectangle(335, 692, 330, 330); this.bonusWpn = new Flamethrower(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(RocketLauncher).Name)) { sRect = new Rectangle(5, 682, 330, 330); this.bonusWpn = new RocketLauncher(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(LanceTruc).Name)) { sRect = new Rectangle(670, 331, 330, 330); this.bonusWpn = new LanceTruc(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(Megabomb).Name)) { sRect = new Rectangle(0, 340, 330, 330); this.bonusWpn = new Megabomb(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(BonusTypes.Life.ToString())) { sRect = new Rectangle(328, 354, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Life; } else if (bonusName.Equals(BonusTypes.Coffee.ToString())) { sRect = new Rectangle(0, 0, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Coffee; } else if (bonusName.Equals(BonusTypes.Cassoulet.ToString())) { sRect = new Rectangle(332, 0, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Cassoulet; } else { throw new Exception("Unknow bonus : " + bonusName); } dRect = ComputeDstRect(sRect); alpha = 1.0f; this.hitbox = new TGPA.Game.Hitbox.CircleHitbox(this, false, 0.75f); }
private static Point GetBonusSpriteLocation(BonusTypes bonusType) { switch(bonusType) { case BonusTypes.BONUS_ALUMINUM: return new Point(0, 0); case BonusTypes.BONUS_COAL: return new Point(1, 0); case BonusTypes.BONUS_COPPER: return new Point(2, 0); case BonusTypes.BONUS_HORSE: return new Point(3, 0); case BonusTypes.BONUS_IRON: return new Point(4, 0); case BonusTypes.BONUS_MARBLE: return new Point(5, 0); case BonusTypes.BONUS_OIL: return new Point(6, 0); case BonusTypes.BONUS_STONE: return new Point(7, 0); case BonusTypes.BONUS_URANIUM: return new Point(8, 0); case BonusTypes.BONUS_BANANA: return new Point(0, 1); case BonusTypes.BONUS_CLAM: return new Point(1, 1); case BonusTypes.BONUS_CORN: return new Point(2, 1); case BonusTypes.BONUS_COW: return new Point(3, 1); case BonusTypes.BONUS_CRAB: return new Point(4, 1); case BonusTypes.BONUS_DEER: return new Point(5, 1); case BonusTypes.BONUS_FISH: return new Point(6, 1); case BonusTypes.BONUS_PIG: return new Point(7, 1); case BonusTypes.BONUS_RICE: return new Point(8, 1); case BonusTypes.BONUS_SHEEP: return new Point(0, 2); case BonusTypes.BONUS_WHEAT: return new Point(1, 2); case BonusTypes.BONUS_DYE: return new Point(2, 2); case BonusTypes.BONUS_FUR: return new Point(3, 2); case BonusTypes.BONUS_GEMS: return new Point(4, 2); case BonusTypes.BONUS_GOLD: return new Point(5, 2); case BonusTypes.BONUS_INCENSE: return new Point(6, 2); case BonusTypes.BONUS_IVORY: return new Point(7, 2); case BonusTypes.BONUS_SILK: return new Point(8, 2); case BonusTypes.BONUS_SILVER: return new Point(0, 3); case BonusTypes.BONUS_SPICES: return new Point(1, 3); case BonusTypes.BONUS_SUGAR: return new Point(2, 3); case BonusTypes.BONUS_WINE: return new Point(3, 3); case BonusTypes.BONUS_WHALE: return new Point(4, 3); case BonusTypes.BONUS_DRAMA: return new Point(5, 3); case BonusTypes.BONUS_MUSIC: return new Point(6, 3); case BonusTypes.BONUS_MOVIES: return new Point(7, 3); default: return new Point(0, 0); } }
public void Remove(BonusTypes name) { if (Bonuses.ContainsKey(name)) { Bonuses.Remove(name); } }
public double GetBonus(BonusTypes type) { return(Bonuses.GetBonus(type)); }
/// <summary> /// Add a bonus for the passed in type. Adding to an already existing type increases the amount/time. /// Passing in a negative number reduces it by that amount. To just increase time pass zero for amount. /// </summary> /// <param name="type"></param> /// <param name="name"></param> /// <param name="amount"></param> /// <param name="time"></param> public void AddBonus(BonusTypes type, string name, double amount, int time = 0) { Bonuses.Add(type, amount, time); }
public BonusItem(gObject owner, BonusTypes type) : base(owner, 32, 32) { this.m_type = type; this.LoadImage((short)type * 32, 36, 32, 32); }
/// <summary> /// Remove a bonus for the type passed in. /// </summary> /// <param name="type"></param> /// <param name="name"></param> /// <param name="bonus"></param> public void RemoveBonus(BonusTypes type, string name, double bonus) { Bonuses.Remove(type); }
public double GetBonus(BonusTypes type) { double bonus = 0.0d; if (_bonus.ContainsKey(type.ToString())) { bonus = _bonus[type.ToString()].Item1; } return bonus; }
/// <summary> /// Add a bonus for the passed in type. Adding to an already existing type increases the amount/time. /// Passing in a negative number reduces it by that amount. To just increase time pass zero for amount. /// </summary> /// <param name="type"></param> /// <param name="name"></param> /// <param name="amount"></param> /// <param name="time"></param> public void AddBonus(BonusTypes type, string name, double amount, int time = 0) { StatBonus.Add(type, amount, time); }
public void CountBonus(BonusTypes bonus, Dictionary<string, int> counterSet) { string bonusName = bonus.ToString(); if (counterSet.ContainsKey(bonusName)) counterSet[bonusName] = counterSet[bonusName] + 1; else counterSet[bonusName] = 1; }
/// <summary> /// Remove a bonus for the type passed in. /// </summary> /// <param name="type"></param> /// <param name="name"></param> /// <param name="bonus"></param> public void RemoveBonus(BonusTypes type, string name, double bonus) { StatBonus.Remove(type); }
/// <summary> /// Create a weapon bonus /// </summary> /// <param name="_type">Weapon name the bonus contain</param> public Bonus(String bonusName) : base(Vector2.Zero, Rectangle.Empty, new Vector2(200, 200), new Vector2(0.25f, 0.25f), 0.0f, 15000.0f) { this.location = Vector2.Zero; //Bonus for weapon if (bonusName.Equals(typeof(MachineGun).Name)) { sRect = new Rectangle(688, 688, 330, 330); this.bonusWpn = new MachineGun(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(ShotGun).Name)) { sRect = new Rectangle(688, 0, 330, 330); this.bonusWpn = new ShotGun(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(Flamethrower).Name)) { sRect = new Rectangle(335, 692, 330, 330); this.bonusWpn = new Flamethrower(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(RocketLauncher).Name)) { sRect = new Rectangle(5, 682, 330, 330); this.bonusWpn = new RocketLauncher(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(LanceTruc).Name)) { sRect = new Rectangle(670, 331, 330, 330); this.bonusWpn = new LanceTruc(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(typeof(Megabomb).Name)) { sRect = new Rectangle(0, 340, 330, 330); this.bonusWpn = new Megabomb(); this.type = BonusTypes.Weapon; } else if (bonusName.Equals(BonusTypes.Life.ToString())) { sRect = new Rectangle(328, 354, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Life; } else if (bonusName.Equals(BonusTypes.Coffee.ToString())) { sRect = new Rectangle(0, 0, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Coffee; } else if (bonusName.Equals(BonusTypes.Cassoulet.ToString())) { sRect = new Rectangle(332, 0, 330, 330); this.bonusWpn = null; this.type = BonusTypes.Cassoulet; } else { throw new Exception("Unknow bonus : "+bonusName); } dRect = ComputeDstRect(sRect); alpha = 1.0f; this.hitbox = new TGPA.Game.Hitbox.CircleHitbox(this, false, 0.75f); }
public Bonus(BonusTypes mBonusType) { BonusType = mBonusType; }
private static double GetBonus(IUser player, BonusTypes type) { return player.Player.GetBonus(type); }