Commit 779af276 authored by Gerard Gascón's avatar Gerard Gascón
Browse files

refactor: moved grow animation to its own class

parent 150b602d
Loading
Loading
Loading
Loading
+30 −17
Original line number Diff line number Diff line
@@ -562,23 +562,6 @@ MonoBehaviour:
  m_Name: 
  m_EditorClassIdentifier: 
  text: {fileID: 379057222}
  animator: {fileID: 902566664}
  growAnimation: {fileID: 11400000, guid: 7f3b3c6fe0a532348bade08980464924, type: 2}
  endAnimation: {fileID: 11400000, guid: 8bca0def51335744994817560a43be74, type: 2}
  growEvent:
    Guid:
      Data1: 0
      Data2: 0
      Data3: 0
      Data4: 0
    Path: 
  gloomEvent:
    Guid:
      Data1: 0
      Data2: 0
      Data3: 0
      Data4: 0
    Path: 
--- !u!225 &311490074
CanvasGroup:
  m_ObjectHideFlags: 0
@@ -1402,6 +1385,7 @@ GameObject:
  - component: {fileID: 902566663}
  - component: {fileID: 902566662}
  - component: {fileID: 902566664}
  - component: {fileID: 902566665}
  m_Layer: 0
  m_Name: Rosa_Grow_0100
  m_TagString: Untagged
@@ -1490,6 +1474,35 @@ MonoBehaviour:
  m_Name: 
  m_EditorClassIdentifier: 
  animation: {fileID: 11400000, guid: 7f3b3c6fe0a532348bade08980464924, type: 2}
--- !u!114 &902566665
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 902566661}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: a0d2d820274a46d68d83fd6ddef1c431, type: 3}
  m_Name: 
  m_EditorClassIdentifier: 
  animator: {fileID: 902566664}
  growAnimation: {fileID: 11400000, guid: 7f3b3c6fe0a532348bade08980464924, type: 2}
  endAnimation: {fileID: 11400000, guid: 8bca0def51335744994817560a43be74, type: 2}
  growEvent:
    Guid:
      Data1: -213766361
      Data2: 1214886339
      Data3: 1256039087
      Data4: -834483166
    Path: event:/SFX_grow
  gloomEvent:
    Guid:
      Data1: -2064803398
      Data2: 1237488133
      Data3: 1635234491
      Data4: 1937340427
    Path: event:/SFX_gloom
--- !u!1 &921683578
GameObject:
  m_ObjectHideFlags: 0
+5 −5
Original line number Diff line number Diff line
@@ -5,28 +5,28 @@ namespace Presenter {
		private readonly Score _score;
		private readonly IExpressionInput _view;
		private readonly IRoseGrow _grow;
		private readonly IInputCallback _onInputReceived;
		private readonly IRoseSpawner _spawner;

		private bool CanSpawn => _score.Value % (_score.GrowIterations * _score.SpawnRate) == 0;

		public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner, IRoseGrow grow) {
		public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner, IRoseGrow grow, IInputCallback inputCallback) {
			_score = score;
			_view = view;
			_spawner = spawner;
			_grow = grow;
			_onInputReceived = inputCallback;
		}

		public void Execute() {
			_score.Add();
			_view.UpdateView(_score.Value, _score.GrowPercentage);
			_grow.Grow();

			_onInputReceived.OnInputReceived();

			if (CanSpawn)
				_spawner.SpawnRose();
			else if (_score.Value % _score.GrowIterations == 0)
			if (_score.Value % _score.GrowIterations == 0)
				_grow.GrowStep();
		}

	}
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
namespace Presenter {
	public interface IInputCallback {
		void OnInputReceived();
	}
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: 4b8d0f034669436ca57e685c00414e3f
timeCreated: 1713517680
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
namespace Presenter {
	public interface IRoseGrow {
		void Grow();
		void GrowStep();
	}
}
 No newline at end of file
Loading