Exemplo n.º 1
0
    public void SkillButtonPressed(BaseMinionSkill.SkillType skill)
    {
        if (_pressDown)
        {
            return;
        }

        var m = _lvl.availableMinions.First(i => i.skillType == skill);

        if (m == null)
        {
            return;
        }

        Time.timeScale = .35f;

        _typeToSelect = skill;
        _pressDown    = true;

        _cameraMovement.SetCameraMovement(false);

        _rangeSprite.color = _skillToColor [skill];
        var      color = _ps.colorOverLifetime;
        Gradient grad  = new Gradient();

        grad.SetKeys(new GradientColorKey[] { new GradientColorKey(_skillToColor [skill], 0.0f), new GradientColorKey(_skillToColor [skill], 1.0f) }
                     , new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(0.0f, 1.0f) });

        color.color = grad;
    }
Exemplo n.º 2
0
    public static MinionType GetMinionTypeBySkill(BaseMinionSkill.SkillType type)
    {
        switch (type)
        {
        case BaseMinionSkill.SkillType.None:
            return(MinionType.Runner);

        case BaseMinionSkill.SkillType.HitShield:
            return(MinionType.Tank);

        case BaseMinionSkill.SkillType.SpeedBoost:
            return(MinionType.Runner);

        case BaseMinionSkill.SkillType.GiveHealth:
            return(MinionType.Healer);

        case BaseMinionSkill.SkillType.ChangeTarget:
            return(MinionType.Dove);

        case BaseMinionSkill.SkillType.SmokeBomb:
            return(MinionType.Zeppelin);

        case BaseMinionSkill.SkillType.WarScreamer:
            return(MinionType.WarScreamer);
        }

        return(MinionType.Runner);
    }
Exemplo n.º 3
0
    void OnMinionSkillButtonDown(BaseMinionSkill.SkillType skill)
    {
        var button = _outputButton.GetComponent <MinionSkillMouseDown>();

        button.OnSkillButtonDown -= OnMinionSkillButtonDown;
        _outputButton             = null;

        var parsedListeners = ParseListeners();
        var funcs           = new List <Tuple <Action <string>, string> >();

        foreach (var listener in parsedListeners)
        {
            int amount = 0;
            foreach (var item in listener.Item2)
            {
                var             p      = item.Item2 + "/" + listener.Item1;
                Action <string> action = (Action <string>)Delegate.CreateDelegate(typeof(Action <string>), this, item.Item1);
                funcs.Add(Tuple.Create(action, p));
                amount++;
            }
            _amountOfFunctionPerListener.Add(listener.Item1, amount);
        }

        foreach (var item in funcs)
        {
            item.Item1.Invoke(item.Item2);
        }
    }
    public void SetMinionSkillButton(Button baseBtn, BaseMinionSkill.SkillType skill, bool interactable, MinionsSkillManager minionSkillsManager)
    {
        var skillBtn = baseBtn.GetComponentInChildren <MinionSkillMouseDown> ();

        if (interactable)
        {
            skillBtn.InitButton(skill, minionSkillsManager.SkillButtonPressed);
            skillBtn.GetComponentInChildren <Text>().text = skill.ToString();
        }

        var fillImg = skillBtn.GetComponentsInChildren <Image>()[1];       //Returns btn.image and its child.image(DONT KNOW WHY)

        fillImg.fillAmount = interactable ? 0 : 1;
        skillBtn.GetComponent <Button> ().interactable = interactable;
        skillBtn.SetOnPointerDown(interactable);
    }
Exemplo n.º 5
0
    public void InitButton(BaseMinionSkill.SkillType myType, Action <BaseMinionSkill.SkillType> callback, string parentName, GameManager gm)
    {
        _init          = true;
        _myType        = myType;
        _originalColor = img.color;
        _originalScale = img.rectTransform.sizeDelta;


        _buttonBackground.enabled = true;

        OnSkillButtonDown += callback;
        name = "skill_button_" + parentName[parentName.Length - 1];

        if (myType == BaseMinionSkill.SkillType.None)
        {
            img.gameObject.SetActive(false);
            _buttonBackground.enabled = false;
        }
        else
        {
            img.sprite = gm.LoadedAssets.GetSpriteByName(GameplayUtils.GetMinionTypeBySkill(_myType).ToString() + "_skill");
            img.gameObject.SetActive(true);
        }
    }
Exemplo n.º 6
0
 public void InitButton(BaseMinionSkill.SkillType myType, Action <BaseMinionSkill.SkillType> callback)
 {
     _init              = true;
     _myType            = myType;
     OnSkillButtonDown += callback;
 }