Added fruit spawner
This commit is contained in:
24
Assets/Scripts/FruitSpawner.cs
Normal file
24
Assets/Scripts/FruitSpawner.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/FruitSpawner.cs.meta
Normal file
11
Assets/Scripts/FruitSpawner.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fc36d0808cf971459d9e430faaeadd9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Fruitomation.asmdef
Normal file
16
Assets/Scripts/Fruitomation.asmdef
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Fruitomation",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:4d6a1c1727d80284f86640644e0ea451"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Scripts/Fruitomation.asmdef.meta
Normal file
7
Assets/Scripts/Fruitomation.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c657622e563023e4faa9e16d7d3be835
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user