Add basic broken frying logic
This commit is contained in:
parent
44d3bb1a03
commit
ef0155632a
7 changed files with 230 additions and 16 deletions
2
.erp
2
.erp
|
@ -5,7 +5,7 @@
|
|||
<resetOnSceneChange>false</resetOnSceneChange>
|
||||
<debugMode>false</debugMode>
|
||||
<EditorClosed>true</EditorClosed>
|
||||
<LastTimestamp>1677687834</LastTimestamp>
|
||||
<LastTimestamp>1677690484</LastTimestamp>
|
||||
<LastSessionID>23669525547325516</LastSessionID>
|
||||
<Errored>false</Errored>
|
||||
</ERPSettings>
|
|
@ -94,14 +94,46 @@ PrefabInstance:
|
|||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 9076728630823268195}
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 6869097019740516189, guid: 509501a557d1d0a45817fb7332917dd5,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 5065327384487018965}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 509501a557d1d0a45817fb7332917dd5, type: 3}
|
||||
--- !u!4 &976370877519106100 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 1024188629140685204, guid: 509501a557d1d0a45817fb7332917dd5,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 268634890214101408}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &6616006834372177299 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 6371086230447438899, guid: 509501a557d1d0a45817fb7332917dd5,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 268634890214101408}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &6695037738886840061 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6869097019740516189, guid: 509501a557d1d0a45817fb7332917dd5,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 268634890214101408}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &5065327384487018965
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6695037738886840061}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 97b430ad528743b4c820a9ec73b4ae32, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
counterTopPoint: {fileID: 976370877519106100}
|
||||
fryingRecipeSOArray:
|
||||
- {fileID: 11400000, guid: 3d422b39fbddcbd47bae458238f9c627, type: 2}
|
||||
- {fileID: 11400000, guid: ab68452688ff0fc4eb1439a3f3f5eca4, type: 2}
|
||||
--- !u!1001 &4775776715932421064
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -199,6 +231,11 @@ PrefabInstance:
|
|||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 1a0afd856a35421469b28b916116fd9c, type: 2}
|
||||
- target: {fileID: 4386361873462607087, guid: 93af8b85a17635f40a5b76ed82a86c18,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4589716710238282922, guid: 93af8b85a17635f40a5b76ed82a86c18,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
|
@ -279,6 +316,16 @@ PrefabInstance:
|
|||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4998458208842551057, guid: 93af8b85a17635f40a5b76ed82a86c18,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6918696954688420558, guid: 93af8b85a17635f40a5b76ed82a86c18,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8864449973679823643, guid: 93af8b85a17635f40a5b76ed82a86c18,
|
||||
type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
|
@ -335,7 +382,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 6b8e4c74ab1ad4b4a8c3676f33904e52, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
baseCounter: {fileID: 0}
|
||||
baseCounter: {fileID: 5065327384487018965}
|
||||
visualGameObjectArray:
|
||||
- {fileID: 703760627113338248}
|
||||
- {fileID: 8089917589884704374}
|
||||
|
|
|
@ -667,8 +667,81 @@ Transform:
|
|||
- {fileID: 78671169}
|
||||
- {fileID: 1617745536}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 10
|
||||
m_RootOrder: 11
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &370799796
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 3.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.0028347075
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0.999996
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: -180.325
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6616006834372177299, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6695037738886840061, guid: ae14b9e7a32963047a859cc7ab07f505,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: StoveCounter
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ae14b9e7a32963047a859cc7ab07f505, type: 3}
|
||||
--- !u!1 &392963849
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -735,7 +808,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 9
|
||||
m_RootOrder: 10
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &408182761
|
||||
GameObject:
|
||||
|
@ -861,7 +934,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!114 &410087042
|
||||
MonoBehaviour:
|
||||
|
@ -1132,7 +1205,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 7
|
||||
m_RootOrder: 8
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &763156967
|
||||
PrefabInstance:
|
||||
|
@ -1327,7 +1400,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &974939165
|
||||
GameObject:
|
||||
|
@ -1361,7 +1434,7 @@ Transform:
|
|||
- {fileID: 1139635725}
|
||||
- {fileID: 408182762}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 7
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &974939167
|
||||
MonoBehaviour:
|
||||
|
@ -1786,7 +1859,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1329055550
|
||||
PrefabInstance:
|
||||
|
@ -2271,7 +2344,7 @@ RectTransform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 8
|
||||
m_RootOrder: 9
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
|
@ -2379,7 +2452,7 @@ PrefabInstance:
|
|||
- target: {fileID: 6853301306222527979, guid: dcc374f2f4a690540874e0afc4c73531,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6853301306222527979, guid: dcc374f2f4a690540874e0afc4c73531,
|
||||
type: 3}
|
||||
|
@ -2658,5 +2731,5 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 691696597}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 46, y: 0, z: 0}
|
||||
|
|
|
@ -14,4 +14,4 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
input: {fileID: 11400000, guid: cf77ec56d13b4c7478384a548ab18277, type: 2}
|
||||
output: {fileID: 11400000, guid: 42754f770e37e78488140348e6a9f9c3, type: 2}
|
||||
fryingTimerMax: 0
|
||||
fryingTimerMax: 3
|
||||
|
|
|
@ -14,4 +14,4 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
input: {fileID: 11400000, guid: d672e8baad811004281dd021411b0a80, type: 2}
|
||||
output: {fileID: 11400000, guid: cf77ec56d13b4c7478384a548ab18277, type: 2}
|
||||
fryingTimerMax: 0
|
||||
fryingTimerMax: 3
|
||||
|
|
|
@ -16,7 +16,8 @@ public class BaseCounter : MonoBehaviour, IKitchenObjectParent
|
|||
|
||||
public virtual void InteractAlternate(Player player)
|
||||
{
|
||||
Debug.LogError("BaseCounter.InteractAlterante();");
|
||||
// Debug.LogError("BaseCounter.InteractAlterante();");
|
||||
// Don't do anything, not all Counters need alt interact actions.
|
||||
}
|
||||
|
||||
public Transform GetKitchenObjectFollowTransform()
|
||||
|
|
|
@ -1,8 +1,101 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using static CuttingCounter;
|
||||
|
||||
public class StoveCounter : BaseCounter
|
||||
{
|
||||
|
||||
[SerializeField] private FryingRecipeSO[] fryingRecipeSOArray;
|
||||
|
||||
private float fryingTimer;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (HasKitchenObject())
|
||||
{
|
||||
fryingTimer += Time.deltaTime;
|
||||
FryingRecipeSO fryingRecipeSO = GetFryingRecipeSOWithInput(GetKitchenObject().GetKitchenObjectSO());
|
||||
if (fryingTimer > fryingRecipeSO.fryingTimerMax)
|
||||
{
|
||||
// Fried
|
||||
fryingTimer = 0f;
|
||||
Debug.Log("Fried!");
|
||||
GetKitchenObject().DestroySelf();
|
||||
|
||||
KitchenObject.SpawnKitchenObject(fryingRecipeSO.output, this);
|
||||
|
||||
}
|
||||
Debug.Log(fryingTimer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
if (!HasKitchenObject())
|
||||
{
|
||||
// no KitchenObject here
|
||||
if (player.HasKitchenObject())
|
||||
{
|
||||
// player has object
|
||||
if (HasRecipeWithInput(player.GetKitchenObject().GetKitchenObjectSO()))
|
||||
{
|
||||
// player is carrying an object that can be Fried
|
||||
player.GetKitchenObject().SetKitchenObjectParent(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// player has nothing, do nothing
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// KitchenObject is here
|
||||
if (player.HasKitchenObject())
|
||||
{
|
||||
// player has object, do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
// player has nothing
|
||||
GetKitchenObject().SetKitchenObjectParent(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool HasRecipeWithInput(KitchenObjectSO inputKitchenObjectSO)
|
||||
{
|
||||
FryingRecipeSO fryingRecipeSO = GetFryingRecipeSOWithInput(inputKitchenObjectSO);
|
||||
return fryingRecipeSO != null;
|
||||
}
|
||||
|
||||
private KitchenObjectSO GetOutputForInput(KitchenObjectSO inputKitchenObjectSO)
|
||||
{
|
||||
FryingRecipeSO fryingRecipeSO = GetFryingRecipeSOWithInput(inputKitchenObjectSO);
|
||||
if (fryingRecipeSO != null)
|
||||
{
|
||||
return fryingRecipeSO.output;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private FryingRecipeSO GetFryingRecipeSOWithInput(KitchenObjectSO inputKitchenObjectSO)
|
||||
{
|
||||
foreach (FryingRecipeSO fryingRecipeSO in fryingRecipeSOArray)
|
||||
{
|
||||
if (fryingRecipeSO.input == inputKitchenObjectSO)
|
||||
{
|
||||
return fryingRecipeSO;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue