Esempio n. 1
0
    void OnSelectorSelected(SelectorSprite selector)
    {
        // if dino
        if (!selector.isAbilitySelector)
        {
            // if can afford dino, turn it on
            if (DinoInfo.Instance.CanAffordDino(selector.dinoType))
            {
                CombatInfo.Instance.selectedDinoType = selector.dinoType;
                EnableExclusiveParticles(selector);
            }
        }
        // if ability
        else
        {
            if (!CombatInfo.Instance.IsAbilityDeployable(selector.abilitySelectorAssociatedDino))
            {
                return;
            }

            // if deployable, and activated
            // shoot projectile from each dino
            foreach (BaseDino d in GetTree().GetNodesInGroup("dinos"))
            {
                if (d.dinoType == selector.abilitySelectorAssociatedDino)
                {
                    var abilityDino = (AbilityDino)d;
                    abilityDino.ShootProjectile();
                    GetAbilitySelector(selector.abilityType).DisableSprite();

                    CombatInfo.Instance.abilitiesUsed.Append(DinoInfo.Instance.dinoTypesAndAbilities[d.dinoType]);
                }
            }
        }
    }
Esempio n. 2
0
    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++;
        }
    }
Esempio n. 3
0
    // turn on particles for this selector and turns off all other particles
    void EnableExclusiveParticles(SelectorSprite selectorToKeepOn)
    {
        var selectors = hBox.GetChildren().Cast <SelectorSprite>().ToList <SelectorSprite>();

        foreach (SelectorSprite s in selectors)
        {
            s.HideParticles();
            if (s == selectorToKeepOn)
            {
                s.ShowParticles();
            }
        }
    }
Esempio n. 4
0
 public static void publishSelectorSelected(SelectorSprite selector) => selectorSelected?.Invoke(selector);