24 lines
No EOL
683 B
C#
24 lines
No EOL
683 B
C#
using System;
|
|
using Presenter;
|
|
using UnityEngine;
|
|
using Random = UnityEngine.Random;
|
|
|
|
namespace View {
|
|
public class RoseSpawner : MonoBehaviour, IRoseSpawner {
|
|
[SerializeField] private Rect spawnerRegion;
|
|
[SerializeField] private GameObject rose;
|
|
|
|
public void SpawnRose() {
|
|
Vector2 spawnPos = new(
|
|
spawnerRegion.position.x + Random.Range(-spawnerRegion.size.x / 2f, spawnerRegion.size.x / 2f),
|
|
spawnerRegion.position.y + Random.Range(-spawnerRegion.size.y / 2f, spawnerRegion.size.y / 2f)
|
|
);
|
|
|
|
Instantiate(rose, spawnPos, Quaternion.identity);
|
|
}
|
|
|
|
private void OnDrawGizmos() {
|
|
Gizmos.DrawWireCube(spawnerRegion.position, spawnerRegion.size);
|
|
}
|
|
}
|
|
} |