public object Clone() { EquipmentSaveData ret = new EquipmentSaveData (); ret.icon = icon; ret.name = name; ret.acceleration = acceleration; ret.ammo = new List<string> (ammo); ret.cooldown = cooldown; ret.damageBonus = damageBonus; ret.damageMultiplier = damageMultiplier; ret.energyCost = energyCost; ret.ep = ep; ret.epRegen = epRegen; ret.hp = hp; ret.hpRegen = hpRegen; ret.maxSpeed = maxSpeed; ret.minSpeed = minSpeed; ret.sp = sp; ret.spRegen = spRegen; ret.spRegenDelay = spRegenDelay; ret.strafe = strafe; ret.type = type; ret.weight = weight; return ret; }
public void SaveItem(EquipmentType slot) { Debug.Log("Save item!"); EquipmentSaveData itemDatafile = ScriptableObject.CreateInstance <EquipmentSaveData>(); itemDatafile.item1 = equipmentDict[slot]; EquipmentSaveData itemdata = (EquipmentSaveData)Resources.Load("Itemdata.asset"); itemdata = itemDatafile; }
public static void LoadEquipment(EquipmentUI _equipment, ItemsDataBase _itemsDataBase) { if (File.Exists(SAVE_PATH + EQUIPMENT_FILE)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(SAVE_PATH + EQUIPMENT_FILE, FileMode.Open); EquipmentSaveData equipData = bf.Deserialize(file) as EquipmentSaveData; equipData.LoadToEquipment(_equipment, _itemsDataBase); file.Close(); } }
public static void SaveEquipement(EquipmentUI _equipment) { if (!Directory.Exists(SAVE_PATH)) { Directory.CreateDirectory(SAVE_PATH); } BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(SAVE_PATH + EQUIPMENT_FILE, FileMode.Create); EquipmentSaveData equipData = new EquipmentSaveData(_equipment); bf.Serialize(file, equipData); file.Close(); }
public void Interact(GameObject interacter) { CharacterInventory inventory = interacter.GetComponent <CharacterInventory>(); Debug.Log("Interacted with!"); if (inventory.CheckEmptySlot(EquipmentType.Helm)) { Debug.Log("Loading Item!"); EquipmentSaveData itemdata = (EquipmentSaveData)Resources.Load("Itemdata"); inventory.EquipItem(itemdata.item1); } }
public void Load(EquipmentSaveData equipmentElement) { currentEquipmentElement = equipmentElement; inpt_acceleration.text = currentEquipmentElement.acceleration.ToString (); inpt_ep.text = currentEquipmentElement.ep.ToString (); inpt_epRegen.text = currentEquipmentElement.epRegen.ToString (); inpt_hp.text = currentEquipmentElement.hp.ToString (); inpt_hpRegen.text = currentEquipmentElement.hpRegen.ToString (); sprite_icon.spriteName = currentEquipmentElement.icon; inpt_maxSpeed.text = currentEquipmentElement.maxSpeed.ToString (); inpt_minSpeed.text = currentEquipmentElement.minSpeed.ToString (); inpt_name.text = currentEquipmentElement.name; inpt_sp.text = currentEquipmentElement.sp.ToString (); inpt_spRegen.text = currentEquipmentElement.spRegen.ToString (); inpt_spRegenDelay.text = currentEquipmentElement.spRegenDelay.ToString (); inpt_strafe.text = currentEquipmentElement.strafe.ToString (); inpt_weight.text = currentEquipmentElement.weight.ToString (); inpt_cooldown.text = currentEquipmentElement.cooldown.ToString (); inpt_damageBonus.text = currentEquipmentElement.damageBonus.ToString (); inpt_damageMultiplier.text = currentEquipmentElement.damageMultiplier.ToString (); inpt_energyCost.text = currentEquipmentElement.energyCost.ToString (); switch (currentEquipmentElement.type) { case EquipmentType.Engine: poplst_type.selection = "Engine"; break; case EquipmentType.Hull: poplst_type.selection = "Hull"; break; case EquipmentType.Weapon: poplst_type.selection = "Weapon"; break; case EquipmentType.Misc: poplst_type.selection = "Misc"; break; } RefreshAmmoList (); poplst_ammo.selection = "-"; poplst_ammo.selection = poplst_ammo.items [0]; }
void Awake() { int r = Random.Range (1000, 9999); currentEquipmentElement = new EquipmentSaveData ("Equipment" + r); }