movement and dialogue system

This commit is contained in:
Sylvia 2026-07-25 02:23:50 -07:00
parent 977e666577
commit 1590b5faa6
123 changed files with 62825 additions and 355 deletions

View file

@ -0,0 +1,60 @@
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
public class InventoryManager : MonoBehaviour
{
public int maxCapacity;
public int currentlyStored;
public Dictionary<Item, int> storedItems = new();
public Item[] itemList;
public int money;
public bool RemoveMoney(int change)
{
if (money - change >= 0)
{
money -= change;
return true;
}
return false;
}
public void AddMoney(int change)
{
money += change;
}
public int AddItem(Item itemToAdd, int amount = 1)
{
if (currentlyStored < maxCapacity)
{
if (!storedItems.ContainsKey(itemToAdd))
{
storedItems[itemToAdd] = 0;
}
if (currentlyStored + amount <= maxCapacity)
{
storedItems[itemToAdd] += amount;
currentlyStored += amount;
return 0;
}
//return the amount that wasn't able to be stored.
int stored = maxCapacity - currentlyStored;
storedItems[itemToAdd] += stored;
currentlyStored += stored;
amount -= stored;
return amount;
}
return -1;
}
public bool RemoveItem(Item itemToRemove, int amount = 1)
{
if (!storedItems.ContainsKey(itemToRemove) || storedItems[itemToRemove] < amount)
{
return false;
}
storedItems[itemToRemove] -= amount;
return true;
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 774be886d08d70001b075b9f5f4db7f7

View file

@ -0,0 +1,8 @@
using UnityEngine;
public class Item : MonoBehaviour
{
public string itemName;
public string description;
public Sprite icon;
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a100b9e8279440fd88e58bae66ffb885