public void SelectType(string buttonName)
 {
     saveData = controller.getCurrentSaveData();
     skills   = typeToSkillList[buttonName];
     for (int i = 0; i < skills.Count; i++)
     {
         saveData.getCompanionData().AddSkill(skills[i]);
         saveData.getCompanionData().AddSkillLevel(1);
     }
     controller.setCurrentSaveData(saveData);
 }
Exemple #2
0
    // Use this for initialization

    protected virtual void Start()
    {
        GameObject so = Resources.Load("Settings Object") as GameObject;
        GameObject op = Resources.Load("Object Pool") as GameObject;

        op          = Instantiate(op);
        objectPool  = op.GetComponent <ObjectPool>();
        menuButtons = new List <MenuButton>(FindObjectsOfType <MenuButton>());


        if (GameStorage.Exists(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY))
        {
            currentSaveData = GameStorage.Load <PlayerSaveData>(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY);
            Debug.Log(currentSaveData.getCompanionData().mySkills.Count);
            for (int i = 0; i < menuButtons.Count; i++)
            {
                menuButtons[i].NotifyThatPlayerHasSavedBefore();
            }
        }
        else
        {
            currentSaveData       = new PlayerSaveData(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY);
            playerShouldBeTutored = true;
        }

        SceneNavigation.singleton.saveGameContent += SaveGameData;

        settingsObject = objectPool.registerObject <SettingsObject>(so);
        objectPool.activateObject(settingsObject);
    }
    // Use this for initialization
    void Start()
    {
        currentSaveData = Player.singleton.getCurrentSaveData();
        CompanionData companionData = currentSaveData.getCompanionData();

        for (int i = 0; i < companionData.mySkills.Count; i++)
        {
            skills.Add(companionData.mySkills[i]);
        }
        skillImages = new List <Image>(GetComponentsInChildren <Image>());

        for (int i = 0; i < skills.Count; i++)
        {
            skillImages[i].sprite = nameSpriteDB.getSpriteByName(skills[i]);
        }
    }