Example #1
0
 public QuestStep()
 {
     this.Description  = string.Empty;
     this.Reward       = string.Empty;
     this.Objectives   = new Dictionary <string, QuestObjective>();
     this.NpcLocations = new List <string>();
     this.ItemReward   = new List <string>();
     this.OnAbandon    = (p) => { };
     this.OnComplete   = (p) => { };
 }
Example #2
0
    /// <summary>
    /// Renders the post battle assessment menu based on the function parameters.
    /// </summary>
    /// <param name="NumberOfStars">The number of stars to render. Used to determine whether or not the medal renders.</param>
    /// <param name="PlayerActions">The actions (values of attacks) that the player executed. Used to detail the player's evaluation.</param>
    public void InitPostBattleMenuWith(int NumberOfStars, int[] PlayerActions)
    {
        this.NumberOfStars = NumberOfStars;
        this.PlayerActions = PlayerActions;

        float panelWidth = ResultsPanel.sizeDelta.x;

        //Set the size of the star panel using runtime values.
        StarPanel.sizeDelta = new Vector2(panelWidth, StarHeight);
        float totalHeightOffset = StarPanel.transform.position.y;

        totalHeightOffset = InitRow(StarHeight, totalHeightOffset, ref StarPanel);

        //We each star's position and size using the runtime absolute values.
        RectTransform star1 = Stars[0].GetComponent <RectTransform>();

        star1.sizeDelta = new Vector2(StarHeight, StarHeight);
        star1.position  = new Vector3(star1.position.x - star1.sizeDelta.x - StarMargin, star1.position.y, star1.position.z);

        RectTransform star2 = Stars[1].GetComponent <RectTransform>();

        star2.sizeDelta = new Vector2(StarHeight, StarHeight);

        RectTransform star3 = Stars[2].GetComponent <RectTransform>();

        star3.sizeDelta = new Vector2(StarHeight, StarHeight);
        star3.position  = new Vector3(star3.position.x + star3.sizeDelta.x + StarMargin, star3.position.y, star3.position.z);

        //We set the proper star color based on the player's performance.
        for (int i = 0; i < NumberOfStars; i++)
        {
            Stars[i].GetComponent <Image>().color = StarColor;
        }

        //We set the size of the medal based on runtime values.
        totalHeightOffset = InitRow(MedalHeight, totalHeightOffset, ref Medal);

        //If the player achieved mastery.
        if (NumberOfStars == 3)
        {
            Image medalImage = Medal.gameObject.GetComponent <Image>();
            medalImage.color          = Color.white;
            medalImage.overrideSprite = overrideMedalSprite;
            QuestDelegate.masteryQuestUpdated(1);
        }

        //We set the size of the text area that will display the user's actions.
        totalHeightOffset = InitRow(TotalTextHeight, totalHeightOffset, ref TextPanel);

        Text ResultText = TextPanel.GetComponent <Text>();

        ResultText.text = string.Empty;

        int[] results = new int[PlayerActions.Length / 2];
        int   total   = 0;

        for (int i = 0, j = 0; i < PlayerActions.Length; i += 2, j++)
        {
            int x = PlayerActions[i];
            int y = PlayerActions[i + 1];
            total     += (x + y);
            results[j] = (x + y);

            ResultText.text += string.Format("{0} + {1} = {2}\n", x, y, x + y);
        }

        if (results.Length > 1)
        {
            string summary = string.Empty;
            for (int i = 0; i < results.Length; i++)
            {
                if (i != results.Length - 1)
                {
                    summary += string.Format("{0} + ", results[i]);
                }
                else
                {
                    summary += string.Format("{0} = ", results[i]);
                }
            }
            summary         += total;
            ResultText.text += summary;
        }
        gameObject.SetActive(true);
        FireworksParticle.SetActive(true);
    }
Example #3
0
    // this method is called when the attack kills the target
    IEnumerator AttackAndKill()
    {
        GameObject mainCamera = GameObject.Find("Main Camera");

        AudioSource[] audios = mainCamera.GetComponents <AudioSource>();
        GameObject    enemy;

        A1_Button.SetActive(false);
        A2_Button.SetActive(false);
        A3_Button.SetActive(false);
        Attack_Button.SetActive(false);
        playerAttack = true;
        player.GetComponent <Animation>().Play("Attack");
        yield return(new WaitForSeconds(.5f));

        playerAttack = false;
        if (EnemyType == 1)
        {
            enemy = GameObject.Find("Cha_Slime battle (Clone)");
            enemy.GetComponent <Animation>().Play("Dead");
        }
        else if (EnemyType == 3)
        {
            enemy = GameObject.Find("Mean Looking Troll(Clone)");
            audios[4].Play();
            trollCount--;
            enemyHealthBar.GetComponent <HealthBarManager>().InitHealthBar(enemyRef, 0);
            yield return(new WaitForSeconds(.5f));

            if (trollCount == 2)
            {
                enemyHealth = Random.Range(7, 11);
            }
            if (trollCount == 1)
            {
                enemyHealth = 14;
            }
            enemyHealthBar.GetComponent <HealthBarManager>().InitHealthBar(enemyRef, enemyHealth);
            if (trollCount != 0)
            {
                enemy.transform.localScale += new Vector3(.2f, .2f, .2f);
                assignButtons();
                A1_Button.SetActive(true);
                A2_Button.SetActive(true);
                A3_Button.SetActive(true);
                Attack_Button.SetActive(true);
            }
        }
        else if (EnemyType == 4)
        {
            enemy = GameObject.Find("KittenBattle(Clone)");
            // play meow sound
            trollCount--;
            enemyHealthBar.GetComponent <HealthBarManager>().InitHealthBar(enemyRef, 0);
            yield return(new WaitForSeconds(.5f));

            if (trollCount == 2)
            {
                enemyHealth = 3;
            }
            else if (trollCount == 1)
            {
                enemyHealth = 4;
            }
            enemyHealthBar.GetComponent <HealthBarManager>().InitHealthBar(enemyRef, enemyHealth);
            if (trollCount != 0)
            {
                assignButtons();
                A1_Button.SetActive(true);
                A2_Button.SetActive(true);
                A3_Button.SetActive(true);
                Attack_Button.SetActive(true);
            }
        }
        tutorial.SetActive(true);
        audios[1].Play();
        if ((EnemyType != 3 && EnemyType != 4) || trollCount == 0)
        {
            audios[2].volume = 0;
            audios[6].volume = 0;
            audios[3].Play();
            enemyHealthBar.GetComponent <HealthBarManager>().InitHealthBar(enemyRef, 0);
            yield return(new WaitForSeconds(2));

            if (EnemyType == 1)
            {
                enemy = GameObject.Find("Cha_Slime battle (Clone)");
                Destroy(enemy);
            }
            else if (EnemyType == 2)
            {
                enemy = GameObject.Find("Battle jack(Clone)");
                Destroy(enemy);
            }
            else if (EnemyType == 3)
            {
                enemy = GameObject.Find("Mean Looking Troll(Clone)");
                Destroy(enemy);
                audios[5].Play();
            }
            else if (EnemyType == 4)
            {
                enemy = GameObject.Find("KittenBattle(Clone)");
                Destroy(enemy);
                QuestDelegate.startQuestForZone(1);
            }

            yield return(new WaitForSeconds(2));

            int[] playerActions = new int[actions.Count];
            for (int i = 0; i < actions.Count; i++)
            {
                playerActions[i] = actions[i];
            }

            if (playerHealth == 3)
            {
                postBattle.GetComponent <PostBattleMenu>().InitPostBattleMenuWith(3, playerActions);
                QuestLogManager.masteryQuestStatusUpdated(1);
            }
            else if (playerHealth == 2)
            {
                postBattle.GetComponent <PostBattleMenu>().InitPostBattleMenuWith(2, playerActions);
            }
            else if (playerHealth == 1)
            {
                postBattle.GetComponent <PostBattleMenu>().InitPostBattleMenuWith(1, playerActions);
            }
        }
    }