// Use this for initialization public virtual void Start() { if (isPickup) { return; } Transform tempObject = FindParent.FindParentTransformWithTag("Player", transform); while (FindParent.FindParentTransformWithTag("Player", tempObject) != null) { tempObject = FindParent.FindParentTransformWithTag("Player", tempObject); } Debug.Log(FindParent.callAmount); player = tempObject.gameObject; playerProperties = player.GetComponent <PlayerProperties>(); reticleUIElement = player.transform.Find("SinglePlayer UI/Reticle").gameObject; if (anim == null) { anim = GetComponent <Animator>(); } aud = GetComponent <AudioSource>(); updateAmmo = player.transform.Find("SinglePlayer UI/HUD/Ammo Count").GetComponent <UpdateAmmo>(); if (reticleGameObject && reticleGameObject.GetComponent <SpriteRenderer>()) { Debug.Log("There is a reticle gameObject attached to this weapon"); reticle = reticleGameObject.GetComponent <SpriteRenderer>().sprite; } }
public object setWindowContext(UserControl view) { view.DataContext = null; var parent = FindParent.FindChildParent <Window>(view); if (parent != null) { view.DataContext = (MainWindowViewModel)parent.DataContext; } return(view.DataContext); }
public void UpdateEnabledStates() { List <string> currentConflictNames = new List <string>(); foreach (CheckBox checkBox in CheckBoxes.Values) { if (checkBox.IsChecked.GetValueOrDefault(false)) { Buff buff = checkBox.Tag as Buff; foreach (string conflictName in buff.ConflictingBuffs) { if (!string.IsNullOrEmpty(conflictName) && !currentConflictNames.Contains(conflictName)) { currentConflictNames.Add(conflictName); } } } } foreach (CheckBox checkBox in CheckBoxes.Values) { checkBox.IsEnabled = true; //Buff buff = checkBox.Tag as Buff; Buff buff = (Buff)checkBox.Tag; if (string.IsNullOrEmpty(buff.Group)) { if (FindParent.ContainsKey(buff) && !CheckBoxes[FindParent[buff]].IsChecked.GetValueOrDefault(false)) { checkBox.IsEnabled = false; continue; } } if (!checkBox.IsChecked.GetValueOrDefault(false)) { foreach (string buffName in buff.ConflictingBuffs) { if (currentConflictNames.Contains(buffName)) { checkBox.IsEnabled = false; break; } } } } }
public void UpdateEnabledStates() { List <string> currentConflictNames = new List <string>(); foreach (CheckBox checkBox in CheckBoxes.Values) { if (checkBox.IsChecked.GetValueOrDefault(false)) { Buff buff = checkBox.Tag as Buff; foreach (string conflictName in buff.ConflictingBuffs) { if (!string.IsNullOrEmpty(conflictName) && !currentConflictNames.Contains(conflictName)) { currentConflictNames.Add(conflictName); } } } } foreach (CheckBox checkBox in CheckBoxes.Values) { checkBox.IsEnabled = true; //Buff buff = checkBox.Tag as Buff; Buff buff = (Buff)checkBox.Tag; if (Character != null && buff.Name == "Heroic Presence") { if (Character.Race == CharacterRace.Draenei || Character.Faction == CharacterFaction.Horde) { checkBox.IsEnabled = false; continue; } } if (!string.IsNullOrEmpty(buff.Group) && buff.Group == "Profession Buffs") { checkBox.IsEnabled = false; continue; } if (buff.Name.Contains("Mixology") && !character.HasProfession(Profession.Alchemy)) { checkBox.IsEnabled = false; checkBox.Visibility = Visibility.Collapsed; continue; } else if (buff.Name.Contains("Mixology") && character.HasProfession(Profession.Alchemy)) { checkBox.IsEnabled = true; checkBox.Visibility = Visibility.Visible; continue; } if (!string.IsNullOrEmpty(buff.SetName)) { checkBox.IsEnabled = false; continue; } if (string.IsNullOrEmpty(buff.Group)) { if (FindParent.ContainsKey(buff) && !CheckBoxes[FindParent[buff]].IsChecked.GetValueOrDefault(false)) { checkBox.IsEnabled = false; continue; } } if (!checkBox.IsChecked.GetValueOrDefault(false)) { foreach (string buffName in buff.ConflictingBuffs) { if (currentConflictNames.Contains(buffName)) { checkBox.IsEnabled = false; break; } } } } }