You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using SiegeSong;
|
|
|
|
|
|
|
|
|
|
namespace SiegeSong
|
|
|
|
|
{
|
|
|
|
|
public class WorldObject : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public string InstanceID;
|
|
|
|
|
|
|
|
|
|
public WorldObjectType Type;
|
|
|
|
|
public string Key;
|
|
|
|
|
|
|
|
|
|
public string Name = "Selectable";
|
|
|
|
|
public string Interaction = "Interact with";
|
|
|
|
|
public bool Danger = false;
|
|
|
|
|
public int ItemID;
|
|
|
|
|
public int ItemAmount;
|
|
|
|
|
public Sprite Icon;
|
|
|
|
|
public UnityEngine.Events.UnityEvent OnInteract;
|
|
|
|
|
public Container Container;
|
|
|
|
|
|
|
|
|
|
void Start() { }
|
|
|
|
|
|
|
|
|
|
void Update() { }
|
|
|
|
|
|
|
|
|
|
public void Activate(InventoryManager inventoryManager)
|
|
|
|
|
{
|
|
|
|
|
if (inventoryManager != null)
|
|
|
|
|
{
|
|
|
|
|
if (Container == null)
|
|
|
|
|
{
|
|
|
|
|
inventoryManager.InstanceManager.WorldObjectInstances.Remove(inventoryManager.InstanceManager.GetWorldObjectInstanceByID(InstanceID));
|
|
|
|
|
inventoryManager.InstanceManager.WorldObjectInstanceIDs.Remove(InstanceID);
|
|
|
|
|
inventoryManager.AddItem(ItemID, ItemAmount);
|
|
|
|
|
Destroy(gameObject);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
inventoryManager.OpenTransferMenu(Container);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (OnInteract != null)
|
|
|
|
|
OnInteract.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|