Beispiel #1
0
    private string receiveTreasure()
    {
        GameInfo player = BaseSaver.getGame();
        int      pick   = Random.Range(0, 20);

        if (pick == 0)
        {
            Debug.Log("Gained Attribute!");
            CharacterInfo.attributeType newAttrib = GameInfo.getAvailableAttribute(player);
            if (newAttrib != CharacterInfo.attributeType.None)
            {
                List <CharacterInfo.attributeType> attribs = new List <CharacterInfo.attributeType> (player.attributes);
                attribs.Add(newAttrib);
                player.attributes = attribs.ToArray();
            }
            return("Gained Attribute!");
        }
        else if (pick < 8)
        {
            Debug.Log("Gained Gold!");
            player.gold += Random.Range(80, 220);
            return("Gained Gold!");
        }
        else
        {
            Debug.Log("Gained Rations!");
            player.rations += Random.Range(200, 450);
            return("Gained Rations!");
        }
    }
Beispiel #2
0
    IEnumerator SaveConversation(GameObject npc)
    {
        AdventureMeta meta = BaseSaver.getAdventure();
        //meta.playerPos = new PosMeta(transform.position);
        NPCMain trainerMain = npc.GetComponent <NPCMain>();

        if (trainerMain.meta.infiniteTrainer)
        {
            meta.trainer = trainerMain.getInfiniteMeta(meta);
        }
        else
        {
            meta.trainer = trainerMain.getRefinedMeta();
        }
        meta.trainer.pos        = new PosMeta(npc.transform.position);
        meta.wild               = null;
        meta.isTrainerEncounter = true;

        Debug.Log(meta.ToString());
        Debug.Log(meta.trainer.ToString());

        BaseSaver.putAdventure(meta);
        BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(transform.position)));
        yield return(null);
    }
Beispiel #3
0
    IEnumerator DestWait(Collider2D other)
    {
        Destroy(other.gameObject);
        yield return(null);

        BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(transform.position)));
    }
Beispiel #4
0
    public void Populate()
    {
        PlayerMeta player = BaseSaver.GetPlayer();

        if (player != null && player.world == GameMeta.World.tutorial)
        {
            buffer = new string[] { };
            scene  = (sceneType)sceneTyp;
            switch (scene)
            {
            case sceneType.map: buffer = StoryStatic.GetMapTutorialString(); break;

            case sceneType.tech: buffer = StoryStatic.GetTechTutorialString(); break;

            case sceneType.clss: buffer = StoryStatic.GetClassSelectTutorialString(); break;

            case sceneType.main: buffer = StoryStatic.GetMainSelectTutorialString(); break;
            }
            if (buffer.Length == 0)
            {
                gameObject.SetActive(false);
            }
            txtMsg      = transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>();
            idx         = 0;
            txtMsg.text = buffer[idx];
            Debug.Log("txt: " + txtMsg.text);
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Beispiel #5
0
    void loadItems()
    {
        AdventureMeta            meta     = BaseSaver.getAdventure();
        Dictionary <string, int> treasure = meta.GetTreasureList();
        List <string>            keys     = new List <string>(treasure.Keys);

        GameObject.Find("MoneyTxt").GetComponent <Text>().text = "¥" + meta.getYen();
        for (int i = 1; i < 10; i++)
        {
            if (keys.Count >= i)
            {
                itemSubPnls[i - 1].SetActive(true);
                string img         = "I0" + i.ToString() + "Img";
                string nme         = "I0" + i.ToString() + "Name";
                string description = "I0" + i.ToString() + "Desc";
                string qty         = "I0" + i.ToString() + "Qty";

                GameObject.Find(img).GetComponent <Image>().sprite      = glossy.GetItem(keys[i - 1]).GetComponent <SpriteRenderer>().sprite;
                GameObject.Find(nme).GetComponent <Text>().text         = keys[i - 1];
                GameObject.Find(description).GetComponent <Text>().text = glossy.GetItem(keys[i - 1]).monTreas.description;
                GameObject.Find(qty).GetComponent <Text>().text         = treasure[keys[i - 1]].ToString();
            }
            else
            {
                itemSubPnls[i - 1].SetActive(false);
            }
        }
    }
Beispiel #6
0
    public string EndGameDialog()
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        GameMeta   game   = BaseSaver.GetGame();

        Unit.FactionType faction = player.faction;
        World            world   = player.world;

        string       returnStr         = "Congratulations! You have completed the campaign for faction: " + faction.ToString() + "!";
        List <World> unlockedWorldsLst = new List <World>(game.unlockedWorlds);

        if (world != World.candy)
        {
            List <Unit.FactionType> unlockedFactionLst = new List <Unit.FactionType>(game.unlockedFactions);
            switch (faction)
            {
            case Unit.FactionType.Human:
                if (!unlockedWorldsLst.Contains(World.mountain))
                {
                    unlockedWorldsLst.Add(World.mountain);
                    unlockedFactionLst.Add(Unit.FactionType.Egypt);
                    returnStr += "\n\n Unlocked faction: " + Unit.FactionType.Egypt.ToString() + "!";
                }
                break;

            case Unit.FactionType.Egypt:
                if (!unlockedWorldsLst.Contains(World.pyramid))
                {
                    unlockedWorldsLst.Add(World.pyramid);
                    unlockedFactionLst.Add(Unit.FactionType.Cthulhu);
                    returnStr += "\n\n Unlocked faction: " + Unit.FactionType.Cthulhu.ToString() + "!";
                }
                break;

            case Unit.FactionType.Cthulhu:
                if (!unlockedWorldsLst.Contains(World.candy))
                {
                    unlockedWorldsLst.Add(World.candy);
                    returnStr += "\n\n Unlocked world: " + World.candy.ToString() + "!";
                }
                break;
            }
            game.unlockedFactions = unlockedFactionLst.ToArray();
            game.unlockedWorlds   = unlockedWorldsLst.ToArray();
        }
        else
        {
            if (!unlockedWorldsLst.Contains(World.final))
            {
                unlockedWorldsLst.Add(World.final);
            }
            returnStr += "\n\n The world has been saved! Your accomplishments have been logged in the annals history.";
        }
        BaseSaver.PutGame(game);
        HighScoreMeta.SaveCurrentScore();

        //Reset the current save now that the factions / worlds have been unlocked and highscores saved
        BaseSaver.ResetAtSave();
        return(returnStr);
    }
Beispiel #7
0
    void calcDistance(HexCell[] cells)
    {
        foreach (QuestInfo quest in game.quests)
        {
            HexCell start  = cells [0];
            HexCell finish = cells [0];
            foreach (HexCell tCell in cells)
            {
                if (tCell.GetInfo().human)
                {
                    start = tCell;
                }
                if (quest.completed)
                {
                    if (tCell.coordinates.Equals(quest.startIdx))
                    {
                        finish = tCell;
                    }
                }
                else
                {
                    if (tCell.coordinates.Equals(quest.endIdx))
                    {
                        finish = tCell;
                    }
                }
//        if (tCell.coordinates.Equals(quest.startIdx)) {
//          print ("Found start");
//          start = tCell;
//        }
//        if (tCell.coordinates.Equals(quest.endIdx)){
//          print ("Found finish");
//          finish = tCell;
//        }
            }

            HexCell[] path = HexAI.aStar(cells, start, finish);
            if (path != null)
            {
                print("Proximity Length: " + path.Length.ToString());
                if (path.Length < 5)
                {
                    quest.distance = QuestInfo.DistanceType.Burning;
                }
                else if (path.Length < 8)
                {
                    quest.distance = QuestInfo.DistanceType.Warmer;
                }
                else
                {
                    quest.distance = QuestInfo.DistanceType.Cold;
                }
                BaseSaver.putGame(game);
            }
            else
            {
                print("No path found to goal");
            }
        }
    }
Beispiel #8
0
    void Start()
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        Glossary   glossy = glossary.GetComponent <Glossary>();

        string[] endings = new string[] { "Death has come..." };
        switch (player.faction)
        {
        case Unit.FactionType.Human:
            faction.sprite = glossy.humanFaction;
            endings        = StoryStatic.HUMAN_DEATHS;
            break;

        case Unit.FactionType.Cthulhu:
            faction.sprite = glossy.chtulhuFaction;
            endings        = StoryStatic.CTHULHU_DEATHS;
            break;

        case Unit.FactionType.Egypt:
            faction.sprite = glossy.egyptFaction;
            endings        = StoryStatic.EGYPT_DEATHS;
            break;
        }
        GetComponent <Image>().color = HelperScripts.GetColorByFaction(player.faction);
        HelperScripts.Shuffle(endings);
        headerTxtl.text = endings[0];
    }
Beispiel #9
0
    void PopulateInfo(LocationInfo info)
    {
        if (info.nxtScene.Length > 0)
        {
            BaseSaver.putGame(gameState.Pop());
            SceneManager.LoadScene(info.nxtScene);
        }

        header.GetComponent <Text> ().text      = info.header;
        description.GetComponent <Text> ().text = info.description;
        if (LocationInfo.LocType.None != info.img)
        {
            Sprite img = info.gameObject.GetComponent <Image> ().sprite;
            if (info.img == LocationInfo.LocType.Char)
            {
                character.SetActive(true);
                character.GetComponent <Image> ().sprite = img;

                StartCoroutine(Jump(character));
            }
            else
            {
                image.GetComponent <Image> ().sprite = img;
                character.SetActive(false);
            }
        }
        else
        {
            character.SetActive(false);
        }

        PopulateButtons(info);
    }
Beispiel #10
0
    void PopulatePlayer(TileProxy[] sideTiles)
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        //Queue<TileProxy> validTls = new Queue<TileProxy>(GetSideTiles(BoardProxy.PLAYER_TEAM));
        Queue <TileProxy> validTls = new Queue <TileProxy>(sideTiles);
        List <UnitProxy>  units    = new List <UnitProxy>();
        List <Unit>       roster   = new List <Unit>(player.characters);

        roster.Reverse();
        //Debug.Log("PopulatePlayer: " + validTls.Count.ToString());
        List <Unit> inactiveUnits = new List <Unit>();

        for (int i = 3; i < roster.Count; i++)
        {
            inactiveUnits.Add(roster[i]);
        }

        for (int i = 0; i < roster.Count && i < 3; i++)
        {
            Unit cMeta = new Unit(roster[i]);
            //UnitProxy goodGuy = Instantiate(glossary.GetComponent<Glossary>().units[PLAYER_TEAM], transform);
            UnitProxy goodGuy = Instantiate(ClassNode.ComputeClassBaseUnit(cMeta.GetFactionType(),
                                                                           cMeta.GetUnitType(), glossary.GetComponent <Glossary>()), transform);
            units.Add(goodGuy);
            cMeta = ClassNode.ApplyClassBonusesBattle(cMeta, inactiveUnits.ToArray());
            goodGuy.PutData(cMeta);
            goodGuy.Init();
            TileProxy popTile = validTls.Dequeue();
            popTile.ReceiveGridObjectProxy(goodGuy);
            goodGuy.SnapToCurrentPosition();
            //Debug.Log("goodGuy placed at: " + popTile.GetPosition().ToString());
        }
    }
    void Awake()
    {
        selected = "";
        PlayerMeta meta = BaseSaver.GetPlayer();

        destSave = new List <string>(meta.stats.dests);
    }
    public void PutSelect(string selected)
    {
        if (this.selected == selected)
        {
            PlayerMeta player = BaseSaver.GetPlayer();
            player.lastDest = selected;
            BaseSaver.PutPlayer(player);

            /*
             * TODO: This is where the board eventually needs to be laoded.
             * For now we have a blank board with a few chars
             */
            BaseSaver.PutBoard(MapStatic.ReturnTestBoardDests()[selected]);
            SceneManager.LoadScene("BattleScene");
        }
        else
        {
            if (this.selected.Length > 0)
            {
                ByName(this.selected).transform.GetChild(0).gameObject.SetActive(false);
            }
            this.selected = selected;
            ByName(this.selected).transform.GetChild(0).gameObject.SetActive(true);
        }
    }
Beispiel #13
0
    public void SavePosition()
    {
        PlayerMeta  player = BaseSaver.GetPlayer();
        List <Unit> units  = new List <Unit>();

        foreach (Transform child in chrSelect.transform)
        {
            foreach (Transform chld in child)
            {
                foreach (Unit unt in player.characters)
                {
                    if (chld.name.Equals("CharName") && chld.GetComponent <TextMeshProUGUI>().text.Equals(unt.characterMoniker))
                    {
                        if (!units.Where(un => un.characterMoniker.Equals(unt.characterMoniker)).Any())
                        {
                            units.Add(unt);
                        }
                    }
                }
            }
        }
        units.Reverse();
        player.characters = units.ToArray();
        //player.characters.Reverse();
        Debug.Log("Player Units: " + player.characters.Length.ToString());
        BaseSaver.PutPlayer(player);
    }
Beispiel #14
0
    public static Dictionary <string, BoardMeta> ReturnTestBoardDests(bool tutorial)
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        Dictionary <string, BoardMeta> board = new Dictionary <string, BoardMeta>();

        switch (player.world)
        {
        case GameMeta.World.nile:
            board.Add("Dest1", new BoardMeta(6, 6, CreateFromExp(1, 1, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest2" }));
            board.Add("Dest2", new BoardMeta(6, 6, CreateFromExp(2, 2, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest3" }));
            board.Add("Dest3", new BoardMeta(8, 8, CreateFromExp(2, 2, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest4" }));
            board.Add("Dest4", new BoardMeta(8, 8, CreateFromExp(2, 2, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest5" }));
            board.Add("Dest5", new BoardMeta(9, 9, CreateFromExp(2, 2, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest6" }));
            board.Add("Dest6", new BoardMeta(9, 9, CreateFromExp(2, 3, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest7" }));
            board.Add("Dest7", new BoardMeta(10, 10, CreateFromExp(3, 3, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest8" }));
            board.Add("Dest8", new BoardMeta(11, 11, CreateFromExp(3, 4, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest9" }));
            board.Add("Dest9", new BoardMeta(12, 12, CreateFromExp(3, 6, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest10" }));
            board.Add("Dest10", new BoardMeta(14, 14, CreateFromExp(3, 8, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest11" }));
            return(board);

        case GameMeta.World.mountain:
            board.Add("Dest1", new BoardMeta(6, 6, CreateFromExp(1, 1, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest2" }));
            board.Add("Dest2", new BoardMeta(6, 6, CreateFromExp(2, 2, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest3" }));
            board.Add("Dest3", new BoardMeta(8, 8, CreateFromExp(2, 2, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest4" }));
            board.Add("Dest4", new BoardMeta(8, 8, CreateFromExp(2, 3, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest5" }));
            board.Add("Dest5", new BoardMeta(9, 9, CreateFromExp(2, 3, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest6" }));
            board.Add("Dest6", new BoardMeta(9, 9, CreateFromExp(3, 5, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest7" }));
            board.Add("Dest7", new BoardMeta(10, 10, CreateFromExp(3, 7, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest8" }));
            board.Add("Dest8", new BoardMeta(11, 11, CreateFromExp(3, 9, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest9" }));
            board.Add("Dest9", new BoardMeta(12, 12, CreateFromExp(3, 10, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest10" }));
            board.Add("Dest10", new BoardMeta(14, 14, CreateFromExp(3, 12, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest11" }));
            return(board);

        case GameMeta.World.pyramid:
            board.Add("Dest1", new BoardMeta(6, 6, CreateFromExp(1, 1, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest2" }));
            board.Add("Dest2", new BoardMeta(6, 6, CreateFromExp(1, 1, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest3" }));
            board.Add("Dest3", new BoardMeta(8, 8, CreateFromExp(2, 2, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest4" }));
            board.Add("Dest4", new BoardMeta(8, 8, CreateFromExp(2, 5, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest5" }));
            board.Add("Dest5", new BoardMeta(9, 9, CreateFromExp(2, 7, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest6" }));
            board.Add("Dest6", new BoardMeta(9, 9, CreateFromExp(3, 9, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest7" }));
            board.Add("Dest7", new BoardMeta(10, 10, CreateFromExp(3, 10, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest8" }));
            board.Add("Dest8", new BoardMeta(11, 11, CreateFromExp(3, 13, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest9" }));
            board.Add("Dest9", new BoardMeta(12, 12, CreateFromExp(3, 15, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest10" }));
            board.Add("Dest10", new BoardMeta(14, 14, CreateFromExp(3, 18, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest11" }));
            return(board);

        default:
            board.Add("Dest1", new BoardMeta(6, 6, CreateFromExp(1, 0, true), new CondMeta[] { new CondMeta() }, new string[] { "Dest2" }));
            board.Add("Dest2", new BoardMeta(6, 6, CreateFromExp(2, 2, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest3" }));
            board.Add("Dest3", new BoardMeta(8, 8, CreateFromExp(2, 4, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest4" }));
            board.Add("Dest4", new BoardMeta(8, 8, CreateFromExp(3, 6, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest5" }));
            board.Add("Dest5", new BoardMeta(9, 9, CreateFromExp(3, 9, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest6" }));
            board.Add("Dest6", new BoardMeta(9, 9, CreateFromExp(3, 12, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest7" }));
            board.Add("Dest7", new BoardMeta(10, 10, CreateFromExp(3, 15, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest8" }));
            board.Add("Dest8", new BoardMeta(11, 11, CreateFromExp(3, 19, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest9" }));
            board.Add("Dest9", new BoardMeta(12, 12, CreateFromExp(3, 22, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest10" }));
            board.Add("Dest10", new BoardMeta(14, 14, CreateFromExp(3, 25, tutorial), new CondMeta[] { new CondMeta() }, new string[] { "Dest11" }));
            return(board);
        }
    }
Beispiel #15
0
    public void ButtonClick(int sel)
    {
        int clicked = sel - 1;

        Debug.Log("Sel: " + sel.ToString());

        GameInfo game = BaseSaver.getGame();


        if (clicked < mainButtons.Length && thisLoc == QLocType.Main)
        {
            thisLoc = (QLocType)System.Enum.Parse(typeof(QLocType), mainButtons[clicked]);
        }
        else if (thisLoc == QLocType.Quests && thisSel == -1 && clicked < game.quests.Length)
        {
            thisSel = clicked;
        }
        else
        {
            if (thisSel > -1)
            {
                thisSel = -1;
            }
            else if (thisLoc != QLocType.Main)
            {
                thisLoc = QLocType.Main;
            }
            else
            {
                SceneManager.LoadScene("AdventureScene");
            }
        }
        PopulateInfo(thisLoc, thisSel);
    }
Beispiel #16
0
    protected override void checkEnd()
    {
        bool playersLeft = checkCells(true);
        bool enemyLeft   = checkCells(false);

        if (!playersLeft || !enemyLeft)
        {
            if (!playersLeft)
            {
                Debug.Log("Enemy Wins!");
            }
            else
            {
                Debug.Log("Player Wins!");
            }

            BattleInfo battle = BaseSaver.getBattle();
            //This means that the player was attacked by the monster
            if (battle == null)
            {
                battle          = new BattleInfo();
                battle.redirect = "AdventureScene";
            }
            battle.won = playersLeft;
            BaseSaver.putBattle(battle);

            SceneManager.LoadScene(battle.redirect);
        }
    }
Beispiel #17
0
    public static string[] GetTechTutorialString()
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        Dests      dest   = (Dests)Enum.Parse(typeof(Dests), player.stats.dests[player.stats.dests.Length - 1]);

        switch (dest)
        {
        case Dests.Dest1: return(new string[] { "This screen shows the stats of each of your units. Feel free to click around." });

        case Dests.Dest2: return(new string[] { "This screen shows the stats of each of your units. Feel free to click around." });

        case Dests.Dest3: return(new string[] {
                "When a unit gains enough experience they will be allowed to upgrade classes.",
                "To check if a unit can be upgraded, first click on the unit, then look at the number above it's current class.",
                "When you come to this screen after battle, it is because one or more of your units is ready to be upgraded",
                "Click on the unit with the moving star, then select one it's upgraded classes to continue.",
                "Try to experiment with different classes with your units. Only by building carefully and figuring out what each class does can you defeat Susie and decide the fate of the world."
            });

        case Dests.Dest4: return(new string[] {
                "There are hundreds of classes in Elder's Tale. Not all of them upgrade evenly. Classes that are stronger early in the game might be lacking at the end.",
                "Try to upgrade your units into classes that complement each other well."
            });

        case Dests.Dest5: return(new string[] { "Inactive units in your roster trigger passive effects during the game.",
                                                "Try mixing them up to see what each class does!",
                                                "There is a rumor that some classes give special bonuses when they are placed in the inactive slot." });

        default: return(new string[] {  });
        }
    }
Beispiel #18
0
    public void PutSelect(string selected)
    {
        PlayerMeta player        = BaseSaver.GetPlayer();
        BoardMeta  selectedBoard = BaseSaver.GetBoards()[(int)(StoryStatic.Dests)Enum.Parse(typeof(StoryStatic.Dests), selected)];

        if (this.selected == selected && !CompDests().Contains(selected))
        {
            player.lastDest = selected;
            BaseSaver.PutPlayer(player);
            BaseSaver.PutBoard(selectedBoard);
            MusicTransitionToBattle();
            SceneManager.LoadScene("BattleScene");
            //MusicTransitionToBattle();
        }
        else
        {
            BoardMeta bMeta = BaseSaver.GetBoard();
            if (this.selected.Length > 0)
            {
                ByName(this.selected).transform.GetChild(0).gameObject.SetActive(false);
            }
            this.selected = selected;
            ByName(this.selected).transform.GetChild(0).gameObject.SetActive(true);

            string mapName = StoryStatic.GetMapName(player.world, player.faction, this.selected);

            setDesc("<color=#9BC2C2>" + mapName + "</color>\n\n<color=#CFE4E4>" + selectedBoard.ReturnMapDesc() +
                    "</color>\n<color=#669999>" + CalcArmyString(selectedBoard.enemies) + "</color>");
        }
    }
Beispiel #19
0
 public void loadSteppedScene()
 {
     BaseSaver.setMapName(toScene.Split('.')[0]);
     BaseSaver.setMapConnection(toScene.Split('.')[1]);
     GameManager.instance.ReloadScene();
     //GameManager.instance.LoadScene("MainScene");
 }
    void EndGame(bool won)
    {
        BoardProxy.instance.gameOverPanel.SetActive(true);
        this.won = won;
        string txt = "Defeat";

        if (won)
        {
            List <UnitProxy> units  = BoardProxy.instance.GetUnits().Where(unit => unit.GetData().GetTeam() == BoardProxy.PLAYER_TEAM).ToList();
            PlayerMeta       player = BaseSaver.GetPlayer();
            List <Unit>      pChars = units.Select(unit => new Unit(unit.GetData())).ToList();
            List <string>    dests  = new List <string>(player.stats.dests);
            foreach (string unlock in BaseSaver.GetBoard().unlocks)
            {
                if (!dests.Contains(unlock))
                {
                    dests.Add(unlock);
                    unlkChar = true;
                }
            }
            player.stats.dests = dests.ToArray();
            player.characters  = pChars.ToArray();
            player.stats.dests = dests.ToArray();
            BaseSaver.PutPlayer(player);
            txt = "Victory";
        }
        BoardProxy.instance.gameOverPanel.transform.Find("GameOverHeader").GetComponent <TextMeshProUGUI>().text = txt;
    }
Beispiel #21
0
    public void LoadMaps()
    {
        Debug.Log("Load: " + m_DropOptions[m_Dropdown.value]);

        MapInfo map = BaseSaver.getMap(m_DropOptions[m_Dropdown.value]);

        if (map != null)
        {
//      cells = new HexCell[map.tiles.Length];
//
//      for (int z = 0, i = 0; z < map.h; z++) {
//        for (int x = 0; x < map.w; x++) {
//          CreateCell(x, z, i++);
//        }
//      }

            for (int i = 0; i < cells.Length; i++)
            {
                Debug.Log("Setting: " + map.tiles[i].type.ToString());
                cells[i].setType(map.tiles[i].type);
            }
            hexMesh.Triangulate(cells);
            ResetCells();
        }
    }
Beispiel #22
0
    public void SaveMap()
    {
        Debug.Log("Save Map Clicked");
//    Debug.Log(GameObject.Find ("MapNameField").GetComponent<InputField> ().text);
//
        List <TileInfo> mTiles = new List <TileInfo> ();

        MapInfo map = new MapInfo();

        map.h    = boardHeight;
        map.w    = boardWidth;
        map.name = GameObject.Find("MapNameField").GetComponent <InputField> ().text;

        foreach (HexCell cell in cells)
        {
            mTiles.Add(cell.GetTile());
        }

        map.tiles = mTiles.ToArray();

        BaseSaver.putMap(map);

        Debug.Log("Saved");

        Debug.Log("Current Maps");

        foreach (MapInfo mp in BaseSaver.getMaps())
        {
            Debug.Log(mp.name);
        }

        refreshMapDropDown();
    }
Beispiel #23
0
    protected override void Awake()
    {
        game = BaseSaver.getGame();

        GameObject.Find("HeaderTxt").GetComponent <Text> ().text = game.name;

        gridCanvas = GetComponentInChildren <Canvas>();
        hexMesh    = GetComponentInChildren <HexMesh>();

        BattleInfo thisBattle = BaseSaver.getBattle();

        if (thisBattle != null)
        {
            boardHeight = thisBattle.height > 0 ? thisBattle.height : 10;
            boardWidth  = thisBattle.width > 0 ? thisBattle.width : 10;
        }
        else
        {
            boardHeight = 6;
            boardWidth  = 8;
        }

        cells = new HexCell[boardHeight * boardWidth];

        for (int z = 0, i = 0; z < boardHeight; z++)
        {
            for (int x = 0; x < boardWidth; x++)
            {
                CreateCell(x, z, i++);
            }
        }
    }
Beispiel #24
0
    private void Awake()
    {
        gameOverPanel.SetActive(false);
        PlayerMeta player = BaseSaver.GetPlayer();

        background1.SetActive(false);
        background2.SetActive(false);
        background3.SetActive(false);
        background4.SetActive(false);
        switch (player.world)
        {
        case GameMeta.World.nile: background1.SetActive(true); break;

        case GameMeta.World.mountain: background2.SetActive(true); break;

        case GameMeta.World.pyramid: background3.SetActive(true); break;

        case GameMeta.World.candy: background4.SetActive(true); break;
        }

        boardMeta = BaseSaver.GetBoard();
        width     = boardMeta.width;
        height    = boardMeta.height;

        tileMap  = GetComponentInChildren <Tilemap>();
        instance = this;
        //tiles = new TileProxy[width, height];
        grid = GetComponent <Grid>();
    }
Beispiel #25
0
    public string CalcArmyString(Unit[] chars)
    {
        PlayerMeta player = BaseSaver.GetPlayer();

        List <string> mages  = new List <string>(new string[] { "HumanBaseMage", "EgyptBaseMage", "CthulhuBaseMage" });
        List <string> scouts = new List <string>(new string[] { "HumanBaseScout", "EgyptBaseScout", "CthulhuBaseScout" });

        int rM  = 0;
        int rSc = 0;
        int rSo = 0;

        foreach (Unit unt in chars)
        {
            ClassNode clss = unt.GetCurrentClass();
            while (clss.GetParent() != null)
            {
                clss = clss.GetParent();
            }
            if (mages.Contains(clss.GetType().ToString()))
            {
                rM++;
            }
            else if (scouts.Contains(clss.GetType().ToString()))
            {
                rSc++;
            }
            else
            {
                rSo++;
            }
        }

        return("\nMage: " + rM.ToString() + "\nScout: " + rSc.ToString() + "\nSoldier: " + rSo.ToString());
    }
Beispiel #26
0
    // Use this for initialization
    public void Start()
    {
        BaseSaver.putSaveNumber(fileIdx);
        AdventureMeta meta = BaseSaver.getAdventure();

        if (meta != null)
        {
            float pwr = 0;
            foreach (PlayerRosterMeta pM in meta.roster)
            {
                pwr += pM.getPower();
            }
            Power.GetComponent <Text>().text   = "Roster Pwr: " + Math.Round(pwr, 2).ToString();
            Temples.GetComponent <Text>().text = "Temples: " + meta.temples.Length.ToString();
            Map.GetComponent <Text>().text     = "Map: " + BaseSaver.getMap();
            MoheCnt.GetComponent <Text>().text = "Mohe #: " + (meta.roster.Length + meta.vault.Length).ToString();
            Yen.GetComponent <Text>().text     = "¥" + meta.getYen().ToString();
        }
        else
        {
            Power.GetComponent <Text>().text   = "";
            Temples.GetComponent <Text>().text = "";
            Map.GetComponent <Text>().text     = "New Save";
            MoheCnt.GetComponent <Text>().text = "";
            Yen.GetComponent <Text>().text     = "";
        }
    }
Beispiel #27
0
    public void UpgradeSelected(ClassNode cNode)
    {
        if (clickedUnit != null)
        {
            clickedUnit = cNode.UpgradeCharacter(clickedUnit);
            clickedUnit.SetCurrentClass(cNode.GetType().ToString());

            PlayerMeta  player   = BaseSaver.GetPlayer();
            Unit        unt      = player.characters.Where(chr => chr.characterName.Equals(clickedUnit.characterName)).First();
            List <Unit> nwRoster = new List <Unit>();
            foreach (Unit rUnt in player.characters)
            {
                if (rUnt.characterMoniker.Equals(clickedUnit.characterMoniker))
                {
                    nwRoster.Add(clickedUnit);
                }
                else
                {
                    nwRoster.Add(rUnt);
                }
            }
            player.characters = nwRoster.ToArray();
            BaseSaver.PutPlayer(player);
            RefreshSelect();
            CharClicked(clickedUnit);
        }
    }
Beispiel #28
0
    void Awake()
    {
        selected = "";
        PlayerMeta player = BaseSaver.GetPlayer();

        BoardMeta[] boards = BaseSaver.GetBoards();
        destSave = new List <string>(player.stats.dests);
        if (boards == null)
        {
            //SceneManager.LoadScene("ScrollingTextScene");
            Dictionary <string, BoardMeta> bMet = MapStatic.ReturnTestBoardDests(player.world == GameMeta.World.tutorial);
            List <BoardMeta> bList = new List <BoardMeta>();
            foreach (string key in bMet.Keys)
            {
                bList.Add(bMet[key]);
            }
            BaseSaver.PutBoards(bList.ToArray());
        }
        if (GameMeta.GameEnded())
        {
            SceneManager.LoadScene("ScrollingTextScene");
        }
        else if (GameMeta.RosterNeedsUpgrade())
        {
            SceneManager.LoadScene("TechScene");
        }

        ChangeDests(w0Dests, false);
        ChangeDests(w1Dests, false);
        ChangeDests(w2Dests, false);
        ChangeDests(w3Dests, false);
        ChangeDests(w4Dests, false);
        descPnl.SetActive(false);

        float time = player.stats.dests.Length == 1 ? 2 : .8f;

        switch (player.world)
        {
        case GameMeta.World.mountain:
            StartCoroutine(ZoomScale(new Vector3(850, -175, 0), w2Dests, time));
            break;

        case GameMeta.World.pyramid:
            StartCoroutine(ZoomScale(new Vector3(-600, -175, 0), w3Dests, time));
            break;

        case GameMeta.World.candy:
            StartCoroutine(ZoomScale(new Vector3(-600, 225, 0), w4Dests, time));
            break;

        case GameMeta.World.tutorial:
            StartCoroutine(ZoomScale(new Vector3(850, 225, 0), w0Dests, time));
            break;

        default:
            StartCoroutine(ZoomScale(new Vector3(850, 225, 0), w1Dests, time));
            break;
        }
    }
Beispiel #29
0
    public override void showPlayerMenu()
    {
        calcDistance(cells);

        BaseSaver.putBoard(cells, MAP_NAME, boardHeight, boardWidth);

        SceneManager.LoadScene("QuestScene");
    }
Beispiel #30
0
    //void DrawBetweenDests(List<GameObject> oDests)
    //{
    //  for (int i = 0; i < oDests.Count; i++)
    //  {
    //    LineRenderer line = oDests[i].GetComponent<LineRenderer>();
    //    if (i != oDests.Count - 1)
    //    {
    //      line.enabled = true;
    //      line.startWidth = 1f;
    //      line.endWidth = 1f;
    //      line.positionCount = 2;
    //      //Vector3 start = new Vector3(oDests[i].transform.position.x, oDests[i].transform.position.y, 0);

    //      Vector3 finish = oDests[i+1].GetComponent<RectTransform>().anchoredPosition3D;
    //      //Debug.Log("Start: " + start.ToString());
    //      Debug.Log("Finish: " + finish.ToString());
    //      //line.SetPosition(0, start);
    //      line.SetPosition(1, finish);
    //    }
    //    else
    //    {
    //      line.enabled = false;
    //    }
    //  }
    //}

    List <string> CompDests()
    {
        PlayerMeta    player    = BaseSaver.GetPlayer();
        List <string> compDests = new List <string>(player.stats.dests);

        compDests.RemoveAt(compDests.Count - 1);
        return(compDests);
    }