浏览代码

Add control over cooking when near pot

/main
uChema 4 年前
当前提交
bbcf3752
共有 4 个文件被更改,包括 59 次插入77 次删除
  1. 82
      UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab
  2. 33
      UOP1_Project/Assets/Scenes/Gameplay.unity
  3. 19
      UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs
  4. 2
      UOP1_Project/Assets/Scripts/UI/UIManager.cs

82
UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab


m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_SizeDelta: {x: -17, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &677869994
CanvasRenderer:

m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}

m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 15}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1980477770
MonoBehaviour:

SelectItemEvent: {fileID: 11400000, guid: 7d61f180d1f834f2ba553208130de3c2, type: 2}
ActionButtonClicked: {fileID: 11400000, guid: 9c96a79e2ffe84add980e399abf85618,
type: 2}
OnInteractionEndedEvent: {fileID: 11400000, guid: c499d87f35465124f8fb2751b150430d,
type: 2}
--- !u!1001 &26049570273333792
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c, type: 3}
--- !u!224 &5127849719113406291 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 26049570273333792}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7584548206858770602 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7574264689645128330, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,

m_Script: {fileID: 11500000, guid: 93dbe2b925cf041d1bab6ad1cc9ef1c0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &5127849719113406291 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 26049570273333792}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1135095444294628428
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5871d3b5d4307434e9d7011de3208d9b, type: 3}
--- !u!224 &6041243878473060154 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8641244786037450274, guid: 5871d3b5d4307434e9d7011de3208d9b,
type: 3}
m_PrefabInstance: {fileID: 2611262141660309784}
m_PrefabAsset: {fileID: 0}
--- !u!114 &31031661233432215 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2617486611881742223, guid: 5871d3b5d4307434e9d7011de3208d9b,

m_Script: {fileID: 11500000, guid: 5b02f588ec7814c3895df91b3ba439a5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &6041243878473060154 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8641244786037450274, guid: 5871d3b5d4307434e9d7011de3208d9b,
type: 3}
m_PrefabInstance: {fileID: 2611262141660309784}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &4927264552654137991
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c, type: 3}
--- !u!224 &221919747404738548 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 4927264552654137991}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3277521686480019469 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7574264689645128330, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,

m_Script: {fileID: 11500000, guid: 93dbe2b925cf041d1bab6ad1cc9ef1c0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &221919747404738548 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 4927264552654137991}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5787777448482401271
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c, type: 3}
--- !u!224 &4288636597873103797 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 9002994275147945670}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1579705794856000588 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7574264689645128330, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,

m_Script: {fileID: 11500000, guid: 93dbe2b925cf041d1bab6ad1cc9ef1c0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &4288636597873103797 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 9002994275147945670}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &9125883717371129678
PrefabInstance:
m_ObjectHideFlags: 0

m_RemovedComponents:
- {fileID: 5074195970675175550, guid: b01383ebcda1049008a325f2ca7e6aca, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: b01383ebcda1049008a325f2ca7e6aca, type: 3}
--- !u!114 &5854709384753378033 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3451373362961513096, guid: b01383ebcda1049008a325f2ca7e6aca,
--- !u!224 &8947289629807390876 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 184241180236232933, guid: b01383ebcda1049008a325f2ca7e6aca,
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 56eb0353ae6e5124bb35b17aff880f16, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1575787593498220194 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7745052901829238491, guid: b01383ebcda1049008a325f2ca7e6aca,

m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &8947289629807390876 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 184241180236232933, guid: b01383ebcda1049008a325f2ca7e6aca,
--- !u!114 &5854709384753378033 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3451373362961513096, guid: b01383ebcda1049008a325f2ca7e6aca,
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 56eb0353ae6e5124bb35b17aff880f16, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &9125883717816827348
PrefabInstance:
m_ObjectHideFlags: 0

33
UOP1_Project/Assets/Scenes/Gameplay.unity


m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0

m_Modification:
m_TransformParent: {fileID: 1869732381}
m_Modifications:
- target: {fileID: 677869991, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 677869991, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 677869991, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1771757300, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1771757300, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1980477769, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9125883718042355530, guid: 42ed5ae1f90714c4488cfabda2298591,
type: 3}
propertyPath: m_LocalPosition.x

type: 3}
propertyPath: m_Name
value: InventoryScreen
objectReference: {fileID: 0}
- target: {fileID: 9125883718042355531, guid: 42ed5ae1f90714c4488cfabda2298591,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 42ed5ae1f90714c4488cfabda2298591, type: 3}

19
UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs


public VoidEventChannelSO ActionButtonClicked;
public VoidEventChannelSO OnInteractionEndedEvent;
private void OnEnable()
{
//Check if the event exists to avoid errors

if (SelectItemEvent != null)
{
SelectItemEvent.OnEventRaised += InspectItem;
}
if (OnInteractionEndedEvent != null)
{
OnInteractionEndedEvent.OnEventRaised += InteractionEnded;
}
}

public void FillInventory(TabType _selectedTabType = TabType.none)
bool isNearPot = false;
public void FillInventory(TabType _selectedTabType = TabType.none, bool _isNearPot = false)
isNearPot = _isNearPot;
if ((_selectedTabType != TabType.none) && (tabTypesList.Exists(o => o.TabType == _selectedTabType)))
{

}
}
public void InteractionEnded() {
isNearPot = false;
}
void FillTypeTabs(List<InventoryTabType> typesList, InventoryTabType selectedType)
{

bool isInteractable = true;
if (itemToInspect.ItemType.ActionType == ItemInventoryActionType.cook)
{
isInteractable = currentInventory.hasIngredients(itemToInspect.IngredientsList);
isInteractable = currentInventory.hasIngredients(itemToInspect.IngredientsList) && isNearPot
;
}
else if (itemToInspect.ItemType.ActionType == ItemInventoryActionType.doNothing)

2
UOP1_Project/Assets/Scripts/UI/UIManager.cs


if (isForCooking)
{
inventoryPanel.FillInventory(TabType.recipe);
inventoryPanel.FillInventory(TabType.recipe, true);
}
else

正在加载...
取消
保存