28 lines
813 B
C#
28 lines
813 B
C#
using PashaBibko.Pacore.Attributes;
|
|
using JetBrains.Annotations;
|
|
using UnityEngine;
|
|
|
|
namespace Fruitomation
|
|
{
|
|
public class FruitSpawner : MonoBehaviour
|
|
{
|
|
[Header("References")]
|
|
[SerializeField] private Transform FruitSpawnParent;
|
|
[SerializeField] private GameObject FruitPrefab;
|
|
[SerializeField] private Canvas GameCanvas;
|
|
|
|
[UsedImplicitly, InspectorCallable("Spawn Fruit")]
|
|
private void SpawnFruit()
|
|
{
|
|
GameObject go = Instantiate(FruitPrefab, FruitSpawnParent);
|
|
FruitBehaviour behaviour = go.GetComponent<FruitBehaviour>();
|
|
Debug.Assert(behaviour != null, "Could not find FruitBehaviour");
|
|
|
|
behaviour.InitFruitBehaviour
|
|
(
|
|
GameCanvas, this
|
|
);
|
|
}
|
|
}
|
|
}
|