Loot container prototyping
This commit is contained in:
parent
8f26e24337
commit
eee855551a
File diff suppressed because it is too large
Load Diff
@ -328,7 +328,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.78431374}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastTarget: 0
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
@ -355,9 +355,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0e9d0435d71802c4387db949c199c1ef, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
StorageContainer: {fileID: 4417106257405200098}
|
||||
itemUI: {fileID: 0}
|
||||
dragWindowUI: {fileID: 4417106256859116618}
|
||||
ItemUI: {fileID: 0}
|
||||
StorageContainer: {fileID: 4417106257405200098}
|
||||
--- !u!114 &9131793476022473716
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -383,6 +383,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MinimumSize: 75
|
||||
MinimumSizeX: 0
|
||||
--- !u!1 &4417106256853968310
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -470,6 +471,7 @@ GameObject:
|
||||
- component: {fileID: 4417106256859116616}
|
||||
- component: {fileID: 4417106256859116619}
|
||||
- component: {fileID: 4417106256859116618}
|
||||
- component: {fileID: 8834128785697470302}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
@ -548,6 +550,18 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
title: {fileID: 4936616483716529338}
|
||||
--- !u!114 &8834128785697470302
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4417106256859116620}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f47e497dfc27e9947bc9e6a360f5d2dd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4417106256897273753
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -694,6 +708,7 @@ GameObject:
|
||||
- component: {fileID: 4308990909546901523}
|
||||
- component: {fileID: 1651271832990124042}
|
||||
- component: {fileID: 118570070265754670}
|
||||
- component: {fileID: 8907822599805716267}
|
||||
m_Layer: 5
|
||||
m_Name: GridContainer
|
||||
m_TagString: Untagged
|
||||
@ -770,6 +785,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MinimumSize: 75
|
||||
MinimumSizeX: 0
|
||||
--- !u!114 &118570070265754670
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -795,3 +811,15 @@ MonoBehaviour:
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
--- !u!114 &8907822599805716267
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4417106257405200098}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f47e497dfc27e9947bc9e6a360f5d2dd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
8
Assets/Inventory System/ScriptableObjects.meta
Normal file
8
Assets/Inventory System/ScriptableObjects.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ac12bf62f88a0f41a63ca39063ba1e7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,43 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df3eda42573609b479562fe43da4853a, type: 3}
|
||||
m_Name: Tool Box Loot Container
|
||||
m_EditorClassIdentifier:
|
||||
spawnableItemPrefabs:
|
||||
- {fileID: 8053794548077495502, guid: 67a5c33ceead1f14399d9a78cdcfb734, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 4f93d111a901f1a4ba252ba52a6d1a83, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 3e5ad4148935cf44f8f502719c58ac30, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 3654d804175a12f4c9f2bdeafed7f4c5, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: d42738c8afec0044e9b95cfd814f6ebb, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 09d984ff8b1e9f841938cc645460bc27, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 72ee0f19f22b98145ab1c93fd56be6b9, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 11549868f6a64e940aa1c8506096694b, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 73e989f3b74c653458054ca38f94209e, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: faf601a2d53e0594f8dcf665100cf28e, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 1b7439e6ea87c004594812f94a9fd481, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: f0fbb4c62750a814c8baa4eeceba5d63, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 74ec3d723b6c8f74a90ae2a6839970cb, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 18fdbd5cb64964d479fe73d102bff4c2, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 3173001f8d1bc624792b41389e0962a3, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 73fad84de7be5dc48a36f840386270de, type: 3}
|
||||
- {fileID: 8053794548077495502, guid: 330fa239832e76849be9c5abe89f0702, type: 3}
|
||||
spawnRates:
|
||||
- rarity: 0
|
||||
spawnRate: 0.5
|
||||
spawnTime: 1800
|
||||
minimumSpawnDistance: 100
|
||||
minimumContainerSize:
|
||||
Width: 3
|
||||
Height: 3
|
||||
maximumContainerSize:
|
||||
Width: 5
|
||||
Height: 5
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22d3a241f9db00542aff64217d77dd36
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -24,7 +24,7 @@ public class DeriveSizeFromChild : MonoBehaviour
|
||||
}
|
||||
if (childRect != null && rect != null)
|
||||
{
|
||||
Debug.Log(childRect.rect);
|
||||
//Debug.Log(childRect.rect);
|
||||
if(childRect.rect.height > MinimumSize)
|
||||
rect.sizeDelta = new Vector3(rect.sizeDelta.x, childRect.sizeDelta.y);
|
||||
else
|
||||
|
@ -103,7 +103,7 @@ namespace SimpleInventorySystem
|
||||
|
||||
public TagSlotGridPairing()
|
||||
{
|
||||
Debug.Log("this should be called");
|
||||
//Debug.Log("this should be called");
|
||||
SetSlotsOrGrid();
|
||||
/*if (tagSlotGridPairUI == null && slot == null && tagSlotGridPairUI == null)
|
||||
{
|
||||
@ -598,6 +598,7 @@ namespace SimpleInventorySystem
|
||||
// TODO: functionality here
|
||||
|
||||
Inventory response_inventory = hits[i].collider.transform.GetComponent<Inventory>();
|
||||
LootContainer response_lootContainer = hits[i].collider.transform.GetComponent<LootContainer>();
|
||||
|
||||
if (response_inventory != null && response_inventory == player.inventory)
|
||||
{
|
||||
@ -620,6 +621,22 @@ namespace SimpleInventorySystem
|
||||
CurrentState = States.Loot;
|
||||
}
|
||||
}
|
||||
else if (response_lootContainer != null && !InventorySystem.instance.IsUsingInventoryMenuUI())
|
||||
{
|
||||
//Debug.Log("Opening Inventory");
|
||||
if (interactKeyInput.PressedKey(true))
|
||||
{
|
||||
OpenInventory();
|
||||
LootMenuUI.SetActive(true);
|
||||
StatsMenuUI.SetActive(false);
|
||||
Loot(response_lootContainer);
|
||||
CurrentState = States.Undefined;
|
||||
}
|
||||
else if (!InventorySystem.instance.IsUsingInventoryMenuUI())
|
||||
{
|
||||
CurrentState = States.Loot;
|
||||
}
|
||||
}
|
||||
else if(!InventorySystem.instance.IsUsingInventoryMenuUI())
|
||||
{
|
||||
CurrentState = States.Undefined;
|
||||
@ -649,6 +666,15 @@ namespace SimpleInventorySystem
|
||||
StartCoroutine(LootGrid.PopulateItemsWithNewInventory(inventory.itemUIs));
|
||||
}
|
||||
}
|
||||
public void Loot(LootContainer lootContainer)
|
||||
{
|
||||
if (lootContainer != null && !lootContainer.hasBeenLooted)
|
||||
{
|
||||
lootContainer.Loot();
|
||||
//Debug.Log($"Looting: {inventory.itemUIs.Count}");
|
||||
StartCoroutine(LootGrid.PopulateItemsWithNewInventory(lootContainer.itemUIs));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This can be called to check if player is interacting with the Inventory System's UI
|
||||
|
138
Assets/Inventory System/Scripts/Inventory/LootContainer.cs
Normal file
138
Assets/Inventory System/Scripts/Inventory/LootContainer.cs
Normal file
@ -0,0 +1,138 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleInventorySystem
|
||||
{
|
||||
public class LootContainer : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public bool hasBeenLooted = false;
|
||||
public bool itemsHaveBeenInstantiated = false;
|
||||
public bool itemsHaveBeenHidden = false;
|
||||
[HideInInspector] public List<ItemUI> itemUIs;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates the item prefab first and calls necessary stuff.
|
||||
/// </summary>
|
||||
public void Loot()
|
||||
{
|
||||
if (!hasBeenLooted)
|
||||
{
|
||||
itemUIs = new List<ItemUI>();
|
||||
Size size = GenerateContainerSize();
|
||||
PopulateContainer(size);
|
||||
hasBeenLooted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasBeenLooted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void HideGameObjects()
|
||||
{
|
||||
if (hasBeenLooted && itemsHaveBeenInstantiated && !itemsHaveBeenHidden)
|
||||
{
|
||||
foreach (ItemUI item in itemUIs)
|
||||
{
|
||||
//Debug.Log(item.gameObject.name);
|
||||
//Debug.Log(item.pickUp.gameObject.name);
|
||||
item.pickUp.ItemGameObject.SetActive(false);
|
||||
}
|
||||
itemsHaveBeenHidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
public ScriptableLootContainer data;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
Debug.LogError("Loot Container should have a Scriptable Loot Container referenced.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public Size GenerateContainerSize()
|
||||
{
|
||||
int width = Random.Range(data.minimumContainerSize.Width, data.maximumContainerSize.Width + 1);
|
||||
int height = Random.Range(data.minimumContainerSize.Height, data.maximumContainerSize.Height + 1);
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
public void PopulateContainer(Size size)
|
||||
{
|
||||
int cells = size.Width * size.Height;
|
||||
int limit = 50;
|
||||
while(limit > 0 && cells > 0)
|
||||
{
|
||||
GameObject item = Spawn();
|
||||
ItemUI itemUI = item.GetComponentInChildren<ItemUI>();
|
||||
PickUp pickUp = item.GetComponentInChildren<PickUp>();
|
||||
item.SetActive(true);
|
||||
item.transform.position = Vector3.zero;
|
||||
item.transform.SetParent(InventorySystem.instance.DefaultItemSpawn, false);
|
||||
if (item.GetComponent<Rigidbody>() != null)
|
||||
item.GetComponent<Rigidbody>().useGravity = false;
|
||||
if (itemUI != null)
|
||||
{
|
||||
itemUIs.Add(itemUI);
|
||||
itemUI.gameObject.SetActive(true);
|
||||
pickUp.gameObject.SetActive(true);
|
||||
//AddOwnership(item, this);
|
||||
//item.transform.SetParent(transform, true);
|
||||
itemUI.InitializeImageSize();
|
||||
itemUI.ResetTransform();
|
||||
//gObj.transform.SetParent(item.transform, true);
|
||||
//gObj.SetActive(false);
|
||||
//item.pickUp = gObj.GetComponentInChildren<PickUp>();
|
||||
}
|
||||
|
||||
cells -= itemUI.width * itemUI.height;
|
||||
limit--;
|
||||
}
|
||||
Invoke(nameof(HideGameObjects), .1f);
|
||||
itemsHaveBeenInstantiated = true;
|
||||
}
|
||||
|
||||
private GameObject Spawn()
|
||||
{
|
||||
// RNG rarity
|
||||
float rate = Random.Range(0f, 1f);
|
||||
RarityType rarity = data.GetRandomRarity(rate);
|
||||
|
||||
// RNG item
|
||||
GameObject prefab = data.GetRandomItem(rarity);
|
||||
GameObject newItem = Instantiate(prefab);
|
||||
Debug.Log($"Loot Container: {newItem.name}");
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*public void RemoveOwnership(ItemUI item, Inventory newOwnerInventory)
|
||||
{
|
||||
item.Inventory = newOwnerInventory;
|
||||
//items.Remove(item.pickUp.ItemGameObject);
|
||||
itemUIs.Remove(item);
|
||||
newOwnerInventory.AddOwnership(item, this);
|
||||
}
|
||||
public void AddOwnership(ItemUI item, Inventory oldOwnerInventory)
|
||||
{
|
||||
//items.Add(item.pickUp.ItemGameObject);
|
||||
itemUIs.Add(item);
|
||||
//item.Inventory = this;
|
||||
}*/
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db29f8627ad31904eab8cda9ef97002b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Inventory System/Scripts/ScriptableObjects.meta
Normal file
8
Assets/Inventory System/Scripts/ScriptableObjects.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 589ebc9ebcd500c4a986f22b14358d25
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleInventorySystem
|
||||
{
|
||||
public class ScriptableInventoryDatabase : MonoBehaviour
|
||||
{
|
||||
public GameObject[] AvailableItemPrefabs;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1792f520ea97a944994aa7f690bd66ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleInventorySystem
|
||||
{
|
||||
[CreateAssetMenu(fileName = "New Scriptable Loot Container", menuName = "Inventory System/Loot Containers")]
|
||||
public class ScriptableLootContainer : ScriptableObject
|
||||
{
|
||||
public GameObject[] spawnableItemPrefabs;
|
||||
public SpawnRairtyToItemRate[] spawnRates;
|
||||
public float spawnTime = 1800; // 30 minutes * 60 seconds
|
||||
public float minimumSpawnDistance = 100;
|
||||
public Size minimumContainerSize = new Size(3, 3);
|
||||
public Size maximumContainerSize = new Size(5, 5);
|
||||
[HideInInspector] public Dictionary<RarityType, List<GameObject>> ItemPool = new Dictionary<RarityType, List<GameObject>>();
|
||||
[HideInInspector] public Dictionary<int, List<GameObject>> ItemPoolBySize = new Dictionary<int, List<GameObject>>();
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
//Debug.Log("Awake");
|
||||
if (minimumContainerSize.Width > maximumContainerSize.Width)
|
||||
{
|
||||
Debug.LogError("Minimum Container Size's width is greater than Maximum Containzer Size's width. Attempting to resolve.");
|
||||
minimumContainerSize.Width = 3;
|
||||
maximumContainerSize.Width = 5;
|
||||
}
|
||||
if (minimumContainerSize.Height > maximumContainerSize.Height)
|
||||
{
|
||||
Debug.LogError("Maximum Container Size's height is greater than Maximum Containzer Size's height. Attempting to resolve.");
|
||||
minimumContainerSize.Height = 3;
|
||||
maximumContainerSize.Height = 5;
|
||||
}
|
||||
//Debug.Log(spawnableItemPrefabs.Length);
|
||||
ItemPool = new Dictionary<RarityType, List<GameObject>>();
|
||||
foreach (GameObject gameObject in spawnableItemPrefabs)
|
||||
{
|
||||
ItemUI item = gameObject.GetComponentInChildren<ItemUI>();
|
||||
if (item != null)
|
||||
{
|
||||
if (!ItemPool.ContainsKey(item.rarity))
|
||||
{
|
||||
ItemPool.Add(item.rarity, new List<GameObject>());
|
||||
}
|
||||
|
||||
ItemPool[item.rarity].Add(gameObject);
|
||||
}
|
||||
//Debug.Log(gameObject.name);
|
||||
}
|
||||
}
|
||||
|
||||
public RarityType GetRandomRarity(float rate)
|
||||
{
|
||||
float currentRate = 0;
|
||||
RarityType fallBackRarity = spawnableItemPrefabs[0].GetComponentInChildren<ItemUI>().rarity;
|
||||
foreach (SpawnRairtyToItemRate sR in spawnRates)
|
||||
{
|
||||
if (rate <= currentRate + sR.spawnRate)
|
||||
{
|
||||
return sR.rarity;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRate = sR.spawnRate;
|
||||
}
|
||||
}
|
||||
return fallBackRarity;
|
||||
}
|
||||
|
||||
public GameObject GetRandomItem(RarityType rarity)
|
||||
{
|
||||
if (!ItemPool.ContainsKey(rarity))
|
||||
{
|
||||
Debug.LogError("Rarity not found in Item Pool.");
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = UnityEngine.Random.Range(0, ItemPool[rarity].Count);
|
||||
return ItemPool[rarity][index];
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SpawnRairtyToItemRate
|
||||
{
|
||||
public RarityType rarity;
|
||||
[Range(0, 1)] public float spawnRate;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df3eda42573609b479562fe43da4853a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -2,6 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleInventorySystem
|
||||
{
|
||||
public class BlockRaycast : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
@ -16,3 +18,4 @@ public class BlockRaycast : MonoBehaviour
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,13 @@ namespace SimpleInventorySystem
|
||||
{
|
||||
inspectButton.onClick.AddListener(OpenInspectionWindow);
|
||||
}
|
||||
|
||||
Button dropButton = itemInspectMenu.transform.Find("Drop").GetComponent<Button>();
|
||||
Debug.Log("ContextMenuManager: " + inspectButton);
|
||||
if (inspectButton != null)
|
||||
{
|
||||
dropButton.onClick.AddListener(DropItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenInspectionWindow()
|
||||
@ -59,6 +66,7 @@ namespace SimpleInventorySystem
|
||||
//inspectItem.ContextWindows.Add(TacticalRigInspectionWindow);
|
||||
//TacticalRigInspectionWindow.SetActive(true);
|
||||
inspectItem.ShowInspectionWindow();
|
||||
CloseContextMenu();
|
||||
|
||||
}
|
||||
}
|
||||
@ -82,6 +90,11 @@ namespace SimpleInventorySystem
|
||||
{
|
||||
inspectButton.onClick.RemoveListener(OpenInspectionWindow);
|
||||
}
|
||||
Button dropButton = itemInspectMenu.transform.Find("Drop").GetComponent<Button>();
|
||||
if (dropButton != null)
|
||||
{
|
||||
dropButton.onClick.RemoveListener(DropItem);
|
||||
}
|
||||
inspectItem.SetInteractable(true);
|
||||
}
|
||||
inspectItem = null;
|
||||
|
@ -33,6 +33,29 @@ namespace SimpleInventorySystem
|
||||
{
|
||||
ShortDescriptionText.text = $"{ItemUI.shortDescription}";
|
||||
}
|
||||
if (DropButton != null)
|
||||
{
|
||||
DropButton.onClick.AddListener(DropItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void DropItem()
|
||||
{
|
||||
Debug.Log("Drop");
|
||||
if (ItemUI != null)
|
||||
{
|
||||
ItemUI.DropItemAway();
|
||||
CloseInspectionWindow();
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseInspectionWindow()
|
||||
{
|
||||
if (DropButton != null)
|
||||
{
|
||||
DropButton.onClick.RemoveListener(DropItem);
|
||||
}
|
||||
dragWindowUI.CloseWindow();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -996,10 +996,10 @@ namespace SimpleInventorySystem
|
||||
IEnumerator coroutineA()
|
||||
{
|
||||
// wait for 1 second
|
||||
Debug.Log("coroutineA created");
|
||||
//Debug.Log("coroutineA created");
|
||||
yield return new WaitForEndOfFrame();
|
||||
container.SetActive(false);
|
||||
Debug.Log("coroutineA running again");
|
||||
//Debug.Log("coroutineA running again");
|
||||
}
|
||||
|
||||
public void DropItemAway()
|
||||
|
28
Assets/New Noise Settings.asset
Normal file
28
Assets/New Noise Settings.asset
Normal file
@ -0,0 +1,28 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1b3bd3e5b3a04174d8df40dd407cf948, type: 3}
|
||||
m_Name: New Noise Settings
|
||||
m_EditorClassIdentifier:
|
||||
transformSettings:
|
||||
translation: {x: 0, y: 0, z: 0}
|
||||
scale: {x: 5, y: 5, z: 5}
|
||||
rotation: {x: 0, y: 0, z: 0}
|
||||
flipScaleX: 0
|
||||
flipScaleY: 0
|
||||
flipScaleZ: 0
|
||||
domainSettings:
|
||||
noiseTypeName: Perlin
|
||||
fractalTypeName: Fbm
|
||||
noiseTypeParams:
|
||||
fractalTypeParams: '{"warpOffsets":{"x":2.5,"y":1.399999976158142,"z":3.200000047683716,"w":2.700000047683716},"octavesMinMax":{"x":0.0,"y":16.0},"amplitudeMinMax":{"x":0.0,"y":1.0},"frequencyMinMax":{"x":0.0,"y":2.0},"lacunarityMinMax":{"x":0.0,"y":4.0},"persistenceMinMax":{"x":0.0,"y":1.0},"warpIterationsMinMax":{"x":0.0,"y":8.0},"warpStrengthMinMax":{"x":-2.0,"y":2.0},"octaves":8.0,"amplitude":0.5,"frequency":1.0,"persistence":0.5,"lacunarity":2.0,"warpIterations":1.0,"warpStrength":0.5,"warpEnabled":false,"warpExpanded":true}'
|
||||
useTextureForPositions: 0
|
||||
positionTexture: {fileID: 0}
|
8
Assets/New Noise Settings.asset.meta
Normal file
8
Assets/New Noise Settings.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e546fe0c09665745b765254ebd43e0b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1789,6 +1789,100 @@ Transform:
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 103117886}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &106699460
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 106699461}
|
||||
- component: {fileID: 106699464}
|
||||
- component: {fileID: 106699463}
|
||||
- component: {fileID: 106699462}
|
||||
m_Layer: 0
|
||||
m_Name: Storage Lid
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &106699461
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 106699460}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.4969, z: -0.2241}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 234294810}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!64 &106699462
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 106699460}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 4300000, guid: 0e821fe9c748a3845a35720d67512bae, type: 3}
|
||||
--- !u!23 &106699463
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 106699460}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 28af8aa4e6bad69439ee2d4d6d11939a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &106699464
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 106699460}
|
||||
m_Mesh: {fileID: 4300000, guid: 0e821fe9c748a3845a35720d67512bae, type: 3}
|
||||
--- !u!1001 &119691890
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5171,6 +5265,119 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 421f12c4cc2c4614f9e0616ef942cf44, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &234294805
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 234294810}
|
||||
- component: {fileID: 234294809}
|
||||
- component: {fileID: 234294808}
|
||||
- component: {fileID: 234294807}
|
||||
- component: {fileID: 234294806}
|
||||
m_Layer: 0
|
||||
m_Name: Tool Box Loot Container
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &234294806
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 234294805}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: db29f8627ad31904eab8cda9ef97002b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
hasBeenLooted: 0
|
||||
itemsHaveBeenInstantiated: 0
|
||||
itemsHaveBeenHidden: 0
|
||||
itemUIs: []
|
||||
data: {fileID: 11400000, guid: 22d3a241f9db00542aff64217d77dd36, type: 2}
|
||||
--- !u!64 &234294807
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 234294805}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 4300000, guid: af5d601c2bda3144eb435e3fef7a65e1, type: 3}
|
||||
--- !u!23 &234294808
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 234294805}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 28af8aa4e6bad69439ee2d4d6d11939a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &234294809
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 234294805}
|
||||
m_Mesh: {fileID: 4300000, guid: af5d601c2bda3144eb435e3fef7a65e1, type: 3}
|
||||
--- !u!4 &234294810
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 234294805}
|
||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 10.9, y: 0.015, z: -23.238}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 106699461}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 17
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
|
||||
--- !u!54 &236675544
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -56468,12 +56675,12 @@ PrefabInstance:
|
||||
- target: {fileID: 2770326604978625765, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: -0.00012207031
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2770326604978625765, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -0.00048828125
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2770326605030914168, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
@ -56984,12 +57191,12 @@ PrefabInstance:
|
||||
- target: {fileID: 2770326606141421692, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0.00048828125
|
||||
value: -0.00048828125
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2770326606141421692, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -0.00024414062
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2770326606150301029, guid: 9f005685dc17f4643b4a1156970fe2f6,
|
||||
type: 3}
|
||||
|
Loading…
Reference in New Issue
Block a user