Example #1
0
 public void reduceGold(int cost)
 {
     gold -= cost;
     InterScene.setAchievementProgress(5, gold);
     addToPopUpQueue(new int[] { 1, 10 });
     setGoldText();
 }
Example #2
0
 void unlock(int id)
 {
     if (!InterScene.saveFile.charactersUnlock[id])
     {
         InterScene.saveFile.charactersUnlock[id] = true;
         InterScene.saveToFile();
     }
 }
Example #3
0
 void Start()
 {
     //Fetch JSON data from files and parse it to InterScene
     InterScene.jsonDataString        = InterScene.fetchJsonData("data.json");
     InterScene.jsonSaveFileString    = InterScene.fetchJsonData("savefile.json");
     InterScene.jsonSettingFileString = InterScene.fetchJsonData("settings.json");
     InterScene.parseJsonString();
     InterScene.resetSingleRunAchievementsProgress();
     SetupSettings();
 }
Example #4
0
 public void reduceBomb()
 {
     bombs--;
     InterScene.setAchievementProgress(6, bombs);
     if (bombs < 0)
     {
         bombs = 0;
     }
     setBombText();
 }
Example #5
0
    public void addStat(string statName, int increment)
    {
        stats[statsId[statName]] += increment;

        if (InterScene.saveFile.achievements.list[4].progress < stats[statsId[statName]])
        {
            InterScene.setAchievementProgress(4, stats[statsId[statName]]);
        }

        setText(statsId[statName]);
    }
Example #6
0
    public void giveGold(int number, bool showPopUp = true)
    {
        gold += number;
        setGoldText();
        InterScene.setAchievementProgress(5, gold);

        if (showPopUp)
        {
            addToPopUpQueue(new int[] { 0, 10 });
            SE_coinScramble.playSound();
        }
    }
Example #7
0
 // Use this for initialization
 void Start()
 {
     createLinks();
     if (InterScene.toggleTutorial)
     {
         setUpTutorial();
     }
     else
     {
         setUpMap();
     }
     InterScene.addAchievementProgress(0, 1);
     InterScene.addAchievementProgress(3, 1);
 }
Example #8
0
    /*
     * IEnumerator startCombat(Monster m){
     *
     *      float waitFor = 0.5f;
     *      yield return new WaitForSeconds(waitFor);
     *
     *      if(m.getSpeed()>_s.getSpeed()){
     *              StartCoroutine(attack(m,false));
     *      }else{
     *              StartCoroutine(attack(m,true));
     *      }
     * }
     */
    IEnumerator createLoot()
    {
        SE_chest.playSound();
        InterScene.addAchievementProgress(1, 1);
        InterScene.addAchievementProgress(2, 1);
        float waitFor = 1f;

        yield return(new WaitForSeconds(waitFor));

        _s.createItem();
        yield return(new WaitForSeconds(waitFor));

        setZoom(false);
        switchControl(false);
    }
Example #9
0
 public void reduceStock()
 {
     //Reduce the stock of the item
     if (currentMerchant.getIsRelic())
     {
         //If it's a relic shop, consume relics
         if (InterScene.saveFile.stats.artifact >= cost)
         {
             if (currentMerchant.getInStock(id))
             {
                 currentMerchant.setInStock(id, false);
                 SE_coinTransfer.playSound();
                 InterScene.saveFile.stats.artifact -= cost;
                 InterScene.saveToFile();
                 _s.SendMessage(effectName);
             }
         }
         else
         {
             SE_coinMissing.playSound();
         }
     }
     else
     {
         //Consume gold
         if (_s.getGold() >= cost)
         {
             if (currentMerchant.getInStock(id))
             {
                 currentMerchant.setInStock(id, false);
                 SE_coinTransfer.playSound();
                 if (_s.thiefRoll())
                 {
                 }
                 else
                 {
                     _s.reduceGold(cost);
                 }
                 _s.SendMessage(effectName);
             }
         }
         else
         {
             SE_coinMissing.playSound();
         }
     }
     setSoldOut();
 }
Example #10
0
 void resetStatsFromBless()
 {
     while (blessStrength > 0)
     {
         if (curseCountdown > 0)
         {
             InterScene.addAchievementProgress(11, 1);
         }
         reduceStat("def", 1);
         reduceStat("dmg", 1);
         reduceStat("spd", 1);
         reduceStat("acc", 1);
         blessStrength--;
     }
     blessText.text = blessCountdown.ToString();
 }
Example #11
0
    IEnumerator createCurse()
    {
        InterScene.addAchievementProgress(9, 1);
        //Instantiate(Resources.Load("Curse"),_player.transform.position,new Quaternion());
        curse.transform.position = _player.transform.position;
        curse.SetActive(true);
        SE_curse.playSound();
        float waitFor = 3f;

        yield return(new WaitForSeconds(waitFor));

        curse.SetActive(false);
        _s.addCurseCounter();
        setZoom(false);
        switchControl(false);
    }
Example #12
0
    void trap()
    {
        InterScene.addAchievementProgress(7, 1);
        //Generate a random number of projectile at random interval
        //between maxNumberOfProjectile/2 & maxNumberOfProjectile

        bool[][] possibility = { new bool[3], new bool[3], new bool[3] };
        possibility[0][0] = true;
        possibility[1][1] = true;
        possibility[2][2] = true;
        bool[] horizontal = possibility[Random.Range(0, possibility.Length)];
        bool[] vertical   = possibility[Random.Range(0, possibility.Length)];
        int[]  possibleHorizontalDirection = { 90, 270 };
        int[]  possibleVerticalDirection   = { 0, 180 };
        //0=up,90=right,180=down,270=left
        int direction;

        for (int i = 0; i < horizontal.Length; i++)
        {
            if (!horizontal[i])
            {
                direction = Random.Range(0, 2);
                StartCoroutine(createProjectile(_player.transform.position.x + (1 * (direction * 2 - 1)), _player.transform.position.z + 0.3f * (i - 1), possibleHorizontalDirection[direction]));
                numberOfProjectilesInstances++;
            }
        }
        for (int i = 0; i < vertical.Length; i++)
        {
            if (!vertical[i])
            {
                direction = Random.Range(0, 2);
                StartCoroutine(createProjectile(_player.transform.position.x + 0.3f * (i - 1), _player.transform.position.z + (1 * (direction * 2 - 1)), possibleVerticalDirection[direction]));
                numberOfProjectilesInstances++;
            }
        }

        /*
         * numberOfProjectiles = Random.Range(maxNumberOfProjectiles/2,maxNumberOfProjectiles+1);
         * while (numberOfProjectiles>0)
         * {
         *      //Add & remove to counter
         *      StartCoroutine(createProjectile());
         *      numberOfProjectiles--;
         *      numberOfProjectilesInstances++;
         * }
         */
    }
Example #13
0
 void meditate(float power = 1)
 {
     if (numberOfMeditate > 0)
     {
         reduceMeditate(1);
         healHp(Mathf.RoundToInt(stats[1] * power));
         healFatigue(Mathf.RoundToInt(energyMax * power));
         curseCountdown = 0;
         blessCountdown = 0;
         reduceCounter();
         if (power >= 1)
         {
             InterScene.addAchievementProgress(10, 1);
             if (partyHasDemo)
             {
                 giveBomb(3);
                 addToPopUpQueue(new int[] { 0, 7 });
                 addToPopUpQueue(new int[] { 0, 9 });
             }
             if (restIsImproved)
             {
                 buffCountdown[0] += 3;
                 buffStrength[0]  += 2;
                 buffCountdown[1] += 3;
                 buffStrength[1]  += 2;
                 buffCountdown[2] += 3;
                 buffStrength[2]  += 2;
                 buffCountdown[3] += 3;
                 buffStrength[3]  += 2;
                 addStat("dmg", 2);
                 addStat("def", 2);
                 addStat("spd", 2);
                 addStat("acc", 2);
                 addToPopUpQueue(new int[] { 0, 3 });
                 addToPopUpQueue(new int[] { 0, 4 });
                 addToPopUpQueue(new int[] { 0, 5 });
                 addToPopUpQueue(new int[] { 0, 6 });
             }
         }
         meditateParticles.Play();
     }
 }
Example #14
0
 void nextFloor()
 {
     //Destoy current floor
     destroyRooms();
     dimX += floorSizeIncrement;
     dimY += floorSizeIncrement;
     if (dimX > maxFloorSize)
     {
         dimX = maxFloorSize;
     }
     if (dimY > maxFloorSize)
     {
         dimY = maxFloorSize;
     }
     InterScene.addAchievementProgress(0, 1);
     if (InterScene.timer < 1200)
     {
         InterScene.addAchievementProgress(3, 1);
     }
     //Load nextFloor;
     setUpMap();
 }
Example #15
0
 void initiateCombat()
 {
     InterScene.addAchievementProgress(8, 1);
     _bc.init();
 }
Example #16
0
 void artifact()
 {
     InterScene.saveFile.stats.artifact += 1;
     InterScene.saveToFile();
 }
Example #17
0
 public void giveBomb(int number)
 {
     bombs += number;
     InterScene.setAchievementProgress(6, bombs);
     setBombText();
 }
Example #18
0
    public void close()
    {
        List <int> newCharacters     = new List <int>();
        List <int> removedCharacters = new List <int>();
        List <int> newParty          = new List <int>();

        //Set new current party
        //Get removed character
        for (int i = 0; i < InterScene.party.Length; i++)
        {
            for (int j = 0; j < partySpaces.Length; j++)
            {
                if (partySpaces[j] == InterScene.party[i])
                {
                    break;
                }
                else
                {
                    if (j == partySpaces.Length - 1)
                    {
                        removedCharacters.Add(InterScene.party[i]);
                    }
                }
            }
        }
        for (int i = 0; i < partySpaces.Length; i++)
        {
            if (partySpaces[i] != -1)
            {
                for (int j = 0; j < InterScene.party.Length; j++)
                {
                    if (partySpaces[i] == InterScene.party[j])
                    {
                        break;
                    }
                    else
                    {
                        if (j == InterScene.party.Length - 1)
                        {
                            newCharacters.Add(partySpaces[i]);
                        }
                    }
                }
                newParty.Add(partySpaces[i]);
            }
        }

        if (newParty.Count > 0)
        {
            InterScene.setAchievementProgress(12, partySpaces.Length - newParty.Count);
            InterScene.party = newParty.ToArray();
            _player.setCharacterSprites(InterScene.party);
            //Remove effect of removed char & add effect of new char
            _s.fillStats(newCharacters.ToArray());
            _s.removeCharactersStats(removedCharacters.ToArray());
            _s.applyClassEffect(newCharacters.ToArray());
            _s.removeClassEffect(removedCharacters.ToArray());
            this.GetComponent <Canvas>().enabled = false;
            gameObject.SetActive(false);
            _GM.closeShop();
        }
        else
        {
            SE_badClick.playSound();
        }
    }