Ejemplo n.º 1
0
    void CheckInteractableDiamondButton(GeneratedCharacterBlock block)
    {
        var diamond = System.Convert.ToInt32(block.diamondText.text);

        if (this.diamond >= diamond)
        {
            block.diamondButton.interactable = !block.clickedOnDiamondButton;
        }
        else
        {
            block.diamondButton.interactable = false;
        }
    }
Ejemplo n.º 2
0
    void CheckInteractableGoldButton(GeneratedCharacterBlock block)
    {
        var gold = System.Convert.ToInt32(block.goldText.text);

        if (this.gold >= gold)
        {
            block.goldButton.interactable = !block.clickedOnGoldButton;
        }
        else
        {
            block.goldButton.interactable = false;
        }
    }
Ejemplo n.º 3
0
    IEnumerator SealRecruitedMark(GeneratedCharacterBlock block, bool executed)
    {
        if (!executed)
        {
            yield break;
        }
        block.recruitedMark.gameObject.SetActive(true);
        var percent = 0f;

        while (percent <= 1f)
        {
            percent += Time.deltaTime * 10f;
            block.recruitedMark.localScale = Vector3.Lerp(Vector3.one * 45, Vector3.one * 27, percent);
            yield return(null);
        }
    }
Ejemplo n.º 4
0
    void RegisterDiamondButton(GeneratedCharacterBlock block)
    {
        var diamond = System.Convert.ToInt32(block.diamondText.text);

        if (this.diamond < diamond)
        {
            block.diamondButton.interactable = false;
            return;
        }
        this.diamond -= diamond;
        StartCoroutine(RunAmountToDestination(diamondText, this.diamond));
        StartCoroutine(SelectCharacter(block.baseCharacter));
        // StartCoroutine(SelectiveEffect(block.baseCharacter));
        StartCoroutine(EffectReduceDiamonds(diamondText.transform, block.baseCharacter.transform, diamond, block));
        block.diamondButton.interactable = false;
        block.clickedOnGoldButton        = block.clickedOnDiamondButton = true;
        CharacterList.instance.AddCharacter(block.baseCharacter);
    }
Ejemplo n.º 5
0
    IEnumerator EffectReduceDiamonds(Transform pocket, Transform target, int amountDiamond, GeneratedCharacterBlock block)
    {
        var amount = amountDiamond / 1;

        amount = amount < 1 ? 1 : amount;
        // init array of gold and position
        var golds     = new Transform[amount];
        var positions = new Vector2[amount];

        for (var i = 0; i < amount; i++)
        {
            var gold = Instantiate <Transform>(_diamondRes, pocket.position, Quaternion.identity);
            gold.transform.localScale = Vector2.one * .625f;
            golds[i] = gold;
        }
        for (var i = 0; i < golds.Length; i++)
        {
            positions[i] = Random.insideUnitCircle * Random.Range(1, 2) + new Vector2(pocket.position.x, pocket.position.y);
        }
        // jump around target, then moving to destination
        for (var i = 0; i < golds.Length; i++)
        {
            StartCoroutine(JumpToDestination(golds[i], pocket.position, positions[i]
                                             , false
                                             , MoveToDestination(golds[i], target, true
                                                                 , SelectiveEffects(block.baseCharacter)
                                                                 , SealRecruitedMark(block, i == golds.Length - 1))));
            yield return(new WaitForSeconds(.02f));
        }
        golds     = null;
        positions = null;
    }