public Component_AttributeModifier(EntityAttributeType attributeType, ModifierType modifierType, double value) { this.AttributeType = attributeType; this.ModifierType = modifierType; this.Value = value; }
private static InputModifiers GetModifierKeys(ModifierType state) { var rv = InputModifiers.None; if (state.HasFlag(ModifierType.ControlMask)) { rv |= InputModifiers.Control; } if (state.HasFlag(ModifierType.ShiftMask)) { rv |= InputModifiers.Shift; } if (state.HasFlag(ModifierType.Mod1Mask)) { rv |= InputModifiers.Control; } if (state.HasFlag(ModifierType.Button1Mask)) { rv |= InputModifiers.LeftMouseButton; } if (state.HasFlag(ModifierType.Button2Mask)) { rv |= InputModifiers.RightMouseButton; } if (state.HasFlag(ModifierType.Button3Mask)) { rv |= InputModifiers.MiddleMouseButton; } return(rv); }
private int GetModifierValue (ModifierTarget player, ModifierType modifierType) { ModifierTarget[] correctTargets = { player, ModifierTarget.All }; return Modifiers.Where ( i => correctTargets.Contains (i.Target) && i.Modifier == modifierType).Sum (i => i.Value); }
/// <inheritdoc /> public void Save() { if (_disposed) { throw new ObjectDisposedException("DataBindingModifier"); } // Don't save an invalid state if (ParameterPath != null && !ParameterPath.IsValid) { return; } if (!DirectDataBinding.Entity.Modifiers.Contains(Entity)) { DirectDataBinding.Entity.Modifiers.Add(Entity); } // Modifier if (ModifierType != null) { Entity.ModifierType = ModifierType.GetType().Name; Entity.ModifierTypePluginGuid = ModifierType.PluginInfo.Guid; } // General Entity.Order = Order; Entity.ParameterType = (int)ParameterType; // Parameter ParameterPath?.Save(); Entity.ParameterPath = ParameterPath?.Entity; Entity.ParameterStaticValue = JsonConvert.SerializeObject(ParameterStaticValue); }
public bool KeyPress(Key key, char keyChar, ModifierType modifier) { int indentLength; char bulletChar; if(key == Key.Return) { var bulletState = GetBulletState(document.Editor.Caret.Line, out indentLength, out bulletChar); if(bulletState == BulletState.None) { return true; } if(bulletState == BulletState.InBullet) { // I'm not sure why the last space is eaten here var bulletLine = new string(' ', indentLength) + bulletChar + " "; // + 1 since we put it at the next line document.Editor.Insert(document.Editor.Caret.Offset + 1, bulletLine); document.Editor.Caret.Offset += bulletLine.Length; document.Editor.Insert(document.Editor.Caret.Offset, document.Editor.EolMarker); document.Editor.Caret.Offset--; return false; } // time to finish the bullet var currentLine = document.Editor.GetLine(document.Editor.Caret.Line); document.Editor.Remove(currentLine.Offset, currentLine.Length); return true; } return true; }
public Modifier(int value, ModifierType type, object source, AbilityType modType) { Source = source; Type = type; attType = modType; Value = value; }
public void AddModifier(ModifierType modifierType, float modifierValue, bool isRemoving = false) { if (modifierValue != 0) { switch (modifierType) { case ModifierType.modifiersAdd: if (!isRemoving) { modifiersAdd.Add((int)modifierValue); } else { modifiersAdd.Remove((int)modifierValue); } break; case ModifierType.modifiersMul: if (!isRemoving) { modifiersMul.Add(modifierValue); } else { modifiersMul.Remove(modifierValue); } break; default: break; } } }
protected override void OnScrolled(ScrollDirection direction, ModifierType mod) { if ((mod & ModifierType.ShiftMask) != ModifierType.ShiftMask) { return; } int shift = HueShift; if (direction == Gdk.ScrollDirection.Up) { shift += 5; } else if (direction == Gdk.ScrollDirection.Down) { shift -= 5; } if (shift < 0) { shift += 360; } shift %= 360; HueShift = shift; }
public void OnMouseMotion(Vector mousePos, ModifierType Modifiers) { if (UpdateMousePos(mousePos)) { Redraw(); } }
public static SKU.IAttributeModifier CreateModifier(ModifierType type, params object[] parameters) { SKU.IAttributeModifier modifier = null; switch (type) { case ModifierType.Flat: Assert.IsTrue(parameters.Length == 1); modifier = new FlatModifier((float)parameters[0]); break; case ModifierType.Time: Assert.IsTrue(parameters.Length == 2); modifier = new TimeModifier((float)parameters[0], (float)parameters[1]); break; case ModifierType.Regen: Assert.IsTrue(parameters.Length == 2); modifier = new RegenModifier((float)parameters[0], (float)parameters[1]); break; default: Debug.Log("This ModifierType is no implemented: " + type); break; } Assert.IsNotNull(modifier); return(modifier); }
public PatternBuilder BeginGroup(int minRepeats, int maxRepeats, ModifierType modifiers, IEnumerable <char> exclude) { if (_patternList.Last().Tokens.Count > 0) { var tg = new TokenGroup() { MinimumCount = minRepeats, MaximumCount = maxRepeats, Modifier = modifiers }; if (null != exclude && exclude.Count() > 0) { tg.ControlBlock = new ControlBlock() { Type = ControlBlockType.ECB, ExceptValues = exclude.ToArray() } } ; _patternList.Add(tg); } else { var tg = _patternList.Last(); tg.MinimumCount = minRepeats; tg.MaximumCount = maxRepeats; tg.Modifier = modifiers; if (null != exclude && exclude.Count() > 0) { tg.ControlBlock = new ControlBlock() { Type = ControlBlockType.ECB, ExceptValues = exclude.ToArray() } } ; } return(this); }
public void OnMouseButtonPress(Vector mousePos, int button, ModifierType Modifiers) { if (button == 1) { IGameObject gameObject = CreateObjectAt(MousePos); // switch back to object edit mode when shift was not pressed if ((Modifiers & ModifierType.ShiftMask) == 0) { ObjectSelectTool editor = new ObjectSelectTool(application, application.CurrentSector); if (gameObject is IObject) { editor.MakeActive((IObject)gameObject); } application.SetTool(editor); } } else //cancel creation by other buttons { application.SetToolObjects(); } if (UpdateMousePos(mousePos)) { Redraw(); } }
public ModifierPersistence(bool active, bool executeEveryUpdate, int level, ModifierType modifierType) { Active = active; ExecuteEveryUpdate = executeEveryUpdate; Level = level; ModifierType = modifierType; }
public Mod(StatType stat, ModifierType type, double value) : this() { Stat = stat; Type = type; Value = value; }
public void OnMouseButtonRelease(Vector mousePos, int button, ModifierType Modifiers) { if (application.CurrentTilemap == null) { return; } UpdateMouseTilePos(mousePos); if ((button == 1) && drawing) { drawing = false; // use backup of Tilemap to create undo command TilemapModifyCommand command = new TilemapModifyCommand( ActionName + " on Tilemap \"" + application.CurrentTilemap.Name + "\"", application.CurrentTilemap, tilemapBackup, application.CurrentTilemap.SaveState()); UndoManager.AddCommand(command); } if ((button == 3) && selecting) { UpdateSelection(); SelectionDoneAction(selection); selection.FireChangedEvent(); selecting = false; } Redraw(); }
public void OnMouseMotion(Vector mousePos, ModifierType Modifiers) { if (application.CurrentTilemap == null) { return; } if (UpdateMouseTilePos(mousePos)) { if (selection.Width == 0 || selection.Height == 0) { return; } if (drawing && ((Modifiers & ModifierType.ShiftMask) != 0 || ((LastDrawPos.X - MouseTilePos.X) % selection.Width == 0 && (LastDrawPos.Y - MouseTilePos.Y) % selection.Height == 0 ) ) ) { LastDrawPos = MouseTilePos; EditorAction(Modifiers); //Call editor-specific part of code } if (selecting) { UpdateSelection(); } Redraw(); } }
public StatModifier RandMod() { // ModifierType mt = (ModifierType)UnityEngine.Random.Range(0, Enum.GetValues(typeof(ModifierType)).Length); ModifierType mt = ModifierType.Add; //Stat st = (Stat)UnityEngine.Random.Range(0, Enum.GetValues(typeof(Stat)).Length); Stat st; int s = UnityEngine.Random.Range(0, 3); if (s == 0) { st = Stat.Attack; } else if (s == 1) { st = Stat.Evasion; } else { st = Stat.MaxHealth; } double val = UnityEngine.Random.Range(1, 11); return(new StatModifier(mt, st, val)); }
/// <summary> /// Returns unit to snap to, based on passed Modifier keys and application settings /// </summary> protected int SnapValue(ModifierType Modifiers) { if ((Modifiers & ModifierType.ShiftMask) != 0) return 32; if ((Modifiers & ModifierType.ControlMask) != 0) return 16; if (application.SnapToGrid) return 32; return 0; }
public AttributeModifier(string atributeAlias, float valueChange, ModifierType modifierType = ModifierType.Absolute, string name = null) : base(name) { this.AttributeAlias = atributeAlias; this.valueChange = valueChange; this.ChangeType = modifierType; }
public void OnMouseButtonPress(Vector MousePos, int button, ModifierType Modifiers) { if (Tilemap == null) return; UpdateMouseTilePos(MousePos); if (button == 1) { if ((selection.Width == 1) && (selection.Height == 1)) { application.TakeUndoSnapshot("Fill Tool"); FloodFill(MouseTilePos, selection[0, 0]); } LastDrawPos = MouseTilePos; drawing = true; Redraw(); } if(button == 3) { if(MouseTilePos.X < 0 || MouseTilePos.Y < 0 || MouseTilePos.X >= Tilemap.Width || MouseTilePos.Y >= Tilemap.Height) return; SelectStartPos = MouseTilePos; selecting = true; UpdateSelection(); Redraw(); } }
public static void RequestPopup(ModifierType type, string command, string amount) { if (!Config.generalParams.showModStatus) { return; } if (activePopups.ContainsKey(type)) { return; } if (popupSlots.Count == 0) { // Config.generalParams.maxActiveModifiers for (int i = 0; i < Enum.GetNames(typeof(ModifierType)).Length; i++) { popupSlots.Add(i); } } for (int i = 0; i < popupSlots.Count; i++) { if (popupSlots[i] == -1) { continue; } activePopups.Add(type, new PopupSlot(popupSlots[i], StatusText(ComposeString(command, amount, popupSlots[i]), popupSlots[i]))); popupSlots[i] = -1; break; } }
public override void PerformActionOnTile(FieldPos TilePos, ModifierType Modifiers) { if (application.CurrentTilemap.InBounds(TilePos)) { brush.ApplyToTilemap(TilePos, application.CurrentTilemap); } }
/// <summary> /// Creates new instance of XHotkey class. /// </summary> /// <param name="modifiers">Modifiers.</param> /// <param name="key">Key.</param> /// <param name="enabled">Whether hotkey is enabled.</param> /// <param name="onHotkeyPressed">Function raised when hotkey is pressed.</param> public Hotkey(ModifierType modifiers, Key key, bool enabled, XHotkeyFunc onHotkeyPressed) { this.Modifiers = modifiers; this.Key = key; this.Enabled = enabled; this.OnHotkeyPressed = onHotkeyPressed; }
public Modifier GetModifier(ModifierType type, ModifiableItem item) { // Get all groups based on the modifier type and item type var groups = modifierCollection.ModifierGroups.FindAll(x => x.Type == type && x.Domain.HasFlag(item.Type)); if (groups == null) { throw new NullReferenceException("Unable to find any ModifierGroups for type " + type); } // Select a group from the ModifierGroups to choose a modifier from var group = groups[GetRandomInRangeOfCollection(groups)]; // Check if the item already has a modifier from this group if (group.Contains(item)) { Debug.Log($"Modifier from {group.name} already existed on {item.Name}, skipping"); return(null); } var modifiers = group.GetWithinItemLevel(item.ItemLevel); if (modifiers.Count == 0) { Debug.Log("No modifiers found"); // No modifier could be found, so none will be added return(null); } return(modifiers[GetRandomInRangeOfCollection(modifiers)]); }
public TPModifier(ModifierType modifierType, float modifierValue, int modifierPriority, object modifierSource) { Type = modifierType; Value = modifierValue; Priority = modifierPriority; Source = modifierSource; }
public void OnMouseButtonRelease(Vector mousePos, int button, ModifierType Modifiers) { if (UpdateMousePos(mousePos)) { Redraw(); } }
public static bool AddOrUpdateApplicationRelation(ApplicationRelation info, ModifierType mode) { bool ret = false; IDbConnection conn = null; IDbCommand cmd = null; IDbTransaction trans = null; try { IApplicationRelation dp = DataProvider.DbApplicationRelationDP; conn = DbConnOperation.CreateConnection(); cmd = conn.CreateCommand(); conn.Open(); trans = conn.BeginTransaction(); cmd.Transaction = trans; ret = dp.AddOrUpdateApplicationRelation(cmd, info, mode); trans.Commit(); } catch (Exception ex) { log.Error(string.Format("AddOrUpdateApplicationRelation()发生错误,错误信息如下:{0}", ex)); if (trans != null) { trans.Rollback(); } } finally { if (conn != null) { conn.Close(); } } return(ret); }
public StatModifier(float value, ModifierType type, int order, object source) { Value = value; Type = type; Order = order; Source = source; }
public void OnMouseButtonRelease(Vector MousePos, int button, ModifierType Modifiers) { if (Tilemap == null) return; UpdateMouseTilePos(MousePos); if(button == 1) { drawing = false; } if(button == 3) { UpdateSelection(); uint NewWidth = (uint) (SelectionP2.X - SelectionP1.X) + 1; uint NewHeight = (uint) (SelectionP2.Y - SelectionP1.Y) + 1; selection.Resize(NewWidth, NewHeight, 0); for(uint y = 0; y < NewHeight; y++) { for(uint x = 0; x < NewWidth; ++x) { selection[x, y] = Tilemap[(uint) SelectionP1.X + x, (uint) SelectionP1.Y + y]; } } selection.FireChangedEvent(); selecting = false; } Redraw(); }
/// <summary> /// Applies the modifier to the provided value /// </summary> /// <param name="currentValue">The value to apply the modifier to, should be of the same type as the data binding target</param> /// <returns>The modified value</returns> public object Apply(object?currentValue) { if (_disposed) { throw new ObjectDisposedException("DataBindingModifier"); } if (ModifierType == null) { return(currentValue); } if (!ModifierType.SupportsParameter) { return(ModifierType.Apply(currentValue, null)); } if (ParameterType == ProfileRightSideType.Dynamic && ParameterPath != null && ParameterPath.IsValid) { object?value = ParameterPath.GetValue(); return(ModifierType.Apply(currentValue, value)); } if (ParameterType == ProfileRightSideType.Static) { return(ModifierType.Apply(currentValue, ParameterStaticValue)); } return(currentValue); }
public string RenderModifier(float value, ModifierType modifierType) { string format; if (modifierType == ModifierType.Additive) { value = Filter(value); format = (value > 0) ? positiveFormat : negativeFormat; } else { format = (value > 0) ? multiplierPositiveFormat : multiplierNegativeFormat; value = value * 100; } value = Mathf.Abs(value); string render = format.Replace("{name}", Name); int start = render.IndexOf('{'); int end = render.IndexOf('}'); string toStringController = render.Substring(start + 1, end - start - 1); string valueFormatted = value.ToString(toStringController); string prefix = render.Substring(0, start); string suffix = render.Substring(end + 1, render.Length - end - 1); render = prefix + valueFormatted + suffix; return(render); }
public static void RequestOverlayDisplay(ModifierType type, string command, string amount, string user, string color) { if (!Config.generalParams.showOnScoreOverlay) { return; } if (overlays.ContainsKey(type)) { return; } if (ScoreOverlayMod.ui.ModifierText.text.Length > 0) { addNewLine = true; } else { addNewLine = false; } if (!spacingSet) { spacingSet = true; ScoreOverlayMod.ui.ModifierText.lineSpacing = -1f; } overlays.Add(type, ComposeString(command, amount, user, color, State.Active)); UpdateOverlayString(); }
public bool AddComponentToPlayer(ModifierType type, float summand, GameObject player, out GameComponent modifier) { switch (type) { case ModifierType.AccelerationFactor: break; case ModifierType.MaxSpeed: break; case ModifierType.Friction: { var mod = player.AddComponent <FrictionModifier>(); mod.Summand = summand; modifier = mod; return(true); } default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } modifier = null; return(false); }
public AuraModifierEffectProceduralGenerator(EffectType effect) { effectType = effect; switch (effectType) { case EffectType.AURA_POSITIVE_STATS: modifierGenerator = new StatModifierProceduralGenerator(true); modifierType = ModifierType.STAT; break; case EffectType.AURA_NEGATIVE_STATS: modifierGenerator = new StatModifierProceduralGenerator(false); modifierType = ModifierType.STAT; break; case EffectType.AURA_KEYWORD: modifierGenerator = new KeywordModifierProceduralGenerator(); modifierType = ModifierType.KEYWORD; break; case EffectType.AURA_MANA_COST_REDUCTION: modifierGenerator = new ManaCostModifierProceduralGenerator(true); modifierType = ModifierType.MANA_COST; break; case EffectType.AURA_MANA_COST_TAX: modifierGenerator = new ManaCostModifierProceduralGenerator(false); modifierType = ModifierType.MANA_COST; break; } }
public bool AddComponentToPlayer(ModifierType type, Vector2 summand, GameObject player, out GameComponent modifier) { switch (type) { case ModifierType.AccelerationFactor: { var mod = player.AddComponent <AccelerationModifier>(); mod.Summand = summand; modifier = mod; return(true); } case ModifierType.MaxSpeed: { var mod = player.AddComponent <MaxSpeedModifier>(); mod.Summand = summand; modifier = mod; return(true); } case ModifierType.Friction: break; } modifier = null; return(false); }
public void AddAction(string playerA, string playerB, ActionType actionType, ModifierType modifyer, Weapon weapon, WhereType where, ArmyType teamA, ArmyType teamB) { Player playerGet = getPlayer(playerA, teamA); Player playerDo = null; //damage from the world (harrier, falling) will not be considered in this version if (playerB == string.Empty) { playerDo = playerGet; } else { playerDo = getPlayer(playerB, teamB); } switch (actionType) { case ActionType.Kill: playerGet.AddAction(playerDo, ActionType.Die, modifyer, weapon, where); playerDo.AddAction(playerGet, ActionType.Kill, modifyer, weapon, where); break; case ActionType.Damage: playerGet.AddAction(playerDo, ActionType.Damage, modifyer, weapon, where); playerDo.AddAction(playerGet, ActionType.Damage, modifyer, weapon, where); break; } }
public static void MapRawKeys(EventKey evt, out Key key, out ModifierType mod) { mod = GetAllowedModifier(evt.State); key = evt.Key; if (PlatformHelper.Platform != PlatformTypes.MacOSX) { return; } uint keyval; int effectiveGroup, level; ModifierType consumedModifiers; Keymap.Default.TranslateKeyboardState(evt.HardwareKeycode, evt.State, evt.Group, out keyval, out effectiveGroup, out level, out consumedModifiers); key = (Key)keyval; mod = evt.State & ~consumedModifiers; AccelKey accelKey = MapRawKeys(new AccelKey(key, mod, AccelFlags.Visible)); key = accelKey.Key; mod = accelKey.AccelMods; // When opt modifier is active, we need to decompose this to make the command appear correct for Mac. // In addition, we can only inspect whether the opt/alt key is pressed by examining // the key's "group", because the Mac GTK+ treats opt as a group modifier and does // not expose it as an actual GDK modifier. if (evt.Group == (byte)1) { mod |= AltModifier; key = GetGroupZeroKey(key, evt); } }
public AttributeModifier(ModifierType type, float value, int priority, object source) { Priority = priority; Value = value; Type = type; Source = source; }
public void ProcessKey (Key key, char ch, ModifierType modifiers) { var k = ch == '\0'? new ViKey (modifiers, key) : new ViKey (modifiers, ch); Keys.Add (k); if (!Builder (this)) { SetError ("Unknown command"); } }
public void Build (ViEditor editor, Key key, char ch, ModifierType modifiers) { var k = ch == '\0'? new ViKey (modifiers, key) : new ViKey (modifiers, ch); Keys.Add (k); if (!Builder (this)) { Error = "Unknown command"; } }
public static StatModifier Of (ModifierType modifier, ModifierTarget target, int value) { return new StatModifier { Modifier = modifier, Target = target, Value = value }; }
public void OnMouseButtonPress(Vector pos, int button, ModifierType Modifiers) { application.TakeUndoSnapshot( "Created Object '" + objectType + "'" ); IGameObject gameObject = CreateObjectAt(pos); // switch back to object edit mode when shift was not pressed if((Modifiers & ModifierType.ShiftMask) == 0) { ObjectsEditor editor = new ObjectsEditor(application, application.CurrentSector); if(gameObject is IObject) { editor.MakeActive((IObject) gameObject); } application.SetEditor(editor); } }
/// <summary> /// Breaks apart an event key into the individual and normalized key and /// any modifiers. /// </summary> /// <param name="evt">The evt.</param> /// <param name="key">The key.</param> /// <param name="modifiers">The mod.</param> public static void DecomposeKeys( EventKey evt, out Key key, out ModifierType modifiers) { // Use the keymap to decompose various elements of the hardware keys. uint keyval; int effectiveGroup, level; ModifierType consumedModifiers; keymap.TranslateKeyboardState( evt.HardwareKeycode, evt.State, evt.Group, out keyval, out effectiveGroup, out level, out consumedModifiers); // Break out the identified keys and modifiers. key = (Key) keyval; modifiers = evt.State & ~consumedModifiers; // Normalize some of the keys that don't make sense. if (key == Key.ISO_Left_Tab) { key = Key.Tab; modifiers |= ModifierType.ShiftMask; } // Check to see if we are a character and pull out the shift key if // it is a capital letter. This is used to normalize so all the // keys are uppercase with a shift modifier. bool shiftWasConsumed = ((evt.State ^ modifiers) & ModifierType.ShiftMask) != 0; var unicode = (char) Keyval.ToUnicode((uint) key); if (shiftWasConsumed && Char.IsUpper(unicode)) { modifiers |= ModifierType.ShiftMask; } if (Char.IsLetter(unicode) && Char.IsLower(unicode)) { key = (Key) Char.ToUpper(unicode); } }
public override bool KeyPress (Key key, char keyChar, ModifierType modifier) { var result = base.KeyPress (key, keyChar, modifier); if (key == Key.Return) { if (textEditorData.Options.IndentStyle == IndentStyle.Virtual) { if (textEditorData.GetLine (textEditorData.Caret.Line).Length == 0) textEditorData.Caret.Column = textEditorData.IndentationTracker.GetVirtualIndentationColumn (textEditorData.Caret.Location); } else { DoReSmartIndent (); } } return result; }
protected override void OnScrolled (ScrollDirection direction, ModifierType mod) { if ((mod & ModifierType.ShiftMask) != ModifierType.ShiftMask) return; int shift = HueShift; if (direction == Gdk.ScrollDirection.Up) shift += 5; else if (direction == Gdk.ScrollDirection.Down) shift -= 5; if (shift < 0) shift += 360; shift %= 360; HueShift = shift; }
/// <summary> /// Adds a given value to the existing value for a specific <see cref="ModifierType" /> in a /// specific <see cref="ModifierCategory">collection</see>. /// </summary> /// <param name="collectionType">the collection type</param> /// <param name="statType">the stat type</param> /// <param name="value">the amount to add</param> public void AddToStat(ModifierCategory collectionType, ModifierType statType, double value) { m_changeLock.EnterWriteLock(); try { m_modifiers[collectionType][statType] += value; if (!IsChangeFlagged(statType)) { m_changes.AddLast(statType); } } finally { m_changeLock.ExitWriteLock(); } }
public void OnMouseButtonPress(Vector mousePos, int button, ModifierType Modifiers) { if (button == 1){ IGameObject gameObject = CreateObjectAt(MousePos); // switch back to object edit mode when shift was not pressed if((Modifiers & ModifierType.ShiftMask) == 0) { ObjectSelectTool editor = new ObjectSelectTool(application, application.CurrentSector); if(gameObject is IObject) { editor.MakeActive((IObject) gameObject); } application.SetTool(editor); } } else { //cancel creation by other buttons application.SetToolObjects(); } if (UpdateMousePos(mousePos)) Redraw(); }
void SetSecondaryWeaponModifier(ModifierType modifierType) { if ( modifierType == ModifierType.None) return; if ( modifierType < ModifierType.NUM_ELEMENTAL_MODIFIERS ) { // ElementalModifier // update the elemental modifier switch(modifierType) { case ModifierType.Poison : modifierCombo.setElemental("PoisonModifier"); modifierDisplay.setEMod("Poison"); break; case ModifierType.EMP : modifierCombo.setElemental("EMPModifier"); modifierDisplay.setEMod("EMP"); break; case ModifierType.Explosion : modifierCombo.setElemental("ExplosionModifier"); modifierDisplay.setEMod("Explosion"); break; } } else { // BehavioralModifier // update the behavioral modifier switch(modifierType) { case ModifierType.HeatSeek : modifierCombo.setBehavioral("HeatSeekModifier"); modifierDisplay.setBMod("HeatSeek"); break; case ModifierType.Spread : modifierCombo.setBehavioral("SpreadModifier"); modifierDisplay.setBMod("Spread"); break; case ModifierType.Rebound : modifierCombo.setBehavioral("RebounderModifier"); modifierDisplay.setBMod("Rebound"); break; } } GetComponent<SecondaryFiring> ().SetEnergyCost (modifierCombo); }
/// <summary> /// Checks if a change is flagged in the collection. /// </summary> /// <param name="statType">the stat type</param> /// <returns>true if the stat type is flagged; false otherwise</returns> private bool IsChangeFlagged(ModifierType statType) { return m_changes.Where(statChange => statChange == statType).Any(); }
/// <summary> /// Invokes a <see cref="UpdateEnahancementDelegate" /> delegate to update the neccessary fields /// for the given change. /// </summary> /// <param name="updateUnit">the <see cref="Unit" /> to update</param> /// <param name="changeType">the change type</param> /// <param name="statsCollection">the enhancements collection</param> internal static void CommitChange(Unit updateUnit, ModifierType changeType, ModifierCollection statsCollection) { m_updateDelegates[changeType].Invoke(updateUnit, changeType, statsCollection); }
/// <summary> /// Adds a given value to the existing value for a specific <see cref="ModifierType" /> in a /// specific <see cref="ModifierCategory">collection</see>. /// </summary> /// <param name="collectionType">the collection type</param> /// <param name="statType">the stat type</param> /// <param name="value">the amount to add</param> public void AddToStat(ModifierCategory collectionType, ModifierType statType, int value) { AddToStat(collectionType, statType, (double)value); }
private static InputModifiers GetModifierKeys(ModifierType state) { var rv = InputModifiers.None; if (state.HasFlag(ModifierType.ControlMask)) rv |= InputModifiers.Control; if (state.HasFlag(ModifierType.ShiftMask)) rv |= InputModifiers.Shift; if (state.HasFlag(ModifierType.Mod1Mask)) rv |= InputModifiers.Control; if(state.HasFlag(ModifierType.Button1Mask)) rv |= InputModifiers.LeftMouseButton; if (state.HasFlag(ModifierType.Button2Mask)) rv |= InputModifiers.RightMouseButton; if (state.HasFlag(ModifierType.Button3Mask)) rv |= InputModifiers.MiddleMouseButton; return rv; }
/// <summary> /// Removes a given amount from the existing value for a specific <see cref="ModifierType" /> in a /// specific <see cref="ModifierCategory">collection</see>. /// </summary> /// <param name="collectionType">the collection type</param> /// <param name="statType">the stat type</param> /// <param name="value">the amount to remove</param> public void RemoveFromStat(ModifierCategory collectionType, ModifierType statType, int value) { RemoveFromStat(collectionType, statType, (double)value); }
public override void PerformActionOnTile(FieldPos TilePos, ModifierType Modifiers) { if(application.CurrentTilemap.InBounds(TilePos)) brush.ApplyToTilemap(TilePos, application.CurrentTilemap); }
public new void OnMouseMotion(Vector mousePos, ModifierType Modifiers) { if (UpdateMouseTilePos(mousePos)) { if (state == State.DRAWING) { if (LastDrawPos != MouseTilePos) { LastDrawPos = MouseTilePos; brush.ApplyToTilemap(MouseTilePos, application.CurrentTilemap); } } if (state == State.FILLING || state == State.SELECTING) { UpdateSelection(); } FireRedraw(); } }
/// <summary> /// Set a value without logging the change /// (used when an Updater makes an internal change and ensures to synchronizes the update itself) /// </summary> internal void SetValueUnlogged(ModifierCategory collectionType, ModifierType statType, double value) { m_changeLock.EnterWriteLock(); try { m_modifiers[collectionType][statType] = value; } finally { m_changeLock.ExitWriteLock(); } }
/// <summary> /// Sets a specific value for a specific <see cref="ModifierType" /> in a specific /// <see cref="ModifierCategory">collection</see>. /// </summary> /// <param name="collectionType">the collection type</param> /// <param name="statType">the stat type</param> /// <param name="value">the amount to set</param> public void SetValue(ModifierCategory collectionType, ModifierType statType, int value) { SetValue(collectionType, statType, (double)value); }
/// <summary> /// Manually flags a modifier as changed. /// </summary> /// <param name="modifierType"></param> public void FlagChange(ModifierType modifierType) { m_changeLock.EnterWriteLock(); try { if (!IsChangeFlagged(modifierType)) { m_changes.AddLast(modifierType); } } finally { m_changeLock.ExitWriteLock(); } }
/// <summary> /// Gets the modified (total/final) value of a specific <see cref="ModifierType" /> for the /// <see cref="Unit">owner</see>. /// </summary> /// <param name="statType">the stat type</param> /// <returns>the modified value for the given <see cref="ModifierType" />; or <see cref="Double.MinValue" /> /// if there was an exception when executing the calculator.</returns> public double GetModified(ModifierType statType) { m_changeLock.EnterReadLock(); try { double staticVal = m_modifiers[ModifierCategory.BaseModifier][statType] + m_modifiers[ModifierCategory.PositiveModifier][statType] + m_modifiers[ModifierCategory.NegativeModifier][statType]; double posPercentMod = staticVal * m_modifiers[ModifierCategory.PositiveMultiplier][statType]; double negPercentMod = staticVal * m_modifiers[ModifierCategory.NegativeMultiplier][statType]; return staticVal + posPercentMod + negPercentMod; } finally { m_changeLock.ExitReadLock(); } }
/// <summary> /// Gets the value for a specific <see cref="ModifierType" /> and a specific <see cref="ModifierCategory" />. /// </summary> /// <param name="collectionType">the collection type</param> /// <param name="statType">the stat type</param> /// <returns>the value for the given collection type/stat type</returns> public float GetValue(ModifierCategory collectionType, ModifierType statType) { return (float)m_modifiers[collectionType][statType]; }