Kitchen object creation and spawning
This commit is contained in:
parent
989648c00b
commit
1729ddf5c6
22 changed files with 462 additions and 3 deletions
|
@ -3,9 +3,18 @@ using UnityEngine;
|
|||
public class ClearCounter : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private KitchenObjectSO kitchenObjectSO;
|
||||
[SerializeField] private Transform counterTopPoint;
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
Debug.Log("Interacted!");
|
||||
|
||||
Transform kitchenObjectTransform = Instantiate(kitchenObjectSO.prefab, counterTopPoint);
|
||||
|
||||
kitchenObjectTransform.localPosition = Vector3.zero;
|
||||
|
||||
Debug.Log(kitchenObjectTransform.GetComponent<KitchenObject>().GetKitchenObjectSO().objectName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
12
Assets/Scripts/KitchenObject.cs
Normal file
12
Assets/Scripts/KitchenObject.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class KitchenObject : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private KitchenObjectSO kitchenObjectSO;
|
||||
|
||||
public KitchenObjectSO GetKitchenObjectSO() { return kitchenObjectSO; }
|
||||
|
||||
}
|
11
Assets/Scripts/KitchenObject.cs.meta
Normal file
11
Assets/Scripts/KitchenObject.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9f604455b7aeb5f4790263b920c04313
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
13
Assets/Scripts/KitchenObjectSO.cs
Normal file
13
Assets/Scripts/KitchenObjectSO.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu()]
|
||||
public class KitchenObjectSO : ScriptableObject
|
||||
{
|
||||
|
||||
public Transform prefab;
|
||||
public Sprite sprite;
|
||||
public string objectName;
|
||||
|
||||
}
|
11
Assets/Scripts/KitchenObjectSO.cs.meta
Normal file
11
Assets/Scripts/KitchenObjectSO.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28f8f75e2d4dcd44a882af312f45cc94
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -81,12 +81,12 @@ public class Player : MonoBehaviour
|
|||
SetSelectedCounter(clearCounter);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (selectedCounter != null)
|
||||
{
|
||||
SetSelectedCounter(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (selectedCounter != null)
|
||||
{
|
||||
SetSelectedCounter(null);
|
||||
}
|
||||
|
|
Reference in a new issue