feat: spawning particles with object pooling
This commit is contained in:
parent
858e49e1d9
commit
efac0019ba
14 changed files with 235 additions and 21 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Pooling;
|
||||
using Presenter;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
@ -9,9 +10,13 @@ namespace View.Scene {
|
|||
[SerializeField] private Transform growParticlePositions;
|
||||
[SerializeField, Range(0, 180)] private float angleRange;
|
||||
|
||||
private void Awake() {
|
||||
growParticle.CreatePool();
|
||||
}
|
||||
|
||||
public void OnInputReceived() {
|
||||
float randomRotation = Random.Range(-angleRange / 2f, angleRange / 2f);
|
||||
Instantiate(growParticle, growParticlePositions.position, Quaternion.Euler(0f, 0f, randomRotation));
|
||||
growParticle.Spawn(growParticlePositions.position, Quaternion.Euler(0, 0, randomRotation));
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue