Added fruit spawner

This commit is contained in:
2026-03-30 11:01:45 +01:00
parent b3202a4636
commit c2455dba60
9 changed files with 512 additions and 11 deletions

View File

@@ -0,0 +1,24 @@
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;
[UsedImplicitly, InspectorCallable("Spawn Fruit")]
private void SpawnFruit()
{
GameObject go = Instantiate(FruitPrefab, FruitSpawnParent);
Rigidbody2D rb = go.GetComponent<Rigidbody2D>();
Debug.Assert(rb != null, "Could not find Rigidbody2D component on FruitSpawner.");
rb.velocity = Random.insideUnitCircle * 2.5f;
}
}
}