Example #1
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];
    }
Example #2
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);
    }
Example #3
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);
    }
Example #4
0
    void Awake()
    {
        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 player.characters)
        {
            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++;
            }
        }

        //rosterTxt.text = "Current Army: \nMage: " + rM.ToString() + "\nScout: " + rSc.ToString() + "\nSoldier: " + rSo.ToString();
        armyPnl.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = rM.ToString();
        armyPnl.transform.GetChild(1).GetChild(0).GetComponent <TextMeshProUGUI>().text = rSc.ToString();
        armyPnl.transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().text = rSo.ToString();

        switch (player.faction)
        {
        case Unit.FactionType.Cthulhu:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;

        case Unit.FactionType.Human:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;

        case Unit.FactionType.Egypt:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;
        }


        panels = new GameObject[panelGroup.transform.childCount];
        for (int i = 0; i < panelGroup.transform.childCount; i++)
        {
            panels[i] = panelGroup.transform.GetChild(i).gameObject;
            UnitProxy unt = ClassNode.ComputeClassBaseUnit(player.faction, (Unit.UnitType)i, glossary.GetComponent <Glossary>());
            panels[i].transform.GetChild(1).GetComponent <Image>().sprite = unt.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
        }
        selectableUnits = new Unit[] {
            Unit.BuildInitial(player.faction, Unit.UnitType.Mage, BoardProxy.PLAYER_TEAM),
            Unit.BuildInitial(player.faction, Unit.UnitType.Scout, BoardProxy.PLAYER_TEAM),
            Unit.BuildInitial(player.faction, Unit.UnitType.Soldier, BoardProxy.PLAYER_TEAM),
        };
        for (int i = 0; i < selectableUnits.Length && i < panels.Length; i++)
        {
            RefreshPanel(panels[i], selectableUnits[i]);
        }
        selected = null;
        contBtn.gameObject.SetActive(false);
        ResetParticles();

        GetComponent <Image>().color = HelperScripts.GetColorByFaction(player.faction);
    }