Ejemplo n.º 1
0
    public static Skral Factory(int cellID)
    {
        Sprite         sprite   = Resources.Load <Sprite>("Sprites/Tokens/Enemies/Skral");
        GameObject     go       = new GameObject("Skral");
        SpriteRenderer renderer = go.AddComponent <SpriteRenderer>();

        renderer.sprite         = sprite;
        go.transform.localScale = new Vector3(10, 10, 10);

        Skral skral = go.AddComponent <Skral>();

        skral.TokenName = Type;
        Cell cell = Cell.FromId(cellID);

        // Check if cell is occupied by another monster
        while (cell.Inventory.Enemies.Count != 0 && cell.Index != 0)
        {
            cell = cell.enemyPath;
        }
        skral.Cell = cell;


        skral.Will     = 6;
        skral.Strength = 6;
        skral.Reward   = 4;

        return(skral);
    }
Ejemplo n.º 2
0
 public override void ApplyEffect()
 {
     GameManager.instance.gors.Add(Gor.Factory(27));
     GameManager.instance.gors.Add(Gor.Factory(31));
     GameManager.instance.skrals.Add(Skral.Factory(29));
     GameManager.instance.thorald = Thorald.Instance;
 }
Ejemplo n.º 3
0
    void NewGame()
    {
        GameObject canvas = GameObject.Find("Canvas");

        canvas.transform.Find("DistributeGold").gameObject.SetActive(true);
        canvas.transform.Find("DistributeWineskins").gameObject.SetActive(true);

/*
 *        heroes.Add(Archer.Instance);
 *        heroes.Add(Mage.Instance);
 *        heroes.Add(Dwarf.Instance);
 *        Warrior.Instance.Cell = Cell.FromId(36);
 *        Archer.Instance.Cell = Cell.FromId(49);
 *        findHero("Archer").heroInventory.AddSmallToken(Telescope.Factory());
 *        findHero("Archer").heroInventory.AddHelm(Helm.Factory());
 *        Mage.Instance.Cell = Cell.FromId(25);
 *        Dwarf.Instance.Cell = Cell.FromId(25);
 *        thorald = Thorald.Instance;
 *        Thorald.Instance.Cell = Cell.FromId(25);
 *        Skral.Factory(25);
 *        mainHeroIndex = 0;
 */

        // FARMERS
        farmers.Add(Farmer.Factory(24));
        farmers.Add(Farmer.Factory(36));

        // MONSTERS

        gors.Add(Gor.Factory(8));
        gors.Add(Gor.Factory(20));
        gors.Add(Gor.Factory(21));
        gors.Add(Gor.Factory(26));
        gors.Add(Gor.Factory(48));

        skrals.Add(Skral.Factory(19));

        Fog.Factory();

        wells.Add(Well.Factory(5));
        wells.Add(Well.Factory(35));
        wells.Add(Well.Factory(45));
        wells.Add(Well.Factory(55));
    }
Ejemplo n.º 4
0
    public void removeMonster(Monster m)
    {
        if (m.isMedicinalGor())
        {
            //medicinalHerb is separated from Gor --> should be interactable now
            medicinalGorDefeated = true;
            GameController.instance.medGorDefeatedNotify();
        }
        if (m.getSkralTower())
        {
            //trigger skralTower scenario
            //move narrator to N
            //need a check in gameController for this
            skralTowerDefeated = true;
            //GameController.instance.update
        }
        Node monsterLoc = positionGraph.getNode(80);

        m.setLocationNode(monsterLoc);
        // GameController.instance.deadMonsterMove(m);
        // m.getPrefab().SetActive(false);

        // m.move();

        if (m.getMonsterType() == "Gor")
        {
            Gor g = (Gor)m;
            //gors.Remove(g);
        }
        if (m.getMonsterType() == "Skral")
        {
            Skral s = (Skral)m;
            //skrals.Remove(s);
        }

        //monsters.Remove(m);
        Game.gameState.legend += 1;
        GameController.instance.advanceNarrator(Game.gameState.legend);
    }
Ejemplo n.º 5
0
 public void addSkral(Skral s)
 {
     skrals.Add(s, s.getLocation());
 }
Ejemplo n.º 6
0
    void LoadGame(string directory)
    {
        // Load from json here
        // Heroes
        foreach (Hero hero in heroes)
        {
            hero.Load(directory);
        }

        // Cells
        CellStates Cells = FileManager.Load <CellStates>(directory + "/Cells.json");

        foreach (CellState cellstate in Cells.cellStates)
        {
            foreach (string token in cellstate.inventory)
            {
                Type type = Type.GetType(token);
                if (type == typeof(Farmer))
                {
                    farmers.Add(Farmer.Factory(cellstate.index));
                }
                else if (type == typeof(Gor))
                {
                    gors.Add(Gor.Factory(cellstate.index));
                }
                else if (type == typeof(Skral))
                {
                    skrals.Add(Skral.Factory(cellstate.index));
                }
                else if (type == typeof(Wardrak))
                {
                    wardraks.Add(Wardrak.Factory(cellstate.index));
                }
                else if (type == typeof(TowerSkral))
                {
                    towerskrals.Add(TowerSkral.Factory(cellstate.index, players.Count));
                }
                else if (type.IsSubclassOf(typeof(Fog)))
                {
                    string id = type.ToString().Replace("Fog", "");
                    Fog.Load(id, type, cellstate.index);
                }
                else if (type == typeof(Well))
                {
                    wells.Add(Well.Factory(cellstate.index));
                }
                // Items in cells
                if (PhotonNetwork.IsMasterClient)
                {
                    if (type == typeof(GoldCoin))
                    {
                        GoldCoin.Factory(cellstate.index);
                    }
                    else if (type.IsSubclassOf(typeof(SmallToken)))
                    {
                        type.GetMethod("Factory", new[] { typeof(int) }).Invoke(type, new object[] { cellstate.index });
                    }
                    else if (type.IsSubclassOf(typeof(BigToken)))
                    {
                        type.GetMethod("Factory", new[] { typeof(int) }).Invoke(type, new object[] { cellstate.index });
                    }
                }
            }
        }

        // Narrator
        NarratorState narratorState = FileManager.Load <NarratorState>(directory + "/Narrator.json");

        narrator.Load(narratorState);

        // Wells
        WellsState wellsState = FileManager.Load <WellsState>(directory + "/Wells.json");

        foreach (int cellId in wellsState.wellsCellId)
        {
            bool found = false;
            foreach (Well well in wells)
            {
                if (well.Cell.Index == cellId)
                {
                    found = true;
                    break;
                }
            }

            // If not found, the well is empty
            if (!found)
            {
                wells.Add(Well.Factory(cellId, false));
            }
        }
    }