Kitchen object creation and spawning

This commit is contained in:
BuyMyMojo 2023-02-28 05:25:39 +11:00
parent 989648c00b
commit 1729ddf5c6
22 changed files with 462 additions and 3 deletions

View file

@ -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);
}
}

View 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; }
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f604455b7aeb5f4790263b920c04313
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28f8f75e2d4dcd44a882af312f45cc94
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -81,12 +81,12 @@ public class Player : MonoBehaviour
SetSelectedCounter(clearCounter);
}
}
else
else if (selectedCounter != null)
{
SetSelectedCounter(null);
}
}
else
else if (selectedCounter != null)
{
SetSelectedCounter(null);
}