コード例 #1
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);
    }
コード例 #2
0
ファイル: ClassNode.cs プロジェクト: BradZzz/EldersTale
    public static UnitProxy ComputeClassBaseUnit(ClassNode nde, Glossary glossy)
    {
        ClassNode thsNde = nde;

        while (thsNde.GetParent() != null)
        {
            thsNde = thsNde.GetParent();
        }
        Unit.UnitType typ = Unit.UnitType.Mage;
        if (thsNde.GetType().ToString().Contains("Scout"))
        {
            typ = Unit.UnitType.Scout;
        }
        else if (thsNde.GetType().ToString().Contains("Soldier"))
        {
            typ = Unit.UnitType.Soldier;
        }
        Unit.FactionType fac = Unit.FactionType.Cthulhu;
        if (thsNde.GetType().ToString().Contains("Human"))
        {
            fac = Unit.FactionType.Human;
        }
        else if (thsNde.GetType().ToString().Contains("Egypt"))
        {
            fac = Unit.FactionType.Egypt;
        }


        return(ComputeClassBaseUnit(fac, typ, glossy));
    }
コード例 #3
0
ファイル: Glossary.cs プロジェクト: BradZzz/EldersTale
    public static fx GetAtkFx(Unit.FactionType faction, Unit.UnitType unit)
    {
        switch (faction)
        {
        case Unit.FactionType.Cthulhu: return(fx.bloodExplosions);

        case Unit.FactionType.Egypt: return(fx.fireBaseLarge);

        case Unit.FactionType.Human: return(fx.hmExplosion);
        }
        return(fx.egExplosion);
    }
コード例 #4
0
ファイル: ClassNode.cs プロジェクト: BradZzz/EldersTale
    public static UnitProxy ComputeClassBaseUnit(Unit.FactionType fType, Unit.UnitType uType, Glossary glossy)
    {
        ClassNode rNode = new HumanBaseSoldier();

        switch (fType)
        {
        case Unit.FactionType.Human:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(glossy.humanMage);

            case Unit.UnitType.Scout: return(glossy.humanScout);

            case Unit.UnitType.Soldier: return(glossy.humanSoldier);
            }
            break;

        case Unit.FactionType.Egypt:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(glossy.egyptMage);

            case Unit.UnitType.Scout: return(glossy.egyptScout);

            case Unit.UnitType.Soldier: return(glossy.egyptSoldier);
            }
            break;

        case Unit.FactionType.Cthulhu:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(glossy.cthulhuMage);

            case Unit.UnitType.Scout: return(glossy.cthulhuScout);

            case Unit.UnitType.Soldier: return(glossy.cthulhuSoldier);
            }
            break;

        case Unit.FactionType.None:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(glossy.finalRed);

            case Unit.UnitType.Scout: return(glossy.finalBlue);

            case Unit.UnitType.Soldier: return(glossy.finalBlack);
            }
            break;
        }
        return(glossy.finalBlack);
    }
コード例 #5
0
ファイル: ClassNode.cs プロジェクト: BradZzz/EldersTale
    public static ClassNode ComputeClassObject(Unit.FactionType fType, Unit.UnitType uType)
    {
        ClassNode rNode = new HumanBaseSoldier();

        switch (fType)
        {
        case Unit.FactionType.Human:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(new HumanBaseMage());

            case Unit.UnitType.Scout: return(new HumanBaseScout());

            case Unit.UnitType.Soldier: return(new HumanBaseSoldier());
            }
            break;

        case Unit.FactionType.Egypt:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(new EgyptBaseMage());

            case Unit.UnitType.Scout: return(new EgyptBaseScout());

            case Unit.UnitType.Soldier: return(new EgyptBaseSoldier());
            }
            break;

        case Unit.FactionType.Cthulhu:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(new CthulhuBaseMage());

            case Unit.UnitType.Scout: return(new CthulhuBaseScout());

            case Unit.UnitType.Soldier: return(new CthulhuBaseSoldier());
            }
            break;

        case Unit.FactionType.None:
            switch (uType)
            {
            case Unit.UnitType.Mage: return(new FinalBaseOmen());

            case Unit.UnitType.Scout: return(new FinalBaseDisorder());

            case Unit.UnitType.Soldier: return(new FinalBaseTwilight());
            }
            break;
        }
        return(new FinalBaseOmen());
    }
コード例 #6
0
    public static Color GetColorByFaction(Unit.FactionType fact)
    {
        switch (fact)
        {
        case Unit.FactionType.Cthulhu: return(THEME1sub);

        case Unit.FactionType.Egypt: return(THEME2sub);

        case Unit.FactionType.Human: return(THEME3sub);

        default: return(Color.white);
        }
    }
コード例 #7
0
    /*
     * Catch phrases can contain as much as 20 characters
     */
    public static string GenerateRandomCatchphrase(Skill.Actions act, Unit.FactionType faction)
    {
        switch (faction)
        {
        case Unit.FactionType.Human:
            return(GetHumanCatchphrase(act));

        case Unit.FactionType.Egypt:
            return(GetEgyptCatchphrase(act));

        case Unit.FactionType.Cthulhu:
            return(GetCthulhuCatchphrase(act));

        default:
            return(GetFinalCatchphrase(act));
        }
    }
コード例 #8
0
    public static string GenerateRandomName(List <string> dontPick, Unit.FactionType faction)
    {
        string gotName = "";

        switch (faction)
        {
        case Unit.FactionType.Human:
            gotName = GetRandomNameHuman();
            while (dontPick.Contains(gotName))
            {
                gotName = GetRandomNameHuman();
            }
            break;

        case Unit.FactionType.Egypt:
            gotName = GetRandomNameEgypt();
            while (dontPick.Contains(gotName))
            {
                gotName = GetRandomNameEgypt();
            }
            break;

        case Unit.FactionType.Cthulhu:
            gotName = GetRandomNameCthulhu();
            while (dontPick.Contains(gotName))
            {
                gotName = GetRandomNameCthulhu();
            }
            break;

        case Unit.FactionType.None:
            gotName = GetRandomNameFinal();
            while (dontPick.Contains(gotName))
            {
                gotName = GetRandomNameFinal();
            }
            break;
        }
        return(gotName);
    }
コード例 #9
0
ファイル: UnitProxy.cs プロジェクト: BradZzz/EldersTale
    IEnumerator GenerateProjectile(Unit.FactionType factionType, Unit.UnitType unitType, TileProxy destTile, GameObject baseProj, Vector3 start, Vector3 finish, Color projColor, bool rotate, float chargeWait,
                                   float xOffset, float yOffset, float projSpeed)
    {
        GameObject newProj = Instantiate(baseProj, start, Quaternion.identity);

        newProj.GetComponent <SpriteRenderer>().color = projColor;
        if (chargeWait > 0)
        {
            yield return(new WaitForSeconds(chargeWait));
        }
        //yield return new WaitForSeconds(chargeWait);
        iTween.MoveTo(newProj, finish, projSpeed);
        if (rotate)
        {
            iTween.RotateBy(newProj, new Vector3(0, 0, 1), projSpeed);
        }
        yield return(new WaitForSeconds(projSpeed - .1f));

        Destroy(newProj);
        destTile.CreateAnimation(Glossary.GetAtkFx(factionType, unitType), AnimationInteractionController.NO_WAIT);
        //Destroy(newProj);
    }
コード例 #10
0
    public static string GetMapName(GameMeta.World wrld, Unit.FactionType faction, string lastDest)
    {
        Dests dst = (Dests)Enum.Parse(typeof(Dests), lastDest);

        switch (wrld)
        {
        case GameMeta.World.tutorial:
            /*
             * Human
             */
            switch (dst)
            {
            case Dests.Dest1: return("One Toe In The Water");

            case Dests.Dest2: return("Baby Steps");

            case Dests.Dest3: return("A Little More");

            case Dests.Dest4: return("Expanding");

            case Dests.Dest5: return("Graduation");
            }
            break;

        case GameMeta.World.nile:
            /*
             * Human
             */
            switch (dst)
            {
            case Dests.Dest1: return("A First Step");

            case Dests.Dest2: return("The March Continues");

            case Dests.Dest3: return("Monster At The Bay");

            case Dests.Dest4: return("Through The Bog");

            case Dests.Dest5: return("Beaches Of Blood");

            case Dests.Dest6: return("Death's Ravine");

            case Dests.Dest7: return("The Sea Wall");

            case Dests.Dest8: return("By Force");

            case Dests.Dest9: return("Isle Of Doom");

            case Dests.Dest10: return("The Great Provening");
            }
            break;

        case GameMeta.World.mountain:
            /*
             * Egypt
             */
            switch (dst)
            {
            case Dests.Dest1: return("Ra's Request");

            case Dests.Dest2: return("Obelisk At Dawn");

            case Dests.Dest3: return("Setting Sun");

            case Dests.Dest4: return("Chorus Of Horus");

            case Dests.Dest5: return("Memories Of Cairo");

            case Dests.Dest6: return("Shadows Along The Pyramids");

            case Dests.Dest7: return("Friction Of The Sands");

            case Dests.Dest8: return("A Greater Understanding");

            case Dests.Dest9: return("Anubis Beckons");

            case Dests.Dest10: return("Seth's Plan");
            }
            break;

        case GameMeta.World.pyramid:
            /*
             * Cthulhu
             */
            switch (dst)
            {
            case StoryStatic.Dests.Dest1: return("The Elder's Whisper");

            case StoryStatic.Dests.Dest2: return("On Fire");

            case StoryStatic.Dests.Dest3: return("Scorched Earth");

            case StoryStatic.Dests.Dest4: return("Famine");

            case StoryStatic.Dests.Dest5: return("Anticipated Disdain");

            case StoryStatic.Dests.Dest6: return("The Tentacle's Triumph");

            case StoryStatic.Dests.Dest7: return("The Void's Victory");

            case StoryStatic.Dests.Dest8: return("Encroaching Plague");

            case StoryStatic.Dests.Dest9: return("A New Tactic");

            case StoryStatic.Dests.Dest10: return("Towards The Darkness");
            }
            break;

        case GameMeta.World.candy:
            switch (faction)
            {
            case Unit.FactionType.Cthulhu:
                switch (dst)
                {
                case StoryStatic.Dests.Dest1: return("Maw Of Whispers");

                case StoryStatic.Dests.Dest2: return("Under The Fresh Soil");

                case StoryStatic.Dests.Dest3: return("From The Swamp");

                case StoryStatic.Dests.Dest4: return("Absalom's Deceit");

                case StoryStatic.Dests.Dest5: return("Through Skulls");

                case StoryStatic.Dests.Dest6: return("Siege Of Sapiens");

                case StoryStatic.Dests.Dest7: return("Draped In Skulls");

                case StoryStatic.Dests.Dest8: return("Whispered Curse");

                case StoryStatic.Dests.Dest9: return("To The Crypt");

                case StoryStatic.Dests.Dest10: return("The Third Eye");
                }
                break;

            case Unit.FactionType.Egypt:
                switch (dst)
                {
                case StoryStatic.Dests.Dest1: return("On Papyrus");

                case StoryStatic.Dests.Dest2: return("What Isis Saw");

                case StoryStatic.Dests.Dest3: return("Re Peat");

                case StoryStatic.Dests.Dest4: return("100 Lashes");

                case StoryStatic.Dests.Dest5: return("Memories Of The Home");

                case StoryStatic.Dests.Dest6: return("Heard From Phat");

                case StoryStatic.Dests.Dest7: return("Involving Mummies");

                case StoryStatic.Dests.Dest8: return("Osiris' Call");

                case StoryStatic.Dests.Dest9: return("Point Nexus");

                case StoryStatic.Dests.Dest10: return("The Third Eye");
                }
                break;

            case Unit.FactionType.Human:
                switch (dst)
                {
                case StoryStatic.Dests.Dest1: return("Opening The Gates");

                case StoryStatic.Dests.Dest2: return("Assault And Battery");

                case StoryStatic.Dests.Dest3: return("Justified");

                case StoryStatic.Dests.Dest4: return("Serpentine");

                case StoryStatic.Dests.Dest5: return("The Second Provening");

                case StoryStatic.Dests.Dest6: return("Perfect Strategy");

                case StoryStatic.Dests.Dest7: return("Reinforments");

                case StoryStatic.Dests.Dest8: return("Manifest Destiny");

                case StoryStatic.Dests.Dest9: return("Fix Bayonets");

                case StoryStatic.Dests.Dest10: return("The Third Eye");
                }
                break;
            }
            break;
        }
        return("");
    }
コード例 #11
0
    public static string GetLevelStory()
    {
        PlayerMeta player = BaseSaver.GetPlayer();

        GameMeta.World world = player.world;
        Dests          dest  = (Dests)Enum.Parse(typeof(Dests), player.lastDest);

        Unit.FactionType faction = player.faction;
        switch (world)
        {
        case GameMeta.World.tutorial:
            switch (dest)
            {
            case Dests.Dest1: return("Let's get to the battle! Click on your tank to bring up it's moveable tiles. Move it near that enemy unit and attack it!");

            case Dests.Dest2: return("A human Scout unit is faster and has more moves per turn than a normal unit. Use it to your advantage to attack weak units and units with aegis.");

            case Dests.Dest3: return("Let's see how a Mage unit works when added to the mix! These units are usually slower and weaker than normal units with high attack power and range. Try to hide these classes behind obstacles for cover.");

            case Dests.Dest4: return("Sometimes tiles can have different effects in battle. Snow slows 1 move. Fire damages 1 hp. Divine heals 1 hp at the end of the turn.");

            case Dests.Dest5: return("Each team can only bring three units at a time into battle. The order of the roster is decided on the tech screen where units are upgraded.");
            }
            break;

        case GameMeta.World.nile:
            switch (dest)
            {
            case Dests.Dest1: return("Attention, recruit! Enemy contact! It’s some sort of Egyptian monster! Use all your ingenuity to take them down!");

            case Dests.Dest2: return("The enemy grows stronger as we near the center of the attack. Be on the lookout for more Egyptian scum!");

            case Dests.Dest3: return("Looks like these Gods don’t want us here! They’re sending us more fodder for our rifles! Keep track of your troops, we all have families at home.");

            case Dests.Dest4: return("The strength of our enemy is increasing! Be careful of fire and ice attacks, soldier!");

            case Dests.Dest5: return("The Egyptian menace has blocked our advance, let’s get them, soldier!");

            case Dests.Dest6: return("We can’t let these gods get to that box first! Take out these gods!");

            case Dests.Dest7: return("Their strength and numbers are increasing exponentially! Strategize, soldier!");

            case Dests.Dest8: return("We must be getting close to their home base, there’s even more vermin than ever!");

            case Dests.Dest9: return("They’re rallying against us! We can’t afford to lose now, soldier!");

            case Dests.Dest10: return("Here we are, recruit! The final battle! Just defeat these last units, and we’ll be able to pinpoint the exact location of the disturbance!");
            }
            break;

        case GameMeta.World.mountain:
            switch (dest)
            {
            case Dests.Dest1: return("On command from Isis, I have spotted the demonic interlopers. May her blessing put these intruders in their place.");

            case Dests.Dest2: return("With the power of Ra flowing through my veins, we may just win against these creatures from the deep.");

            case Dests.Dest3: return("Tentacles, wings, horns, and claws. These monsters were born in the deepest pits and there they shall return.");

            case Dests.Dest4: return("They do not deserve the blessed light from Ra. Send them to their deaths!");

            case Dests.Dest5: return("The abominations advance, we must stop them!");

            case Dests.Dest6: return("Beware the toxic stingers of poison and pray we survive the night.");

            case Dests.Dest7: return("Cthulhu’s minions grow stronger each day. We must not let them open the portal wider!");

            case Dests.Dest8: return("These sick demons appear to enjoy fighting. Let’s give them a taste of their own tonic!");

            case Dests.Dest9: return("Their dark magic is nothing against the power of Ra!");

            case Dests.Dest10: return("We have arrived! The final battle! Destroy the enemy!");
            }
            break;

        case GameMeta.World.pyramid:
            switch (dest)
            {
            case Dests.Dest1: return("On orders from the Elder Gods, I have set off to take care of the mortal scourge impeding our progress.");

            case Dests.Dest2: return("It seems the mortal pestilence is not as easy to take care of as we originally thought.");

            case Dests.Dest3: return("The human numbers are multiplying as we rally our forces. May the old ones bless us with darkness as we rid them of their souls.");

            case Dests.Dest4: return("These mortals send us infinite snacks, our demons will become fat and complacent if this continues.");

            case Dests.Dest5: return("Perhaps we have underestimated the human infestation. They are multiplying faster than we can reap them!");

            case Dests.Dest6: return("Hordes of enemies are approaching! Let’s show them true fear.");

            case Dests.Dest7: return("The smell of death and chaos pleases the Elder gods greatly, they demand more blood sacrifice.");

            case Dests.Dest8: return("The Elder gods demand a symphony of blood-curdling screams to be composed as a part of their epic opera. Pre-sale tickets available for a limited time at the box office on Level 3 of Hell.");

            case Dests.Dest9: return("With the influx of souls reaped, Hell is overflowing. We will need to kill more construction workers to expand the misery initiative.");

            case Dests.Dest10: return("This is it! The final battle! Once we get through these mortal fools, the box is ours and we can plunge the world into eternal darkness! Whee!");
            }
            break;

        case GameMeta.World.candy:
            switch (faction)
            {
            case Unit.FactionType.Human:
                switch (dest)
                {
                case Dests.Dest1: return("Objective: Get our hands on Pandora’s Box.");

                case Dests.Dest2: return("Do not get distracted by the chocolate falls and the cotton candy clouds! She’s bringing the dead back to life! Be careful, recruit!");

                case Dests.Dest3: return("Enemies everywhere! You can’t be afraid now, soldier!");

                case Dests.Dest4: return("Susies are closing in from all around us, soldier! We’ll have to scrap our way out of this one!");

                case Dests.Dest5: return("We must be getting closer to the real Susie and Pandora's box, the enemies are getting stronger!");

                case Dests.Dest6: return("We’re on the right track! The enemy is getting scared!");

                case Dests.Dest7: return("No time for shell shock, soldier. You’ve made it this far, let’s see this to the end!");

                case Dests.Dest8: return("The enemy is getting desperate to kill us, don’t give them the satisfaction!");

                case Dests.Dest9: return("Can you feel that in the air? The end is near...");

                case Dests.Dest10: return("It’s her. It’s Susie. Get that box closed and back to our government!");
                }
                break;

            case Unit.FactionType.Egypt:
                switch (dest)
                {
                case Dests.Dest1: return("By the power of Anubis, I can feel that we are in the end game.");

                case Dests.Dest2: return("The Greeks did not heed our warning, and now we must clean up their mess.");

                case Dests.Dest3: return("The demoness appears to be bringing her enemies back from the dead!");

                case Dests.Dest4: return("Do not fear, Ra shines his blessed light upon us. There can be only one true God!");

                case Dests.Dest5: return("The demoness grows stronger with each passing day! We must not fail!");

                case Dests.Dest6: return("There can be no others with magic. We must destroy her source of power, we must destroy the box!");

                case Dests.Dest7: return("Do not fall prey to the grotesque illusions the she-beast creates!");

                case Dests.Dest8: return("The dead grow stronger as we near the demoness!");

                case Dests.Dest9: return("Can you feel that in the air? The end is near…");

                case Dests.Dest10: return("It’s her. The little Demoness. We must destroy the box!");
                }
                break;

            case Unit.FactionType.Cthulhu:
                switch (dest)
                {
                case Dests.Dest1: return("Our forward plague scouts have informed us that the beast Susie has summoned dopplegangers to protect her.");

                case Dests.Dest2: return("These magical beings summoned from beyond, they’re coming at us from everywhere!");

                case Dests.Dest3: return("It hardly seems fair to have so much vermin to crush around us.");

                case Dests.Dest4: return("If we could only get that box opened a little wider, the big demons could fit through the portal.");

                case Dests.Dest5: return("Wouldn’t it be fun to see this world fall to chaos?");

                case Dests.Dest6: return("What are we all fighting for anyway? Can’t we just all go back to Blood Lake and bond over a nice chalice of human misery?");

                case Dests.Dest7: return("Oh what a delicious mess we’ve made here!");

                case Dests.Dest8: return("It seems we’ve angered the enemy!");

                case Dests.Dest9: return("Can you feel that in the air? The end is near…");

                case Dests.Dest10: return("It’s her. It’s the real Susie and Pandora's box. Protect the box so that we can open a portal into Eden!");
                }
                break;
            }
            break;
        }
        return("");
    }
コード例 #12
0
ファイル: MapStatic.cs プロジェクト: BradZzz/EldersTale
    static Unit[] CreateFromExp(int enemies, int lvl, bool tutorial)
    {
        if (lvl > 3 && tutorial)
        {
            lvl = 3;
        }

        PlayerMeta player = BaseSaver.GetPlayer();

        Unit.FactionType eFaction = Unit.FactionType.Egypt;
        switch (player.faction)
        {
        case Unit.FactionType.Human: eFaction = Unit.FactionType.Egypt; break;

        case Unit.FactionType.Egypt: eFaction = Unit.FactionType.Cthulhu; break;

        case Unit.FactionType.Cthulhu: eFaction = Unit.FactionType.Human; break;
        }

        List <Unit> units  = new List <Unit>();
        Array       values = Enum.GetValues(typeof(Unit.UnitType));
        //int max = 3 > lvl ? lvl : 3;
        int lvlCnt = lvl;

        for (int i = 0; i < enemies && i < 3; i++)
        {
            int  exp     = UnityEngine.Random.Range(0, lvlCnt);
            Unit newUnit = Unit.BuildInitial(player.world != GameMeta.World.candy ? eFaction : /*(Unit.FactionType)UnityEngine.Random.Range(0, 3)*/ Unit.FactionType.None,
                                             (Unit.UnitType)values.GetValue(UnityEngine.Random.Range(0, values.Length - 1)), BoardProxy.ENEMY_TEAM);
            if (i == enemies - 1)
            {
                newUnit.SetLvl(lvlCnt);
            }
            else
            {
                newUnit.SetLvl(exp);
            }
            lvlCnt -= exp;
            if (tutorial)
            {
                newUnit.SetMaxHP(1);
                newUnit.SetSkills(new string[] { });
            }
            units.Add(newUnit);
        }
        Debug.Log("Units: " + units.Count.ToString());
        if (tutorial)
        {
            return(units.ToArray());
        }

        /*
         * Upgrade units here
         */
        for (int i = 0; i < units.Count; i++)
        {
            while (units[i].GetLvl() >= units[i].GetCurrentClass().GetWhenToUpgrade() && units[i].GetCurrentClass().GetChildren().Length > 0)
            {
                int       choice        = UnityEngine.Random.Range(0, units[i].GetCurrentClass().GetChildren().Length);
                ClassNode pickedUpgrade = units[i].GetCurrentClass().GetChildren()[choice];
                units[i] = pickedUpgrade.UpgradeCharacter(units[i]);
                units[i].SetCurrentClass(pickedUpgrade.GetType().ToString());
            }
        }
        return(units.ToArray());
    }
コード例 #13
0
    IEnumerator TimeEndGame(bool won)
    {
        if (!AnimationInteractionController.AllAnimationsFinished())
        {
            yield return(new WaitForSeconds(AnimationInteractionController.AFTER_KILL));
        }

        BoardProxy.instance.gameObject.GetComponent <Grid>().enabled = false;

        BoardProxy.instance.gameOverPanel.SetActive(true);
        BoardProxy.instance.gameOverPanel.transform.GetChild(2).gameObject.SetActive(false);
        BoardProxy.instance.gameOverPanel.transform.GetChild(3).gameObject.SetActive(false);

        /*
         * Replace shit here
         */

        PlayerMeta player = BaseSaver.GetPlayer();
        BoardMeta  brd    = BaseSaver.GetBoard();
        Glossary   glossy = BoardProxy.instance.glossary.GetComponent <Glossary>();

        Unit.FactionType fact = won ? player.faction : brd.enemies[0].GetFactionType();
        switch (fact)
        {
        case Unit.FactionType.Cthulhu:
            BoardProxy.instance.gameOverPanel.transform.GetChild(0).GetComponent <Image>().sprite = glossy.endBattleOverlayCthulhuLeft;
            BoardProxy.instance.gameOverPanel.transform.GetChild(1).GetComponent <Image>().sprite = glossy.endBattleOverlayCthulhuRight;
            break;

        case Unit.FactionType.Egypt:
            BoardProxy.instance.gameOverPanel.transform.GetChild(0).GetComponent <Image>().sprite = glossy.endBattleOverlayEgyptLeft;
            BoardProxy.instance.gameOverPanel.transform.GetChild(1).GetComponent <Image>().sprite = glossy.endBattleOverlayEgyptRight;
            break;

        case Unit.FactionType.Human:
            BoardProxy.instance.gameOverPanel.transform.GetChild(0).GetComponent <Image>().sprite = glossy.endBattleOverlayHumanLeft;
            BoardProxy.instance.gameOverPanel.transform.GetChild(1).GetComponent <Image>().sprite = glossy.endBattleOverlayHumanRight;
            break;

        default:
            BoardProxy.instance.gameOverPanel.transform.GetChild(0).GetComponent <Image>().sprite = glossy.endBattleOverlaySusieLeft;
            BoardProxy.instance.gameOverPanel.transform.GetChild(1).GetComponent <Image>().sprite = glossy.endBattleOverlaySusieRight;
            break;
        }

        GameObject screenChild = BoardProxy.instance.gameOverPanel.transform.GetChild(0).gameObject;

        Vector3 moveToPos    = screenChild.transform.position;
        float   screenHeight = screenChild.GetComponent <RectTransform>().rect.height;

        Vector3 startPosHigh = new Vector3(0, moveToPos.y + screenHeight, moveToPos.z);
        Vector3 startPosLow  = new Vector3(0, moveToPos.y - screenHeight, moveToPos.z);

        BoardProxy.instance.gameOverPanel.transform.GetChild(0).localPosition = startPosHigh;
        BoardProxy.instance.gameOverPanel.transform.GetChild(1).localPosition = startPosLow;

        if (!won)
        {
            BoardProxy.instance.gameOverPanel.transform.GetChild(2).gameObject.SetActive(true);
            BoardProxy.instance.gameOverPanel.transform.GetChild(2).localPosition = startPosHigh;
            iTween.MoveTo(BoardProxy.instance.gameOverPanel.transform.GetChild(2).gameObject, moveToPos, 3f);
        }
        else
        {
            BoardProxy.instance.gameOverPanel.transform.GetChild(3).gameObject.SetActive(true);
            switch (fact)
            {
            case Unit.FactionType.Cthulhu:
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(0).GetComponent <Image>().sprite = glossy.endBattleWinOverlayCthulhu1;
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(1).GetComponent <Image>().sprite = glossy.endBattleWinOverlayCthulhu2;
                break;

            case Unit.FactionType.Egypt:
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(0).GetComponent <Image>().sprite = glossy.endBattleWinOverlayEgypt1;
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(1).GetComponent <Image>().sprite = glossy.endBattleWinOverlayEgypt2;
                break;

            case Unit.FactionType.Human:
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(0).GetComponent <Image>().sprite = glossy.endBattleWinOverlayHuman1;
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(1).GetComponent <Image>().sprite = glossy.endBattleWinOverlayHuman2;
                break;

            default:
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(0).GetComponent <Image>().sprite = glossy.endBattleWinOverlayCthulhu1;
                BoardProxy.instance.gameOverPanel.transform.GetChild(3).GetChild(1).GetComponent <Image>().sprite = glossy.endBattleWinOverlayCthulhu2;
                break;
            }
            BoardProxy.instance.gameOverPanel.transform.GetChild(3).localPosition = startPosHigh;
            iTween.MoveTo(BoardProxy.instance.gameOverPanel.transform.GetChild(3).gameObject, moveToPos, 3f);
        }

        iTween.MoveTo(BoardProxy.instance.gameOverPanel.transform.GetChild(0).gameObject, moveToPos, 1f);
        iTween.MoveTo(BoardProxy.instance.gameOverPanel.transform.GetChild(1).gameObject, moveToPos, 1f);


        MusicTransitionToMap();
        this.won = won;
        string txt = "Defeat";

        if (won)
        {
            //Apply inactive unit class bonuses
            if (player.characters.Length > 3)
            {
                List <Unit> inactiveUnits = new List <Unit>(new Unit[] { player.characters[0] });
                if (player.characters.Length > 4)
                {
                    inactiveUnits.Add(player.characters[1]);
                }
                for (int i = 0; i < inactiveUnits.Count; i++)
                {
                    Debug.Log("Applying bonus to: " + inactiveUnits[i].characterMoniker + " - " + inactiveUnits[i].characterName);
                    inactiveUnits[i] = ClassNode.ApplyClassBonusesBattle(inactiveUnits[i], inactiveUnits.ToArray());
                    if (inactiveUnits[i].GetInactiveExpBuff() > 0)
                    {
                        inactiveUnits[i].ApplyInactiveExpBuff();
                    }
                }
            }

            List <UnitProxy> units = BoardProxy.instance.GetUnits().Where(unit => unit.GetData().GetTeam() == BoardProxy.PLAYER_TEAM &&
                                                                          unit.GetData().GetCurrHealth() > 0 && !unit.GetData().GetSummoned()).ToList();
            //PlayerMeta player = BaseSaver.GetPlayer();
            List <Unit> pChars = new List <Unit>(player.characters);
            pChars.Reverse();
            //Remove the top three chars from the roster
            pChars.RemoveAt(0);
            if (pChars.Count > 0)
            {
                pChars.RemoveAt(0);
            }
            if (pChars.Count > 0)
            {
                pChars.RemoveAt(0);
            }
            Debug.Log("pChars Before");
            foreach (Unit unt in pChars)
            {
                Debug.Log(unt.ToString());
            }
            //Fill them back in if they are still on the board
            List <Unit> pCharsBoard = new List <Unit>(new HashSet <Unit>(units.Select(unit => new Unit(unit.GetData()))));
            foreach (Unit unt in pCharsBoard)
            {
                Debug.Log(unt.ToString());
                if (!pChars.Where(pCh => pCh.characterMoniker.Equals(unt.characterMoniker)).Any())
                {
                    pChars.Add(unt);
                }
            }
            Debug.Log("pChars After");
            for (int i = 0; i < pChars.Count(); i++)
            {
                Debug.Log(pChars[i].ToString());
                //pChars[i] = ClassNode.ApplyClassBonusesBattle(pChars[i], inactiveUnits.ToArray());
            }
            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();
            BaseSaver.PutPlayer(player);
            txt = "Victory";
        }
        BoardProxy.instance.gameOverPanel.transform.GetChild(5).GetComponent <TextMeshProUGUI>().text = txt;
    }
コード例 #14
0
ファイル: UnitProxy.cs プロジェクト: BradZzz/EldersTale
    IEnumerator CreateProjectiles(UnitProxy oppUnit, Vector3 dest)
    {
        Vector3 start  = dest;
        Vector3 finish = transform.position;

        start.y  += .6f;
        finish.y += .6f;

        //GameObject baseProj = oppUnit.GetData().GetFactionType() == Unit.FactionType.None ?
        //BoardProxy.instance.glossary.GetComponent<Glossary>().GetRandomGummi() : BoardProxy.instance.glossary.GetComponent<Glossary>().projectile;

        Unit.FactionType factionType = oppUnit.GetData().GetFactionType();
        Unit.UnitType    unitType    = oppUnit.GetData().GetUnitType();

        int        num                     = 5;
        float      delayBefore             = .4f;
        float      delayAfter              = .1f;
        float      projSpeed               = 1;
        float      chargeWait              = 0;
        bool       showProjectileAnimation = true;
        bool       rotate                  = false;
        GameObject baseProj                = BoardProxy.instance.glossary.GetComponent <Glossary>().projectile;
        TileProxy  dTile                   = BoardProxy.instance.GetTileAtPosition(GetPosition());
        Color      projColor               = Color.white;

        float delayMiddleWait = 0;
        float xOffset         = 0;
        float yOffset         = 0;

        switch (factionType)
        {
        case Unit.FactionType.Cthulhu:
            projColor = new Color(.4f, .2f, .6f);
            switch (unitType)
            {
            case Unit.UnitType.Mage: xOffset += 0; yOffset += 0; num = 20; delayAfter = .005f;
                projSpeed = .5f; chargeWait = .001f; delayBefore = 0; baseProj = BoardProxy.instance.glossary.GetComponent <Glossary>().projectileSquare; break;

            case Unit.UnitType.Scout: showProjectileAnimation = false; break;

            case Unit.UnitType.Soldier: showProjectileAnimation = false; break;
            }
            break;

        case Unit.FactionType.Egypt:
            projColor = Color.yellow;
            switch (unitType)
            {
            case Unit.UnitType.Mage: num = 20; delayAfter = .005f; projSpeed = .5f; chargeWait = .001f; delayBefore = .2f; break;

            case Unit.UnitType.Scout: num = 5; delayBefore = .1f; delayAfter = .02f; break;

            case Unit.UnitType.Soldier: projSpeed = .9f; rotate = true; num = 1; delayBefore = .45f; delayAfter = .3f;
                baseProj = BoardProxy.instance.glossary.GetComponent <Glossary>().scarab; break;
            }
            break;

        case Unit.FactionType.Human:
            projColor = Color.red;
            switch (unitType)
            {
            case Unit.UnitType.Mage: num = 20; delayAfter = .005f; projSpeed = .5f; chargeWait = .001f; baseProj = BoardProxy.instance.glossary.GetComponent <Glossary>().projectileSquare; break;

            case Unit.UnitType.Scout: num = 2; delayBefore = .15f; delayAfter = .35f; projSpeed = .5f; break;

            case Unit.UnitType.Soldier: num = 1; delayBefore = .28f; delayAfter = .6f; break;
            }
            break;

        default:
            switch (unitType)
            {
            case Unit.UnitType.Mage:
                rotate = true; num = 1; delayBefore = .6f; projSpeed = .9f; baseProj = BoardProxy.instance.glossary.GetComponent <Glossary>().GetRandomGummi();
                break;

            //case Unit.UnitType.Scout:break;
            //case Unit.UnitType.Soldier:break;
            default: showProjectileAnimation = false; break;
            }
            break;
        }

        yield return(new WaitForSeconds(delayBefore));

        for (int i = 0; i < num; i++)
        {
            if (showProjectileAnimation)
            {
                StartCoroutine(GenerateProjectile(factionType, unitType, dTile, baseProj, start, finish, projColor, rotate, chargeWait, xOffset, yOffset, projSpeed));
            }
            else
            {
                StartCoroutine(GenerateAttackAnims(oppUnit, baseProj, start, finish));
            }
            if (i == num / 2 && delayMiddleWait > 0)
            {
                yield return(new WaitForSeconds(delayMiddleWait));
            }
            yield return(new WaitForSeconds(delayAfter));
        }
        yield return(null);
    }