feat: Roses spawn
This commit is contained in:
parent
ff2d68ed07
commit
f8a29f1501
206 changed files with 12637 additions and 19 deletions
|
@ -11,13 +11,15 @@ namespace View {
|
|||
public CustomInput CustomInput { private set; get; }
|
||||
|
||||
private void Awake() {
|
||||
Model = new Model(0);
|
||||
Model = new Model(20);
|
||||
|
||||
IExpressionInput input = FindObjectOfType<ExpressionInput>();
|
||||
IExpressionInput visibility = FindObjectOfType<UIVisibility>();
|
||||
IExpressionInput inputCollections = new ExpressionInputCollection(new[] { input, visibility });
|
||||
|
||||
ExpressionClick = new ExpressionClick(Model, inputCollections);
|
||||
IRoseSpawner spawner = FindObjectOfType<RoseSpawner>();
|
||||
|
||||
ExpressionClick = new ExpressionClick(Model, inputCollections, spawner);
|
||||
|
||||
CustomInput = new CustomInput();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
using System;
|
||||
using Presenter;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace View {
|
||||
public class RoseSpawner : MonoBehaviour {
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue