Пример #1
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());
    }
Пример #2
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];
    }
Пример #3
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);
    }
Пример #4
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);
        }
    }
Пример #5
0
    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);
        }
    }
    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;
    }
Пример #7
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());
        }
    }
Пример #8
0
    void Awake()
    {
        selected = "";
        PlayerMeta meta = BaseSaver.GetPlayer();

        destSave = new List <string>(meta.stats.dests);
    }
Пример #9
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>");
        }
    }
Пример #10
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>();
    }
Пример #11
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);
        }
    }
Пример #12
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);
        }
    }
Пример #13
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[] {  });
        }
    }
Пример #14
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);
    }
Пример #15
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;
        }
    }
Пример #16
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);
    }
Пример #17
0
    TileProxy CreateTile(Tile tile)
    {
        Vector3   position = grid.CellToLocal(new Vector3Int(tile.position.x, tile.position.y, 0));
        TileProxy nTile    = Instantiate(prefab, position, Quaternion.identity, tileMap.transform);
        Glossary  glossy   = glossary.GetComponent <Glossary>();

        nTile.Init(tile, glossy.GetGrassTile(BaseSaver.GetPlayer().world), glossy.fireTile, glossy.wallTile, glossy.divineTile, glossy.snowTile);
        return(nTile);
    }
    public void ContinueToScene()
    {
        PlayerMeta  player = BaseSaver.GetPlayer();
        List <Unit> units  = new List <Unit>(player.characters);

        units.Add(selected);
        player.characters = units.ToArray();
        BaseSaver.PutPlayer(player);
        SceneManager.LoadScene("MapScene");
    }
Пример #19
0
    public static bool GameEnded()
    {
        PlayerMeta player = BaseSaver.GetPlayer();

        if (player == null)
        {
            return(false);
        }
        return(player.stats.dests.Length == AMOUNT_OF_LVLS || (player.world == World.tutorial && player.stats.dests.Length == AMOUNT_OF_LVLS_TUTORIAL));
    }
Пример #20
0
    public static int GetCurrentScore()
    {
        int        hScore = 0;
        PlayerMeta player = BaseSaver.GetPlayer();

        foreach (Unit unt in player.characters)
        {
            hScore += unt.GetLvl();
        }
        return(hScore);
    }
Пример #21
0
 void PrintSave(string save, TextMeshProUGUI txt)
 {
     BaseSaver.PutSave(save);
     if (BaseSaver.GetPlayer() != null)
     {
         txt.text = BaseSaver.GetPlayer().ToString();
     }
     else
     {
         txt.text = "New Save";
     }
 }
Пример #22
0
    private void Awake()
    {
        instance    = this;
        currentTeam = BoardProxy.PLAYER_TEAM;
        hard        = false;
        PlayerMeta player = BaseSaver.GetPlayer();

        if (player.world == GameMeta.World.candy || player.world == GameMeta.World.pyramid)
        {
            hard = true;
        }
    }
Пример #23
0
    public void PopulateParticles(Transform parent)
    {
        PlayerMeta player = BaseSaver.GetPlayer();

        foreach (Transform child in parent)
        {
            if (child.name.Equals("PrtSys"))
            {
                Color hColor = player.faction == Unit.FactionType.Human ? Color.blue : (player.faction == Unit.FactionType.Egypt ? Color.yellow : new Color(.4f, .2f, .6f));
                SetParticles(child, true, hColor);
            }
        }
    }
Пример #24
0
    void BuildBoardFromFile()
    {
        PlayerMeta player     = BaseSaver.GetPlayer();
        string     world      = "0" + (((int)player.world)).ToString();
        int        lvl        = int.Parse(player.lastDest.Replace("Dest", ""));
        string     currentMap = world + "_" + (lvl < 10 ? "0" : "") + lvl;

        if (player.world == GameMeta.World.candy)
        {
            currentMap += "_0" + (((int)player.faction) + 1).ToString();
        }
        Debug.Log("BuildBoardFromFile: " + currentMap);
        BoardEditProxy.GetItemInfo(currentMap, PopulateRetrievedInfo);
    }
Пример #25
0
    // Start is called before the first frame update
    void Awake()
    {
        instance = this;
        RefreshSelect();

        Color mainColor = HelperScripts.GetColorByFaction(BaseSaver.GetPlayer().faction);

        mainColor.a = .8f;
        GetComponent <Image>().color = mainColor;
        techSelect.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "";

        selectTag.SetActive(false);
        techNext.SetActive(false);
    }
Пример #26
0
    // Update is called once per frame
    public void Click(string faction)
    {
        Debug.Log("Click: " + faction);
        string     aiStr  = "\nCampaign: Easy\n";
        GameMeta   game   = BaseSaver.GetGame();
        PlayerMeta player = BaseSaver.GetPlayer();

        player.faction = (Unit.FactionType)Enum.Parse(typeof(Unit.FactionType), faction);

        Color mainColor = HelperScripts.GetColorByFaction(player.faction);

        mainColor.a = .5f;
        GetComponent <Image>().color = mainColor;
        //transform.GetChild(2).GetComponent<Image>().color = HelperScripts.GetColorByFactionBold(player.faction);

        ResetParticles();

        if (finalWorld)
        {
            player.world = GameMeta.World.candy;
            aiStr        = "\nCampaign: Hard\n";
        }
        else
        {
            switch (player.faction)
            {
            case Unit.FactionType.Human: player.world = GameMeta.World.nile; break;

            case Unit.FactionType.Egypt: player.world = GameMeta.World.mountain; break;

            case Unit.FactionType.Cthulhu: player.world = GameMeta.World.pyramid; aiStr = "\nCampaign: Hard\n"; break;

            default: player.world = GameMeta.World.nile; break;
            }
        }

        switch (player.faction)
        {
        case Unit.FactionType.Human: SetParticles(human, true); break;

        case Unit.FactionType.Egypt: SetParticles(egypt, true); break;

        case Unit.FactionType.Cthulhu: SetParticles(cthulhu, true); break;
        }

        BaseSaver.PutPlayer(player);
        desc.text = "- " + faction + " - " + aiStr + "Strategy: " + Unit.GetFactionDesc(player.faction);
        btn.SetActive(true);
    }
Пример #27
0
    public void ContinueToScene()
    {
        PlayerMeta  player = BaseSaver.GetPlayer();
        List <Unit> units  = new List <Unit>(player.characters);

        units.Insert(0, selected);
        //units.Add(selected);
        player.characters = units.ToArray();

        Debug.Log("Current Player Chars: " + player.characters.Length.ToString());

        BaseSaver.PutPlayer(player);
        CharAcceptSound();
        SceneManager.LoadScene("MapScene");
    }
Пример #28
0
    void PopulatePlayer()
    {
        PlayerMeta        player   = BaseSaver.GetPlayer();
        Queue <TileProxy> validTls = new Queue <TileProxy>(GetSideTiles(BoardProxy.PLAYER_TEAM));

        Debug.Log("PopulatePlayer: " + validTls.Count.ToString());
        for (int i = 0; i < player.characters.Length && i < height; i++)
        {
            Unit      cMeta   = new Unit(player.characters[i]);
            UnitProxy goodGuy = Instantiate(glossary.GetComponent <Glossary>().units[PLAYER_TEAM], transform);
            goodGuy.PutData(cMeta);
            goodGuy.Init();
            TileProxy popTile = validTls.Dequeue();
            popTile.ReceiveGridObjectProxy(goodGuy);
            goodGuy.SnapToCurrentPosition();
        }
    }
Пример #29
0
    public static void SaveCurrentScore()
    {
        GameMeta   game   = BaseSaver.GetGame();
        PlayerMeta player = BaseSaver.GetPlayer();

        List <HighScoreMeta> hScores   = new List <HighScoreMeta>(game.scores);
        HighScoreMeta        thisScore = new HighScoreMeta();

        thisScore.score   = player.characters.Sum(pChar => pChar.GetLvl());
        thisScore.faction = player.faction;
        thisScore.world   = player.world;
        thisScore.name    = "tom";
        hScores.Add(thisScore);
        game.scores = hScores.ToArray();

        BaseSaver.PutGame(game);
    }
Пример #30
0
    public void Finale()
    {
        finalWorld = !finalWorld;
        if (finalWorld)
        {
            finale.GetComponent <Outline>().enabled = true;
            //finale.transform.GetChild(0).gameObject.SetActive(true);
        }
        else
        {
            finale.GetComponent <Outline>().enabled = false;
            //finale.transform.GetChild(0).gameObject.SetActive(false);
        }
        SetFinaleColors();
        PlayerMeta player = BaseSaver.GetPlayer();

        Click(player.faction.ToString());
    }