Exemple #1
0
    // Use this for initialization
    void Start()
    {
        //PlayerCharacterSheet.LoadFromDisk("Save1.txt")
        string dataPath = Path.Combine(Application.persistentDataPath, SaveFile1);

        if (!File.Exists(dataPath))
        {
            PlayerCharacterSheet.SaveToDisk(new PlayerCharacterSheet(), dataPath);
        }
        Character1 = PlayerCharacterSheet.LoadFromDisk(SaveFile1);

        dataPath = Path.Combine(Application.persistentDataPath, SaveFile2);
        if (!File.Exists(dataPath))
        {
            PlayerCharacterSheet.SaveToDisk(new PlayerCharacterSheet(), dataPath);
        }
        Character2 = PlayerCharacterSheet.LoadFromDisk(SaveFile2);

        dataPath = Path.Combine(Application.persistentDataPath, SaveFile3);
        if (!File.Exists(dataPath))
        {
            PlayerCharacterSheet.SaveToDisk(new PlayerCharacterSheet(), dataPath);
        }

        Character3 = PlayerCharacterSheet.LoadFromDisk(SaveFile3);
    }
Exemple #2
0
    public void AttemptToPurchase(ItemClass CurrentlySelectedItem)
    {
        PlayerCharacterSheet CurrentPlayer = PlayerStorage.GetComponent <PlayerBuyingEquipment>().GetPlayer();
        //ItemClass CurrentlySelectedItem = ItemClass.GetItem(ItemSlot.WEAPON, 3);
        ItemClass OldItem = CurrentPlayer.GetItem(CurrentlySelectedItem.GetItemType());

        DescriptionTextBox.text = CurrentlySelectedItem.GetItemDesc();
        TransactionDetails.text = "Purchase Price $" + CurrentlySelectedItem.GetGoldCost() + ", Trade in Value $" + OldItem.GetGoldCost()
                                  + ", \nNet Purchase price $" + (CurrentlySelectedItem.GetGoldCost() - OldItem.GetGoldCost());
        if (CurrentlySelectedItem.GetGoldCost() > (CurrentPlayer.Gold + OldItem.GetGoldCost()))
        {
            ErrorTextBox.text = "Error, not enough funds.";
            return;
        }
        CurrentPlayer.Gold = CurrentPlayer.Gold - (CurrentlySelectedItem.GetGoldCost() - OldItem.GetGoldCost());
        CurrentPlayer.AddEquipment(CurrentlySelectedItem);
        CurrentFundsBox.text = "Current Funds $" + CurrentPlayer.Gold;
        PlayerCharacterSheet.SaveToDisk(CurrentPlayer, CharacterSheetLocation);
        PlayerStorage.GetComponent <PlayerBuyingEquipment>().UpdateRequired();
        WeaponEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment();
        ArmorEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment();
        ShieldEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment();
        PowerEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment();
        EnginesEquipped.GetComponent <InventoryItemDisplay>().RefreshEquipment();
    }
Exemple #3
0
 public void SaveCharacterToDisk(string SaveFileName)
 {
     PlayerCharacterSheet.SaveToDisk(ThisPlayer, SaveFileName);
 }