void SetupSelectors() { int selectorPositionInList = 1; foreach (KeyValuePair <Enums.Dinos, StreamTexture> n in d.dinoIcons) { // skip if not unlocked the dino yet if (!PlayerStats.Instance.dinosUnlocked.Contains(n.Key)) { continue; } SelectorSprite newSelector = (SelectorSprite)selectorScene.Instance(); newSelector.spriteTexture = n.Value; newSelector.dinoType = n.Key; newSelector.text = selectorPositionInList.ToString(); newSelector.Shortcut = new ShortCut(); newSelector.Shortcut.Shortcut = new InputEventKey(); ((InputEventKey)newSelector.Shortcut.Shortcut).Scancode = ((int)Godot.KeyList.Key0) + (uint)selectorPositionInList; hBox.AddChild(newSelector); selectorPositionInList++; } foreach (KeyValuePair <Enums.SpecialAbilities, StreamTexture> n in d.specialAbilityIcons) { Enums.Dinos associatedDino = d.GetDinoTypeFromAbility(n.Key); // skip if not unlocked the speical for the dino yet or if not unlocked the dino itself if (!PlayerStats.Instance.dinosUnlocked.Contains(associatedDino) || !d.GetDinoInfo(associatedDino).UnlockedSpecial()) { continue; } SelectorSprite newSelector = (SelectorSprite)selectorScene.Instance(); newSelector.isAbilitySelector = true; newSelector.spriteTexture = n.Value; newSelector.abilityType = n.Key; newSelector.dinoType = Enums.Dinos.None; newSelector.abilitySelectorAssociatedDino = associatedDino; newSelector.text = selectorPositionInList.ToString(); newSelector.customScale = new Vector2(0.07f, 0.07f); newSelector.Shortcut = new ShortCut(); newSelector.Shortcut.Shortcut = new InputEventKey(); ((InputEventKey)newSelector.Shortcut.Shortcut).Scancode = ((int)Godot.KeyList.Key0) + (uint)selectorPositionInList; hBox.AddChild(newSelector); selectorPositionInList++; } }
public bool IsAbilityDeployable(Enums.Dinos dinoType) { DinoInfo d = DinoInfo.Instance; var dinosLeft = GetTree().GetNodesInGroup("dinos"); bool specificDinoTypeLeft = false; foreach (BaseDino baseDino in dinosLeft) { if (baseDino.dinoType == dinoType) { specificDinoTypeLeft = true; } } // check for 3 things // 1. there are dinos of dinoType left that are still alive // 2. user has unlocked the special ability // 3. the associated ability for dinoType has not been used yet return(specificDinoTypeLeft && d.GetDinoInfo(dinoType).UnlockedSpecial() && !abilitiesUsed.Contains(DinoInfo.Instance.dinoTypesAndAbilities[dinoType])); }