Exemple #1
0
    void computeReward()
    {
        currencyTrigger = true;
        int maxCurrency = 200;

        if (levelTimer < 15)
        {
            maxCurrency = 50;
        }
        if (levelTimer < 10)
        {
            maxCurrency = 20;
        }
        if (levelTimer < 5)
        {
            maxCurrency = 5;
        }
        User currencyObj = readUserinfo();

        currencyObj.currency += maxCurrency;
        //Unlock next level
        Themeprogress thm = readTheme(currencyObj);

        thm.previousQuestion[currentLevel].passed += 1;

        if (thm.previousQuestion[currentLevel].passed >= (themeObject.levels[gameLevel].questions.Count / 2) && thm.unlocked == currentLevel && thm.unlocked + 1 < StaticClass.MaxLevels)
        {
            thm.unlocked += 1;
        }
        writeUserinfo(writeTheme(currencyObj, thm));
    }
Exemple #2
0
 User writeTheme(User userObj, Themeprogress instance)
 {
     for (int i = 0; i < userObj.progress.Count; i++)
     {
         if (userObj.progress[i].theme == instance.theme)
         {
             userObj.progress[i] = instance;
         }
     }
     return(userObj);
 }
Exemple #3
0
    Themeprogress readTheme(User userObj)
    {
        Themeprogress Theme = null;

        for (int i = 0; i < userObj.progress.Count; i++)
        {
            if (userObj.progress[i].theme == StaticClass.ThemeSelection)
            {
                Theme = (Themeprogress)userObj.progress[i];
            }
        }
        return(Theme);
    }
Exemple #4
0
 void SubmitAnswerAction(string answer)
 {
     if (string.Compare(answer.ToUpper(), Answer.ToUpper()) == 0)
     {
         infoMessage.text  = "Correct";
         infoMessage.color = Color.green;
         //timeDisplay.text="";
         if (currencyTrigger == false)
         {
             computeReward();
         }
         incrementSuccessCount();
         resetSinks();
         themeInstance = readTheme(readUserinfo());
         if (themeInstance.previousQuestion[currentLevel].passed < themeObject.levels[gameLevel].questions.Count)
         {
             StartCoroutine(NextQuestionScene());
         }
         else
         {
             StartCoroutine(ChangeScene());
         }
     }
 }
Exemple #5
0
    void Start()
    {
        //Revel Character Tracking
        revcharPos = new List <int>();

        //Back Button

        var backBut = Instantiate(returnBack, new Vector3(-3.75f, 1.61f, -5.00f), Quaternion.identity);

        backBut.GetComponent <Transform>().Rotate(new Vector3(0, 180, 0));
        backBut.GetComponent <Transform>().localScale = new Vector3(0.35f, 0.35f, 0.35f);
        //Dynamic Timer
        dynamicTimer = new List <GameObject>();
        colorDanger  = new List <GameObject>();

        //LimitTokenHint
        StaticClass.tokenHintUsed = 0;

        //Image Expansion parameters
        expandTrack = new Dictionary <SpriteRenderer, bool>();
        xs          = 0.5f;
        ys          = 0.5f;
        zs          = 0.5f;
        revt        = false;
        diff        = 0.001f;

        levelMap = new Dictionary <string, int>();
        levelMap.Add("EASY", 0);
        levelMap.Add("MEDIUM", 1);
        levelMap.Add("HARD", 2);

        ansPos   = new List <Object>();
        userPath = Application.persistentDataPath + "/user_info.json";


        currentLevel = levelMap[StaticClass.LevelSelection];


        var coinsAmount = Instantiate(currencyDisplay, new Vector3(2.55f, 1.77f, -5.0f), Quaternion.identity);

        coinsAmount.GetComponent <Transform>().Rotate(new Vector3(0, 180, 0));


        var coinsText1 = GameObject.FindWithTag("currencyValue").GetComponent <TextMesh>();

        //coinVal = Instantiate(coins, new Vector3(0.55f, 2.06f, -5.0f), Quaternion.identity).GetComponent<TextMesh>();

        Instantiate(freezeTime, new Vector3(2.0f, 0.91f, -5.0f), Quaternion.identity);
        freezeTimeObject = freezeTime.gameObject;

        var rmObj = Instantiate(removeKey, new Vector3(2.0f, -0.11f, -5.0f), Quaternion.identity);

        rmObj.GetComponent <Transform>().Rotate(new Vector3(0, 180, 0));
        rmObj.GetComponent <Transform>().localScale = new Vector3(0.17f, 0.17f, 0.17f);

        var tokObj = Instantiate(tokenHint, new Vector3(2.0f, -1.14f, -5.0f), Quaternion.identity);

        tokObj.GetComponent <Transform>().Rotate(new Vector3(0, 180, 0));
        tokObj.GetComponent <Transform>().localScale = new Vector3(0.17f, 0.17f, 0.17f);


        User currencyObj = readUserinfo();

        //coinVal.text = currencyObj.currency.ToString();
        coinsText1.text  = currencyObj.currency.ToString();
        coinsText1.color = Color.red;

        //var levelIndicator = Instantiate(hud,new Vector3(0.7f,2.06f,-5.0f),Quaternion.identity);
        //var textmeshLevel = levelIndicator.GetComponent<TextMesh>();

        //timeDisplay = Instantiate(hud, new Vector3(-1.34f,2.06f,-5.0f),Quaternion.identity).GetComponent<TextMesh>();
        //timeDisplay.GetComponent<Transform>().Rotate(new Vector3(0,180,0));

        infoMessage = Instantiate(hud, new Vector3(-0.82f, 0.3f, -5.0f), Quaternion.identity).GetComponent <TextMesh>();
        infoMessage.GetComponent <Transform>().Rotate(new Vector3(0, 180, 0));



        //levelIndicator.GetComponent<Transform>().Rotate(new Vector3(0,180,0));

        image1 = Instantiate(imageHolder, new Vector3(-2.58f, 0.15f, -5.0f), Quaternion.identity).GetComponent <SpriteRenderer>();
        image2 = Instantiate(imageHolder, new Vector3(-0.9f, 0.15f, -5.0f), Quaternion.identity).GetComponent <SpriteRenderer>();
        image3 = Instantiate(imageHolder, new Vector3(-2.58f, -1.35f, -5.0f), Quaternion.identity).GetComponent <SpriteRenderer>();
        image4 = Instantiate(imageHolder, new Vector3(-0.9f, -1.35f, -5.0f), Quaternion.identity).GetComponent <SpriteRenderer>();


        image1.GetComponent <Transform>().localScale = new Vector3(0.5f, 0.5f, 0.5f);
        image2.GetComponent <Transform>().localScale = new Vector3(0.5f, 0.5f, 0.5f);
        image3.GetComponent <Transform>().localScale = new Vector3(0.5f, 0.5f, 0.5f);
        image4.GetComponent <Transform>().localScale = new Vector3(0.5f, 0.5f, 0.5f);


        //textmeshLevel.text = StaticClass.LevelSelection;
        ///textmeshLevel.color = Color.red;

        levelTimer      = 25;
        fixedTimer      = 25;
        currencyTrigger = false;

        remove = false;
        Debug.Log(StaticClass.LevelSelection);
        Debug.Log(StaticClass.ThemeSelection);

        themeInstance = readTheme(readUserinfo());

        readJson("jsonData/" + StaticClass.ThemeSelection);


        keyBoardCreation();
        answerCreation();

        StartCoroutine(fetchImages());

        analyticsSuccessOrFailureComputed = false;
        freezeTimeComputed = false;
        sinkUsed           = false;
        incrementLevelCount();
        createTimer();
        incrementAllTriesCount();
    }