Ejemplo n.º 1
0
    public void CollisionResponse(string _tag)
    {
        //Give Item to player at random from the item database
        tut = GameObject.FindGameObjectWithTag("GameScript").GetComponent <TutorialTextBox>();

        /* Rarity: C U M A R
         * Type: Weapons, Helmets, Chestpieces, Leggings, Shoes, Uses
         */

        float  diceResult = Random.Range(0.0f, 1.0f);
        string selectedRarity;

        tut.chestOpened = false;

        if (diceResult <= 0.4f)
        {
            selectedRarity = "Common";
        }
        else if (diceResult > 0.4f && diceResult <= 0.7f)
        {
            selectedRarity = "Uncommon";
        }
        else if (diceResult > 0.7f && diceResult <= 0.9f)
        {
            selectedRarity = "Magic";
        }
        else if (diceResult > 0.9f && diceResult <= 0.98f)
        {
            selectedRarity = "Ancient";
        }
        else
        {
            selectedRarity = "Relic";
        }


        m_ItemList = ItemDatabase.Instance.GenerateItem(selectedRarity);

        if (m_ItemList.Count <= 0)
        {
            return;
        }
        else
        {
            Item RandomItem = m_ItemList[Random.Range(0, m_ItemList.Count)];
            GameObject.FindGameObjectWithTag("Player").GetComponent <Player2D_Manager>().AddItem(RandomItem);

            string Input = "You've got " + RandomItem.Name + "(" + RandomItem.ItemRarity + ")!";
            GameObject.FindGameObjectWithTag("GameScript").GetComponent <CreateAnnouncement>().MakeAnnouncement(Input);
            Debug.Log("chest set to true");
            tut.chestOpened = true;
        }

        Destroy(gameObject);
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
    void NextStage()
    {
        Transform currentChild;
        Transform nextChild;

        if (tutorialStage < transform.childCount)
        {
            currentChild = transform.GetChild(tutorialStage++);
        }
        else
        {
            EndTutorial();
            return;
        }

        if (tutorialStage < transform.childCount)
        {
            nextChild = transform.GetChild(tutorialStage);
        }
        else
        {
            EndTutorial();
            return;
        }

        currentChild.gameObject.SetActive(false);

        TutorialTextBox next = nextChild.GetComponent <TutorialTextBox>();

        nextChild.gameObject.SetActive(true);
        currentRequirement = next.requirement;

        nextStage = false;

        canMove     = next.canMove;
        canZoom     = next.canZoom;
        canJump     = next.canJump;
        canPlanJump = next.canPlanJump;

        timeSinceLastStage = 0f;
    }