Roses/Assets/Scripts/View/Dependencies.cs
2024-04-21 23:31:28 +02:00

43 lines
No EOL
1.3 KiB
C#

using System;
using Domain;
using Presenter;
using Presenter.SaveSystem;
using UnityEngine;
using View.Collections;
using View.Scene;
using View.UI;
namespace View {
public class Dependencies : MonoBehaviour {
public ExpressionClick ExpressionClick { private set; get; }
public Score Score { private set; get; }
public CustomInput CustomInput { private set; get; }
public SaveGame Saver { private set; get; }
public LoadGame Loader { private set; get; }
public SpawnRose Spawner { private set; get; }
private void Awake() {
Score = new Score(10, 10);
IScoreView input = FindObjectOfType<ScoreView>();
IRoseSpawner spawner = FindObjectOfType<RoseSpawner>();
IInputCallback visibility = FindObjectOfType<UIVisibility>();
IInputCallback growParticles = FindObjectOfType<GrowParticlesSpawner>();
IInputCallback inputCallback = new InputCallbackCollection(new[] { visibility, growParticles });
IRoseGrow growAnimation = FindObjectOfType<GrowAnimation>();
ExpressionClick = new ExpressionClick(Score, input, growAnimation, inputCallback);
Spawner = new SpawnRose(Score, spawner);
CustomInput = new CustomInput();
PlayerPrefsRepository repository = new();
Saver = new SaveGame(repository, Score);
Loader = new LoadGame(repository, Score, input, spawner, growAnimation);
}
}
}