feat: new rose spawn animation
This commit is contained in:
parent
b3996c6831
commit
1580910ec1
113 changed files with 6558 additions and 23 deletions
|
@ -16,6 +16,8 @@ namespace View {
|
|||
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);
|
||||
|
||||
|
@ -28,7 +30,8 @@ namespace View {
|
|||
IInputCallback inputCallback = new InputCallbackCollection(new[] { visibility, growParticles });
|
||||
IRoseGrow growAnimation = FindObjectOfType<GrowAnimation>();
|
||||
|
||||
ExpressionClick = new ExpressionClick(Score, input, spawner, growAnimation, inputCallback);
|
||||
ExpressionClick = new ExpressionClick(Score, input, growAnimation, inputCallback);
|
||||
Spawner = new SpawnRose(Score, spawner);
|
||||
|
||||
CustomInput = new CustomInput();
|
||||
|
||||
|
|
|
@ -1,18 +1,31 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Animation = FramedAnimator.Animation;
|
||||
using Animator = FramedAnimator.Animator;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace View.Scene {
|
||||
public class GardenFlower : MonoBehaviour {
|
||||
[SerializeField] private SpriteRenderer sprite;
|
||||
|
||||
[SerializeField] private Sprite[] randomSprites;
|
||||
[SerializeField] private Animation[] randomAnimation;
|
||||
[SerializeField] private Animator animator;
|
||||
|
||||
private static readonly int WindOffset = Shader.PropertyToID("_WindOffset");
|
||||
|
||||
[SerializeField] private float randomRotation;
|
||||
[SerializeField] private float startRandomMaxDelay;
|
||||
|
||||
private void Awake() {
|
||||
sprite.sprite = randomSprites[Random.Range(0, randomSprites.Length)];
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, Random.Range(-randomRotation, randomRotation));
|
||||
}
|
||||
|
||||
private IEnumerator Start() {
|
||||
sprite.material.SetFloat(WindOffset, Random.Range(0f, 2f * Mathf.PI));
|
||||
animator.ChangeAnimation(randomAnimation[Random.Range(0, randomAnimation.Length)]);
|
||||
yield return new WaitForSeconds(Random.Range(0f, startRandomMaxDelay));
|
||||
animator.PlayUntil(1f);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,10 +16,12 @@ namespace View.Scene {
|
|||
[SerializeField] private EventReference gloomEvent;
|
||||
|
||||
private Score _score;
|
||||
private SpawnRose _spawnRose;
|
||||
private bool _firstUpdate = true;
|
||||
|
||||
private void Start() {
|
||||
_score = FindObjectOfType<Dependencies>().Score;
|
||||
_spawnRose = FindObjectOfType<Dependencies>().Spawner;
|
||||
|
||||
animator.OnAnimationEnd += AnimationEnded;
|
||||
}
|
||||
|
@ -33,6 +35,7 @@ namespace View.Scene {
|
|||
}
|
||||
|
||||
if (animationName == "Rosa_End") {
|
||||
_spawnRose.Execute();
|
||||
animator.ChangeAnimation(growAnimation);
|
||||
animator.PlayUntil(_score.GrowPercentage);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue