Commit bd0670f2 authored by Sebastian's avatar Sebastian

fixed bug with glasses in container

parent dfffa96b
......@@ -14,9 +14,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
prefab: {fileID: 3294543616357163931, guid: 30566b76f8b6e2446a0ff9cc797b2b88, type: 3}
audio: {fileID: 0}
allowedIntregients:
- {fileID: 11400000, guid: 49a683ec882e87043b0005cab45e9c44, type: 2}
- {fileID: 11400000, guid: 7eaa53c05a305914e8c533c99ca2093f, type: 2}
- {fileID: 11400000, guid: 25e2eb1e21c808549acbb6642b6048da, type: 2}
closedPrefab: {fileID: 9036522971056616119, guid: f44b94833fafd764fb110433ec798732,
type: 3}
emptyPrefab: {fileID: 3907786484169334233, guid: e0c4d1513ad5ed140afa45f3e14f631b,
type: 3}
isOpen: 0
isEmpty: 0
isOpen: 1
isEmpty: 1
......@@ -14,9 +14,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
prefab: {fileID: 3294543616357163931, guid: 30566b76f8b6e2446a0ff9cc797b2b88, type: 3}
audio: {fileID: 0}
allowedIntregients:
- {fileID: 11400000, guid: 49a683ec882e87043b0005cab45e9c44, type: 2}
- {fileID: 11400000, guid: 7eaa53c05a305914e8c533c99ca2093f, type: 2}
- {fileID: 11400000, guid: 25e2eb1e21c808549acbb6642b6048da, type: 2}
closedPrefab: {fileID: 9036522971056616119, guid: f44b94833fafd764fb110433ec798732,
type: 3}
emptyPrefab: {fileID: 3907786484169334233, guid: e0c4d1513ad5ed140afa45f3e14f631b,
type: 3}
isOpen: 0
isEmpty: 0
isOpen: 1
isEmpty: 1
......@@ -56,7 +56,8 @@ namespace Scripts.Brewing
return true;
}
if (_currentCarriable is ContainerType && carriable is IngredientType)
if (_currentCarriable is ContainerType && carriable is IngredientType &&
((ContainerType) _currentCarriable).CheckAllowedIngredients((IngredientType) carriable))
{
if (_container.AddIngredient((IngredientType) carriable))
{
......@@ -121,7 +122,8 @@ namespace Scripts.Brewing
if (_currentCarriable is ContainerType)
{
GameObject newObject = Instantiate(((ContainerType) _currentCarriable).GetPrefab(), _itemSpawn.transform.position,
GameObject newObject = Instantiate(((ContainerType) _currentCarriable).GetPrefab(),
_itemSpawn.transform.position,
_itemSpawn.transform.rotation);
newObject.transform.parent = _itemSpawn.transform;
}
......@@ -131,7 +133,6 @@ namespace Scripts.Brewing
_itemSpawn.transform.rotation);
newObject.transform.parent = _itemSpawn.transform;
}
}
}
}
using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
namespace Scripts.Brewing.ItemTypes
{
[CreateAssetMenu(fileName = "New ContainerType", menuName = "OverBrewed/Brewing/ContainerType", order = 6)]
public class ContainerType : Carriable
{
[SerializeField] private List<IngredientType> allowedIntregients;
[SerializeField] private GameObject closedPrefab;
[SerializeField] private GameObject emptyPrefab;
......@@ -17,5 +20,10 @@ namespace Scripts.Brewing.ItemTypes
{
return isOpen ? isEmpty ? emptyPrefab : prefab : closedPrefab;
}
public bool CheckAllowedIngredients(IngredientType ingredient)
{
return allowedIntregients.Contains(ingredient);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment