Ejemplo n.º 1
0
    // =========================================================================================== //
    private void displaySkills()
    {
        // create the stats to display list, show only the skills with more than 0
        List <Stat> statsToDisplay = new List <Stat>();

        foreach (Stat stat in University.Instance.Skills)
        {
            int playerLevelInCurrentStat = Party.Instance.SelectedMember.Stats[stat];
            if (playerLevelInCurrentStat <= 0)
            {
                continue;
            }
            statsToDisplay.Add(stat);
        }

        // rebuild skills grid
        _grid.Rebuild(statsToDisplay.Count);

        // display skills
        for (int i = 0; i < statsToDisplay.Count; ++i)
        {
            Stat stat = statsToDisplay[i];
            _grid.GetElement(i).GetComponent <SkillButton>().Stat = stat;

            // disable clicking
            _grid.GetElement(i).GetComponent <SkillButton>().IsActive = false;
        }
    }
Ejemplo n.º 2
0
    // ================================================================================================== //
    private void ShowArea(Position position)
    {
        // check valid area
        if (!_dungeonSaveData.Areas.ContainsKey(position))
        {
            Debug.LogError("area doesn't exist in that position: " + position.ToString());
            return;
        }

        // clear current grid
        clear();

        // get the area
        AreaSaveData areaToShow = _dungeonSaveData.Areas[position];

        // put area objects in grid.
        foreach (SaveData objSaveData in areaToShow.Objects)
        {
            DungeonTile tile       = _grid.GetElement(objSaveData.Position) as DungeonTile;
            GameObject  createdObj = createObjectInTile(objSaveData.Name, tile);

            // add crried items on creature
            if (objSaveData is CreatureSaveData)
            {
                CreatureSaveData creatureSaveData = objSaveData as CreatureSaveData;
                Creature         creature         = createdObj.GetComponent <Creature>();
                foreach (ItemSaveData itemSaveData in creatureSaveData.CarriedItems)
                {
                    createObjectInCreature(itemSaveData.Name, creature);
                }
            }
        }

        // fog of war
        foreach (DungeonTile tile in _grid.Elements)
        {
            tile.IsRevealed = areaToShow.TileRevealationMap[tile.Position.X, tile.Position.Y];
        }

        // update current area index
        _currentShownAreaPosition = position;

        // update the dungeon tile sprite - grass or floor
        foreach (DungeonTile tile in _grid.Elements)
        {
            if (IsInOriginArea)
            {
                tile.GetComponent <SpriteRenderer>().sprite = ResourcesManager.Instance.OutdoorDungeonTileSprite;
            }
            else
            {
                tile.GetComponent <SpriteRenderer>().sprite = ResourcesManager.Instance.FloorDungeonTileSprite;
            }
        }
    }
Ejemplo n.º 3
0
    // =========================================================================================== //
    private void displaySkills()
    {
        // rebuild skills grid
        _grid.Rebuild(_skills.Count);

        // display skills
        for (int i = 0; i < _skills.Count; ++i)
        {
            Stat stat = _skills[i];
            _grid.GetElement(i).GetComponent <SkillButton>().Stat = stat;
        }
    }
Ejemplo n.º 4
0
    // ================================================================================================== //
    private void showArea(Position position) // return the area index
    {
        // clear current grid
        clear();

        // get the area
        AreaSaveData areaToShow = getArea(position);

        // putObjectInTile area objects in grid
        foreach (SaveData obj in areaToShow.Objects)
        {
            DungeonTile tile = _grid.GetElement(obj.Position) as DungeonTile;
            putObjectInTile(obj.Name, tile);
        }

        // update current area index
        _currentShownAreaPosition = position;
    }
Ejemplo n.º 5
0
    // ================================================================================================== //
    public void BuildLibrary()
    {
        // rebuild the books grid to match the number of dungeons
        int numberOfDungeons = SaveAndLoad.Instance.PlayerSaveData.Dungeons.Count;

        _grid.Rebuild(numberOfDungeons);

        // set dungeon for each book
        for (int i = 0; i < numberOfDungeons; ++i)
        {
            string dungeonName = SaveAndLoad.Instance.PlayerSaveData.Dungeons[i].Name;
            Debug.Log(dungeonName + " Loaded to book...");
            _grid.GetElement(i).GetComponent <LibraryBook>().DungeonName = dungeonName;

            // init _bookAndItsPages dictionary page list for the current dungeon
            _bookAndItsPages[dungeonName] = new List <int>();
            // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            // TODO: delete those init test pages in book...
            if (dungeonName == "a")
            {
                _bookAndItsPages[dungeonName].Add(1);
                _bookAndItsPages[dungeonName].Add(3);
                _bookAndItsPages[dungeonName].Add(7);
            }
            else if (dungeonName == "b")
            {
                _bookAndItsPages[dungeonName].Add(1);
                _bookAndItsPages[dungeonName].Add(3);
                _bookAndItsPages[dungeonName].Add(7);
                _bookAndItsPages[dungeonName].Add(12);
                _bookAndItsPages[dungeonName].Add(13);
                _bookAndItsPages[dungeonName].Add(16);
                _bookAndItsPages[dungeonName].Add(19);
            }
            // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        }
    }