Esempio n. 1
0
    public void StartGachaSequence(BasePart.RARITY rarity)
    {
        flavorTextBg.SetActive(false);
        flavorText.gameObject.SetActive(false);
        nameText.gameObject.SetActive(false);

        gachaButton.SetActive(false);
        initialBackground.GetComponent <MoveBackground>().StopMove();
        StartCoroutine(AnimSequence(rarity));
    }
Esempio n. 2
0
    public List <PartData> GetPartsByRarity(BasePart.RARITY rarity)
    {
        List <PartData> partsList = new List <PartData>();

        foreach (var key in partsTable.Keys)
        {
            PartData part = partsTable[key];
            if (part.rarity == (int)rarity)
            {
                partsList.Add(part);
            }
        }

        return(partsList);
    }
Esempio n. 3
0
    private BasePart Roll(bool isGuarantee)
    {
        if (isGuarantee)
        {
            gachaRarity = RandomGachaGuaranteeSR();
        }
        else
        {
            gachaRarity = RandomGachaNoGuarantee();
        }

        List <PartData> parts  = PartsTable.Instance.GetPartsByRarity(gachaRarity);
        int             roll   = Random.Range(0, parts.Count);
        BasePart        partGO = BasePart.Create(parts[roll].name);

        // ADD TO INVENTORY
        PlayerData.Instance.AddInventoryItem(parts[roll].name);
        Debug.Log("Roll: " + parts[roll].name);

        return(partGO);
    }
    private void SetTextAndColor(Text indicator, BasePart.RARITY rarity)
    {
        switch (rarity)
        {
        case BasePart.RARITY.RARITY_RARE:
            indicator.GetComponent <Text>().text  = "R";
            indicator.GetComponent <Text>().color = RColor;
            break;

        case BasePart.RARITY.RARITY_SUPER_RARE:
            indicator.GetComponent <Text>().text  = "SR";
            indicator.GetComponent <Text>().color = SRColor;
            break;

        case BasePart.RARITY.RARITY_ULTRA_RARE:
            indicator.GetComponent <Text>().text  = "UR";
            indicator.GetComponent <Text>().color = URColor;
            break;

        default:
            break;
        }
    }
Esempio n. 5
0
    private IEnumerator AnimSequence(BasePart.RARITY rarity)
    {
        /*float panTime = 0f;
         * while (panTime <= 1.5f)
         * {
         *  panTime += Time.deltaTime;
         *  // move
         *  initialBackground.transform.position -= new Vector3(moveSpeedInitial * Time.deltaTime, 0f, 0f);
         *  yield return null;
         * }*/


        yield return(new WaitForSeconds(0.8f));

        float   time      = 0f;
        Vector3 startPos  = currentPanel.transform.position;
        Vector3 targetPos = zoomPoint.position;
        Image   image     = currentPanel.GetComponent <Image>();

        // zoom
        while (time <= 0.8f)
        {
            time += Time.deltaTime;
            // move
            //initialBackground.transform.position = Vector3.Lerp(startPos, targetPos, time * moveSpeed);
            // scale
            currentPanel.transform.localScale += Time.deltaTime * zoomInSpeed * new Vector3(1, 1, 1);
            // fade
            image.color = new Color(1f, 1f, 1f, 1f - (0.8f * time));
            yield return(null);
        }
        //transform.position = targetPos;

        // set initial scale and colour values
        panelR.transform.localScale  = initialPanelScale;
        panelSR.transform.localScale = initialPanelScale;
        panelUR.transform.localScale = initialPanelScale;
        image.color = new Color(1f, 1f, 1f, 1f);

        // load the corresponding rarity
        currentPanel.gameObject.SetActive(false);
        currentPanel = panelR.transform;

        Debug.Log("rarity: " + rarity);
        switch (rarity)
        {
        case BasePart.RARITY.RARITY_RARE:
            currentPanel = panelR.transform;
            panelR.SetActive(true);
            break;

        case BasePart.RARITY.RARITY_SUPER_RARE:
            currentPanel = panelSR.transform;
            panelSR.SetActive(true);
            break;

        case BasePart.RARITY.RARITY_ULTRA_RARE:
            currentPanel = panelUR.transform;
            panelUR.SetActive(true);
            break;
        }

        float panelScale = currentPanel.localScale.x;

        while (panelScale > 1f)
        {
            panelScale -= Time.deltaTime * 0.5f * zoomOutSpeed;
            if (panelScale < 1f)
            {
                panelScale = 1f;
            }
            currentPanel.localScale = new Vector3(panelScale, panelScale, panelScale);
            yield return(null);
        }

        gachaButton.SetActive(true);
    }
Esempio n. 6
0
    public void GachaRoll()
    {
        if (numSummons > 0)
        {
            if (!gachaEnded)
            {
                numSummons--;

                //BasePart partGO = Roll();
                // get next part
                BasePart partGO = summonList[numSummons];   // start taking from back of List
                partGO.gameObject.SetActive(true);
                gachaRarity = partGO.rarity;
                partGO.transform.localScale = new Vector3(0.45f, 0.45f, 0.45f);

                animator.StartSummonSequence(partGO.transform, isSingleSummon);
                switch (gachaRarity)
                {
                case BasePart.RARITY.RARITY_RARE:
                    particleSystemR.gameObject.SetActive(true);
                    particleSystemR.Play();
                    break;

                case BasePart.RARITY.RARITY_SUPER_RARE:
                    particleSystemSR.gameObject.SetActive(true);
                    particleSystemSR.Play();
                    break;

                case BasePart.RARITY.RARITY_ULTRA_RARE:
                    particleSystemUR.gameObject.SetActive(true);
                    particleSystemUR.Play();
                    break;
                }

                gachaEnded = true;
            }
            else
            {
                if (!isSingleSummon)
                {
                    summonList[numSummons].gameObject.SetActive(false);
                }
                gachaEnded = false;

                // turn off particle effects
                switch (gachaRarity)
                {
                case BasePart.RARITY.RARITY_RARE:
                    particleSystemR.Stop();
                    particleSystemR.gameObject.SetActive(false);
                    break;

                case BasePart.RARITY.RARITY_SUPER_RARE:
                    particleSystemSR.Stop();
                    particleSystemSR.gameObject.SetActive(false);
                    break;

                case BasePart.RARITY.RARITY_ULTRA_RARE:
                    particleSystemUR.Stop();
                    particleSystemUR.gameObject.SetActive(false);
                    break;
                }
                // turn off text
                flavorText.SetActive(false);
                nameText.SetActive(false);

                SummonAnim();
            }
        }
        else if (!isSingleSummon)
        {
            // show all summons
            for (int i = 0; i < summonList.Count; i++)
            {
                summonList[i].transform.position = summonPositions[summonList.Count - 1 - i];
                summonList[i].gameObject.SetActive(true);
                // resize to be smaller to fit screen
                summonList[i].transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
            }
            doneButton.SetActive(true);

            // turn off particle effects
            switch (gachaRarity)
            {
            case BasePart.RARITY.RARITY_RARE:
                particleSystemR.Stop();
                particleSystemR.gameObject.SetActive(false);
                break;

            case BasePart.RARITY.RARITY_SUPER_RARE:
                particleSystemSR.Stop();
                particleSystemSR.gameObject.SetActive(false);
                break;

            case BasePart.RARITY.RARITY_ULTRA_RARE:
                particleSystemUR.Stop();
                particleSystemUR.gameObject.SetActive(false);
                break;
            }

            // turn off text
            flavorText.SetActive(false);
            nameText.SetActive(false);
        }
    }
Esempio n. 7
0
 private void SummonAnim()
 {
     gachaRarity = summonList[numSummons - 1].rarity;    // get next summon
     // start animation sequence
     animator.StartGachaSequence(gachaRarity);
 }