mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:37:40 +02:00
Added the girl to Wizard's Waltz
This commit is contained in:
36
Assets/Scripts/Games/WizardsWaltz/Girl.cs
Normal file
36
Assets/Scripts/Games/WizardsWaltz/Girl.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
{
|
||||
public class Girl : MonoBehaviour
|
||||
{
|
||||
|
||||
public Animator animator;
|
||||
|
||||
public GameObject[] flowers;
|
||||
private int flowerCount = 0;
|
||||
|
||||
public void Happy()
|
||||
{
|
||||
animator.Play("Happy", 0, 0);
|
||||
SetFlowers(1);
|
||||
}
|
||||
|
||||
public void Sad()
|
||||
{
|
||||
animator.Play("Sad", 0, 0);
|
||||
SetFlowers(-1);
|
||||
}
|
||||
|
||||
public void SetFlowers(int add = 0)
|
||||
{
|
||||
flowerCount = Mathf.Clamp(flowerCount + add, 0, flowers.Length);
|
||||
for (int i = 0; i < flowers.Length; i++)
|
||||
{
|
||||
flowers[i].SetActive(i < flowerCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/WizardsWaltz/Girl.cs.meta
Normal file
11
Assets/Scripts/Games/WizardsWaltz/Girl.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e25ab9ffcdb4c945ace0b7c8db5bd9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -8,6 +8,7 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
public class Plant : PlayerActionObject
|
||||
{
|
||||
public Animator animator;
|
||||
public SpriteRenderer spriteRenderer;
|
||||
public float createBeat;
|
||||
|
||||
private WizardsWaltz game;
|
||||
@ -21,6 +22,7 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
|
||||
private void Start()
|
||||
{
|
||||
spriteRenderer.sortingOrder = (int)Math.Round((transform.position.z - 2) * 1000);
|
||||
animator.Play("Appear", 0, 0);
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
songPos = Conductor.instance.songPositionInBeats;
|
||||
var am = game.beatInterval / 2f;
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.25f;
|
||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * 2f;
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
|
||||
transform.position = new Vector3(x, 2 + y, -scale);
|
||||
shadow.transform.position = new Vector3(x, -2.5f + y, -scale + 0.1f);
|
||||
transform.position = new Vector3(x, 1f + y, scale * 2);
|
||||
shadow.transform.position = new Vector3(x, -3.5f + y, scale * 2 + 0.1f);
|
||||
|
||||
var xscale = scale;
|
||||
if (y > 0) xscale *= -1;
|
||||
@ -56,11 +56,13 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
{
|
||||
Jukebox.PlayOneShotGame("wizardsWaltz/grow");
|
||||
plant.Bloom();
|
||||
game.girl.Happy();
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("miss");
|
||||
plant.Eat();
|
||||
game.girl.Sad();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
{
|
||||
[Header("References")]
|
||||
public Wizard wizard;
|
||||
public Girl girl;
|
||||
public GameObject plantHolder;
|
||||
public GameObject plantBase;
|
||||
|
||||
@ -62,12 +63,12 @@ namespace RhythmHeavenMania.Games.WizardsWaltz
|
||||
var songPos = Conductor.instance.songPositionInBeats;
|
||||
var am = (beatInterval / 2f);
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||
var y = -2.5f + Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.25f;
|
||||
var y = -3.5f + Mathf.Cos(Mathf.PI * songPos / am) * 2f;
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
var xscale = scale;
|
||||
if (y > -2.5f) xscale *= -1;
|
||||
if (y > -3.5f) xscale *= -1;
|
||||
|
||||
plant.transform.localPosition = new Vector3(x, y, -scale);
|
||||
plant.transform.localPosition = new Vector3(x, y, scale * 2);
|
||||
plant.transform.localScale = new Vector3(xscale, scale, 1);
|
||||
|
||||
plant.gameObject.SetActive(true);
|
||||
|
Reference in New Issue
Block a user