예제 #1
0
    public void SelectNextItem()
    {
        if (currentItem == null)
        {
            return;
        }

        int currIndex = currentItem.objUI.transform.GetSiblingIndex();
        int nextIndex = currIndex;

        do
        {
            nextIndex = (nextIndex + 1) % (currentItem.objUI.transform.parent.childCount);
            GameObject nextIndexObj = currentItem.objUI.transform.parent.GetChild(nextIndex).gameObject;

            if (nextIndexObj.activeSelf)
            {
                this.currentItem.objUI.GetComponent <InventoryItemUI>().ToggleSelected(false);
                nextIndexObj.GetComponent <InventoryItemUI>().ToggleSelected(true);

                this.currentItem = this.items.Find((f) => f.objUI == nextIndexObj);
                EasyAudio.Get().audio.PlayOneShot(this.selectItemClip, 0.05f);
                return;
            }
        } while (nextIndex != currIndex);
    }
예제 #2
0
    public IEnumerator EndingGame()
    {
        playerActions.SetFreeze(true);
        SoundtrackManager.Get().ToggleSoundtrack(false);

        foreach (Collider2D coll in playerActions.GetComponentsInChildren <Collider2D>())
        {
            coll.enabled = false;
        }

        var player = playerActions.transform;

        yield return(new WaitForSeconds(1f));

        player.DOMoveY(player.transform.position.y + 1f, 5f);
        yield return(new WaitForSeconds(4f));

        player.DOScale(0f, 3f).SetEase(Ease.Linear);

        yield return(new WaitForSeconds(3f));

        blackscreen.GetComponent <Image>().color = Color.white;
        blackscreen.alpha = 0f;
        blackscreen.gameObject.SetActive(true);
        blackscreen.DOFade(1f, 3f);

        yield return(new WaitForSeconds(1.5f));

        EasyAudio.Get().audio.PlayOneShot(this.healSpell, 0.4f);
        yield return(new WaitForSeconds(1.5f));

        sickKid.transform.localRotation = Quaternion.identity;
        sickKid.frames   = healthyKidSprites;
        sickKid.duration = 1f;

        blackscreen.DOFade(0f, 1.5f);

        yield return(new WaitForSeconds(5f));

        cutsceneTyper.PrepareText("ENDING_CUTSCENE");

        cutsceneTyper.ToggleCanvasGroup(1f, 5f);

        yield return(cutsceneTyper.ShowText());

        yield return(new WaitForSeconds(10f));

        // Application.Quit();
        SceneLoader.LoadScene_("Title Screen");

        yield break;
    }
예제 #3
0
    public void AcquireItem(ItemsEnum kind)
    {
        var obj = GetItemUI(kind).objUI;

        obj.transform.SetAsLastSibling();
        obj.SetActive(true);

        if (currentItem.objUI == null)
        {
            obj.GetComponent <InventoryItemUI>().ToggleSelected(true);
            currentItem = GetItemUI(kind);
        }

        EasyAudio.Get().audio.PlayOneShot(this.selectItemClip, 0.05f);
    }
예제 #4
0
    IEnumerator PressEnter()
    {
        if (active)
        {
            yield break;
        }
        active = true;

        EasyAudio.Get().audio.PlayOneShot(enterSound, 0.5f);
        yield return(new WaitForSeconds(0.5f));

        StartCoroutine(fadeManager.Fade(1f, 1f));
        yield return(new WaitForSeconds(5f));

        SceneLoader.LoadScene_(gameScene);
    }
예제 #5
0
    void Explode()
    {
        EasyAudio.Get().audio.PlayOneShot(explosionClip, 0.4f);

        this.transform.localScale = Vector2.zero;
        Sequence sequence = DOTween.Sequence();

        sequence.Append(this.transform.DOScale(originalScale * 2, 0.2f).OnComplete(() =>
                                                                                   ExplosiveSideEffects()));
        sequence.Append(this.transform.DOScale(originalScale * 0f, 0.8f).OnPlay(() =>
                                                                                this.sr.DOColor(Color.white, 0.8f)).SetDelay(0.1f));
        sequence.OnComplete(() => barreira());
        sequence.Play();

        Camera.main.GetComponent <SpecialCamera>().ScreenShake(0.1f, 30);
    }
예제 #6
0
    void EmitSoundbite(string str)
    {
        if (new List <string>()
        {
            ".", "!", "?", ","
        }.Contains(str))
        {
            k = 0;
            return;
        }

        if (this.soundbite != null)
        {
            k++;
            if (k % 2 == 0)
            {
                EasyAudio.Get().audio.PlayOneShot(this.soundbite, 0.2f);
            }
        }
    }
예제 #7
0
    public void Change(ItemsEnum itemkind, int amount)
    {
        var itemUI = GetItemUI(itemkind).objUI.GetComponent <InventoryItemUI>();

        if (amount > 0)
        {
            EasyAudio.Get().audio.PlayOneShot(this.selectItemClip, 0.05f);
        }

        if (inventory[itemkind] == 0)
        {
            AcquireItem(itemkind);
        }
        if (inventory[itemkind] + amount == 0)
        {
            UnacquireItem(itemkind);
        }

        inventory[itemkind] += amount;
        itemUI.SetAmount(inventory[itemkind]);
    }
예제 #8
0
 void Die()
 {
     EasyAudio.Get().audio.PlayOneShot(this.fireballDeath, 0.05f);
     // Instantiate(fireballFailParticlesPrefab, this.transform.position, Quaternion.identity, this.transform.parent);
     Destroy(this.gameObject);
 }