// Use this for initialization private void Start() { ListCapacity = BackPackConfig.Capacity; _idcount = 0; Inventory = new List <Item>(); currentBackPack = ScriptableObject.CreateInstance <BackPackConfig>(); Assert.IsNotNull(BackPackConfig); Assert.IsNotNull(BackPackConfig.Items, "no items"); BackPackConfig.Items.ForEach(AddToStash); }
public void SaveBackPack(string filename, BackPackConfig backPack) { var bp = ScriptableObject.CreateInstance <BackPackConfig>(); bp.InitInventory = backPack.InitInventory; //currentBackPack.InitInventory = Inventory; var json = JsonUtility.ToJson(currentBackPack, true); var path = Application.persistentDataPath + string.Format("/{0}.json", filename); File.WriteAllText(path, json); }
// Use this for initialization void Start() { Start_Items = new BackPackConfig(); Inventory = new List <Item>(); Knife = new CombatKnife(); foreach (var i in Start_Items.Items) { var StartItems = Instantiate(i); Add(StartItems); } Capacity = Start_Items.Capacity; }
public void LoadBackPackIn(BackPackConfig newBackpack) { List <Item> oldItems = new List <Item>(); oldItems.AddRange(Items); Items.Clear(); foreach (var variable in newBackpack.Items) { AddItem(variable); } foreach (var variable in oldItems) { AddItem(variable); } }
public void DoPostConfigure(GameObject go) { Light2D light2D = go.AddOrGet <Light2D>(); light2D.overlayColour = LIGHT2D.CEILINGLIGHT_OVERLAYCOLOR; light2D.Color = new Color(0.5f, 0.5f, 0); light2D.Range = 4f; light2D.Angle = 0f; light2D.Direction = LIGHT2D.FLOORLAMP_DIRECTION; light2D.Offset = new Vector2(0f, 0.5f); light2D.shape = LightShape.Circle; light2D.drawOverlay = true; light2D.Lux = 1000; BackPackConfig.SetupVest(go); }
public void Load() { currentBackPack = LoadBackPack(FileNameToSave); Inventory = currentBackPack.InitInventory; BackPackChange.Invoke(currentBackPack); }
public void DoPostConfigure(GameObject go) { BackPackConfig.SetupVest(go); }