Space Dance and Crop Stomp visual improvements + canvasScroll (#450)

* sprites1

* papapapunch

* dancers sheet done

* crop stomp

* Particulate

* Added veggie bag and particle to crop stomp, wip though

* Space dance scrolling background has been added

* cool

* Canvas Scroll hype

* Canvas scroll implemented in space soccer

* 4k

* gramps wip

* more

* assbun conflict fixed + long hair fix

* Space dance bop modernization and fixes

* ok

* sprites done

* wait.

* fixed space dance stuff

* Made miss return to idle

* catchy tune 3

* epic

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
Rapandrasmus
2023-06-06 20:59:56 +02:00
committed by GitHub
parent c5f5b6d800
commit efa8378797
90 changed files with 9459 additions and 1392 deletions

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace HeavenStudio.Common
{
public class CanvasScroll : MonoBehaviour
{
[SerializeField] RawImage[] _imgs;
public float NormalizedX = 0.0f;
public float NormalizedY = 0.0f;
public Vector2 Normalized { get { return new Vector2(NormalizedX, NormalizedY); } set { NormalizedX = value.x; NormalizedY = value.y; } }
public float TileX = 1.0f;
public float TileY = 1.0f;
public Vector2 Tile { get { return new Vector2(TileX, TileY); } set { TileX = value.x; TileY = value.y; } }
private void Update()
{
foreach (var img in _imgs)
{
img.uvRect = new Rect(new Vector2(NormalizedX, NormalizedY) * Tile, img.uvRect.size);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a6dfb70e45ff5004cab0352936d3f10a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -32,6 +32,16 @@ namespace HeavenStudio.Games.Loaders
new Param("mute", false, "Mute", "Should the mole laugh sound be muted?")
}
},
new GameAction("plantCollect", "Veggie Collection Values")
{
function = delegate { var e = eventCaller.currentEntity; CropStomp.instance.SetCollectThresholds(e["threshold"], e["limit"]); },
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("threshold", new EntityTypes.Integer(1, 80, 8), "Threshold", "For each time the threshold is met a new plant will appear in the veggie bag."),
new Param("limit", new EntityTypes.Integer(1, 1000, 80), "Limit", "What is the limit for plants collected?")
}
}
},
new List<string>() {"ntr", "keep"},
"ntrstomp", "en",
@ -83,6 +93,8 @@ namespace HeavenStudio.Games
private Tween shakeTween;
public ParticleSystem hitParticle;
public static CropStomp instance;
private void Awake()
@ -274,6 +286,18 @@ namespace HeavenStudio.Games
isFlicking = false;
}
public void SetCollectThresholds(int thresholdEvolve, int limit)
{
farmer.plantThreshold = thresholdEvolve;
farmer.plantLimit = limit;
farmer.UpdatePlants();
}
public void CollectPlant()
{
farmer.CollectPlant();
}
private void PlayAnims()
{
// Step.

View File

@ -14,9 +14,37 @@ namespace HeavenStudio.Games.Scripts_CropStomp
PlayerActionEvent stomp;
[SerializeField] private Transform collectedHolder;
[SerializeField] private GameObject plantLeftRef;
[SerializeField] private GameObject plantRightRef;
private List<GameObject> spawnedPlants = new List<GameObject>();
[SerializeField] private float plantDistance = 0.5f;
public int plantThreshold = 8;
public int plantLimit = 80;
private static int collectedPlants = 0;
private void OnDestroy()
{
if (!Conductor.instance.isPlaying)
{
collectedPlants = 0;
UpdatePlants();
}
}
public void Init()
{
game = CropStomp.instance;
if (!Conductor.instance.isPlaying)
{
collectedPlants = 0;
}
UpdatePlants();
}
private void Update()
@ -40,6 +68,33 @@ namespace HeavenStudio.Games.Scripts_CropStomp
}
}
public void CollectPlant()
{
if (collectedPlants >= plantLimit) return;
collectedPlants++;
UpdatePlants();
}
public void UpdatePlants()
{
if (spawnedPlants.Count > 0)
{
foreach (var plant in spawnedPlants)
{
Destroy(plant);
}
spawnedPlants.Clear();
}
for (int i = 0; i < collectedPlants && i < plantLimit; i += plantThreshold)
{
GameObject spawnedPlant = Instantiate(((i / plantThreshold) % 2 == 0) ? plantRightRef : plantLeftRef, collectedHolder);
spawnedPlant.transform.localPosition = new Vector3(0, (i / plantThreshold) * plantDistance + plantDistance, 0);
spawnedPlant.GetComponent<SpriteRenderer>().sortingOrder = (i / plantThreshold) - 2;
spawnedPlant.SetActive(true);
spawnedPlants.Add(spawnedPlant);
}
}
private void Just(PlayerActionEvent caller, float state)
{
// REMARK: does not count for performance
@ -73,6 +128,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
{
game.Stomp();
game.bodyAnim.Play("Stomp", 0, 0);
}
nextStompBeat += 2f;
stomp?.Disable();

View File

@ -204,6 +204,10 @@ namespace HeavenStudio.Games.Scripts_CropStomp
{
var veggieScale = Mathf.Min(1.5f - pickPosition, 1f);
veggieTrans.localScale = Vector2.one * veggieScale;
if (pickPosition >= 1f)
{
game.CollectPlant();
}
}
}
@ -219,6 +223,10 @@ namespace HeavenStudio.Games.Scripts_CropStomp
var cond = Conductor.instance;
ParticleSystem spawnedHit = Instantiate(game.hitParticle, game.hitParticle.transform.parent);
spawnedHit.Play();
veggieState = 1;
game.ScheduleInput(targetBeat, isMole ? 0.5f : 1f, InputType.STANDARD_UP, PickJust, PickMiss, Out);
targetBeat = targetBeat + (isMole ? 0.5f : 1f);

View File

@ -56,8 +56,8 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
endEvent.Disable();
}
// Auto-release if holding at release time.
if (normalizedBeat >= 1f && !game.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP))
EndAce();
if (normalizedBeat >= 1f)
endEvent.Hit(0, 1);
}
loop.transform.localScale = Vector2.one / holder.transform.localScale;

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using static HeavenStudio.Games.SpaceDance;
using HeavenStudio.Common;
namespace HeavenStudio.Games.Loaders
{
@ -65,23 +66,18 @@ namespace HeavenStudio.Games.Loaders
new Param("toggle", false, "Instant", "Should the background instantly change color?")
}
},
new GameAction("bop", "Single Bop")
new GameAction("bop", "Bop")
{
function = delegate { SpaceDance.instance.Bop(); SpaceDance.instance.GrampsBop(eventCaller.currentEntity["gramps"]); },
function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.EpicBop(e.beat, e.length, e["auto"], e["bop"], e["grampsAuto"], e["gramps"]); },
parameters = new List<Param>()
{
new Param("gramps", false, "Gramps Bop", "Should Space Gramps bop with the dancers?")
}
},
new GameAction("bopToggle", "Bop Toggle")
{
function = delegate { SpaceDance.instance.shouldBop = eventCaller.currentEntity["toggle"]; SpaceDance.instance.spaceGrampsShouldBop = eventCaller.currentEntity["gramps"]; },
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("toggle", true, "Should bop?", "Should the dancers bop?"),
new Param("gramps", false, "Gramps Bop", "Should Space Gramps bop with the dancers?")
}
new Param("bop", true, "Dancers Bop", "Should the dancers bop?"),
new Param("auto", false, "Dancers Bop (Auto)", "Should the dancers auto bop?"),
new Param("gramps", false, "Gramps Bop", "Should Space Gramps bop with the dancers?"),
new Param("grampsAuto", false, "Gramps Bop (Auto)", "Should Space Gramps auto bop with the dancers?")
},
resizable = true,
defaultLength = 4f
},
new GameAction("grampsAnims", "Space Gramps Animations")
{
@ -92,7 +88,16 @@ namespace HeavenStudio.Games.Loaders
new Param("toggle", true, "Looping", "Should the animation loop?"),
new Param("type", SpaceDance.GrampsAnimationType.Talk, "Which animation?", "Which animation should space gramps do?")
}
}
},
new GameAction("scroll", "Scrolling Background")
{
function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.UpdateScrollSpeed(e["x"], e["y"]); },
defaultLength = 1f,
parameters = new List<Param>() {
new Param("x", new EntityTypes.Float(-5f, 5f, 0), "Horizontal", "How fast does the background move horizontally?"),
new Param("y", new EntityTypes.Float(-5f, 5f, 0), "Vertical", "How fast does the background move vertically?"),
}
},
},
new List<string>() {"agb", "normal"},
"agbspacedance", "jp",
@ -112,7 +117,7 @@ namespace HeavenStudio.Games
{
get
{
ColorUtility.TryParseHtmlString("#0014D6", out _defaultBGColor);
ColorUtility.TryParseHtmlString("#0029D6", out _defaultBGColor);
return _defaultBGColor;
}
}
@ -138,7 +143,7 @@ namespace HeavenStudio.Games
public Animator Gramps;
public Animator Hit;
public GameObject Player;
public bool shouldBop = false;
[NonSerialized] public bool shouldBop = true;
bool canBop = true;
bool grampsCanBop = true;
public bool spaceGrampsShouldBop = false;
@ -149,6 +154,13 @@ namespace HeavenStudio.Games
bool grampsLoopingAnim;
bool grampsSniffing;
[SerializeField] CanvasScroll scroll;
float scrollBeat;
float scrollOffsetX;
float scrollOffsetY;
float currentScrollLengthX;
float currentScrollLengthY;
public GameEvent bop = new GameEvent();
public static SpaceDance instance;
@ -165,13 +177,17 @@ namespace HeavenStudio.Games
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
float normalizedX = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthX;
float normalizedY = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthY;
scroll.NormalizedX = -scrollOffsetX - normalizedX;
scroll.NormalizedY = -scrollOffsetY - normalizedY;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop && canBop)
if (shouldBop)
{
Bop();
}
if (spaceGrampsShouldBop && grampsCanBop)
if (spaceGrampsShouldBop)
{
GrampsBop();
}
@ -199,22 +215,34 @@ namespace HeavenStudio.Games
{
Jukebox.PlayOneShotGame("spaceDance/inputBad");
DancerP.DoScaledAnimationAsync("PunchDo", 0.5f);
Gramps.Play("GrampsOhFuck", 0, 0);
// Look at this later, sound effect has some weird clipping on it sometimes?? popping. like. fucking popopop idk why its doing that its fine theres no sample weirdness ughh
}
if (PlayerInput.GetSpecificDirectionDown(1) && !IsExpectingInputNow(InputType.DIRECTION_RIGHT_DOWN))
{
DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f);
Jukebox.PlayOneShotGame("spaceDance/inputBad");
Gramps.Play("GrampsOhFuck", 0, 0);
}
if (PlayerInput.GetSpecificDirectionDown(2) && !IsExpectingInputNow(InputType.DIRECTION_DOWN_DOWN))
{
DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f);
Jukebox.PlayOneShotGame("spaceDance/inputBad");
Gramps.Play("GrampsOhFuck", 0, 0);
}
}
}
}
public void UpdateScrollSpeed(float scrollSpeedX, float scrollSpeedY)
{
scrollOffsetX = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthX;
scrollOffsetY = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthY;
currentScrollLengthX = scrollSpeedX;
currentScrollLengthY = scrollSpeedY;
scrollBeat = Time.realtimeSinceStartup;
}
public void GrampsAnimations(float beat, int type, bool looping)
{
switch (type)
@ -402,7 +430,7 @@ namespace HeavenStudio.Games
Dancer3.DoScaledAnimationAsync("TurnRightDo", 0.5f);
if (grampsTurns) Gramps.DoScaledAnimationAsync("GrampsTurnRightDo", 0.5f);
}),
new BeatAction.Action(beat + 1.99f, delegate { canBop = true; grampsCanBop = true; }),
new BeatAction.Action(beat + 1.5f, delegate { canBop = true; grampsCanBop = true; }),
});
}
@ -467,7 +495,7 @@ namespace HeavenStudio.Games
Dancer3.DoScaledAnimationAsync("SitDownDo", 0.5f);
if (grampsSits) Gramps.DoScaledAnimationAsync("GrampsSitDownDo", 0.5f);
}),
new BeatAction.Action(beat + 1.99f, delegate { canBop = true; grampsCanBop = true; }),
new BeatAction.Action(beat + 1.5f, delegate { canBop = true; grampsCanBop = true; }),
});
}
@ -558,22 +586,41 @@ namespace HeavenStudio.Games
}
public void EpicBop(float beat, float length, bool autoDancers, bool dancers, bool autoGramps, bool gramps)
{
shouldBop = autoDancers;
spaceGrampsShouldBop = autoGramps;
if (dancers || gramps)
{
List<BeatAction.Action> bops = new List<BeatAction.Action>();
for (int i = 0; i < length; i++)
{
if (dancers)
{
bops.Add(new BeatAction.Action(beat + i, delegate { Bop(); }));
}
if (gramps)
{
bops.Add(new BeatAction.Action(beat + i, delegate { GrampsBop(); }));
}
}
BeatAction.New(instance.gameObject, bops);
}
}
public void Bop()
{
canBop = true;
if (!canBop) return;
DancerP.DoScaledAnimationAsync("Bop", 0.5f);
Dancer1.DoScaledAnimationAsync("Bop", 0.5f);
Dancer2.DoScaledAnimationAsync("Bop", 0.5f);
Dancer3.DoScaledAnimationAsync("Bop", 0.5f);
}
public void GrampsBop(bool forceBop = false)
public void GrampsBop()
{
if (spaceGrampsShouldBop || forceBop)
{
grampsCanBop = true;
Gramps.DoScaledAnimationAsync("GrampsBop", 0.5f);
}
if (!grampsCanBop) return;
Gramps.DoScaledAnimationAsync("GrampsBop", 0.5f);
}
public void ChangeBackgroundColor(Color color, float beats)
@ -622,7 +669,7 @@ namespace HeavenStudio.Games
Jukebox.PlayOneShotGame("spaceDance/inputBad2");
DancerP.DoScaledAnimationAsync("Ouch", 0.5f);
Hit.Play("HitTurn", -1, 0);
Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f);
Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f);
}
public void JustSit(PlayerActionEvent caller, float state)
@ -648,7 +695,7 @@ namespace HeavenStudio.Games
Jukebox.PlayOneShotGame("spaceDance/inputBad2");
DancerP.DoScaledAnimationAsync("Ouch", 0.5f);
Hit.Play("HitSit", -1, 0);
Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f);
Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f);
}
public void JustPunch(PlayerActionEvent caller, float state)
@ -674,7 +721,7 @@ namespace HeavenStudio.Games
Jukebox.PlayOneShotGame("spaceDance/inputBad2");
DancerP.DoScaledAnimationAsync("Ouch", 0.5f);
Hit.Play("HitPunch", -1, 0);
Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f);
Gramps.DoScaledAnimationAsync("GrampsMiss", 0.5f);
}
public void Empty(PlayerActionEvent caller) { }

View File

@ -154,6 +154,7 @@ namespace HeavenStudio.Games
using Scripts_SpaceSoccer;
using HeavenStudio.Common;
using UnityEngine.Rendering;
using UnityEngine.UI;
public class SpaceSoccer : Minigame
{
@ -193,7 +194,8 @@ namespace HeavenStudio.Games
[SerializeField] private GameObject kickerPrefab;
[SerializeField] private GameObject ballRef;
[SerializeField] private List<Kicker> kickers;
[SerializeField] private SuperScroll backgroundSprite;
[SerializeField] private CanvasScroll backgroundSprite;
[SerializeField] private RawImage bgImage;
[SerializeField] private SpriteRenderer bg;
[Header("Properties")]
@ -245,7 +247,7 @@ namespace HeavenStudio.Games
float normalizedX = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthX;
float normalizedY = (Time.realtimeSinceStartup - scrollBeat) * currentScrollLengthY;
backgroundSprite.NormalizedX = -scrollOffsetX - normalizedX;
backgroundSprite.NormalizedY = -scrollOffsetY - normalizedY;
backgroundSprite.NormalizedY = scrollOffsetY + normalizedY;
float normalizedEaseBeat = cond.GetPositionFromBeat(easeBeat, easeLength);
if (normalizedEaseBeat <= 1 && normalizedEaseBeat > 0)
@ -500,12 +502,12 @@ namespace HeavenStudio.Games
if (seconds == 0)
{
bg.color = color;
backgroundSprite.Material.SetColor("_Color", dotColor);
bgImage.color = dotColor;
}
else
{
bgColorTween = bg.DOColor(color, seconds);
dotColorTween = backgroundSprite.Material.DOColor(dotColor, seconds);
dotColorTween = bgImage.DOColor(dotColor, seconds);
}
}