Crop Stomp: Veggie picking goodness

This commit is contained in:
Jenny Crowe 2022-03-01 13:57:37 -07:00
parent f4047466a6
commit aae753d6a2
6 changed files with 352 additions and 12 deletions

View file

@ -55,7 +55,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 932095736067145199} m_GameObject: {fileID: 932095736067145199}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.752, z: 0} m_LocalPosition: {x: 0, y: -0.84, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 7169260676522138663} - {fileID: 7169260676522138663}
@ -167,6 +167,53 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &2339041431090773305
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5887073583228178020}
- component: {fileID: 1230221333052491558}
m_Layer: 0
m_Name: Point 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5887073583228178020
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2339041431090773305}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.58, y: 1.37, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6378453749366738950}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1230221333052491558
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2339041431090773305}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
m_Name:
m_EditorClassIdentifier:
curve: {fileID: 1367185960650937854}
handleType: 0
leftHandleLocalPosition: {x: 0, y: -0, z: 0}
rightHandleLocalPosition: {x: -0, y: 0, z: -0}
--- !u!1 &2592768001999288343 --- !u!1 &2592768001999288343
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -196,7 +243,7 @@ Transform:
m_LocalScale: {x: 4.5, y: 4.5, z: 1} m_LocalScale: {x: 4.5, y: 4.5, z: 1}
m_Children: m_Children:
- {fileID: 4394677245651984230} - {fileID: 4394677245651984230}
- {fileID: 5722828240178235474} - {fileID: 1306622253208457060}
m_Father: {fileID: 7947161716638790645} m_Father: {fileID: 7947161716638790645}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -234,7 +281,7 @@ MonoBehaviour:
- {fileID: -4112523241890619114, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} - {fileID: -4112523241890619114, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3}
- {fileID: 3862573926363885855, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} - {fileID: 3862573926363885855, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3}
veggieSprite: {fileID: 8249654647796258422} veggieSprite: {fileID: 8249654647796258422}
veggieTrans: {fileID: 5722828240178235474} veggieTrans: {fileID: 1306622253208457060}
curve: {fileID: 2637729749686440137} curve: {fileID: 2637729749686440137}
targetBeat: 0 targetBeat: 0
--- !u!1 &2911726556380549294 --- !u!1 &2911726556380549294
@ -339,12 +386,12 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3948884045839928685} m_GameObject: {fileID: 3948884045839928685}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.752, z: 0} m_LocalPosition: {x: 0, y: 0.08799988, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 7001187974207596949} m_Father: {fileID: 1306622253208457060}
m_RootOrder: 1 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8249654647796258422 --- !u!212 &8249654647796258422
SpriteRenderer: SpriteRenderer:
@ -543,6 +590,53 @@ Transform:
m_Father: {fileID: 3229117913716202416} m_Father: {fileID: 3229117913716202416}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5221309158809627500
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8229892935033794648}
- component: {fileID: 2500821779944748825}
m_Layer: 0
m_Name: Point 0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8229892935033794648
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5221309158809627500}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6378453749366738950}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2500821779944748825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5221309158809627500}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
m_Name:
m_EditorClassIdentifier:
curve: {fileID: 1367185960650937854}
handleType: 0
leftHandleLocalPosition: {x: 0, y: 0, z: 0}
rightHandleLocalPosition: {x: -0, y: -0, z: -0}
--- !u!1 &5386007714129059416 --- !u!1 &5386007714129059416
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -764,6 +858,7 @@ MonoBehaviour:
scrollingHolder: {fileID: 3229117913716202416} scrollingHolder: {fileID: 3229117913716202416}
veggieHolder: {fileID: 6205523899711794644} veggieHolder: {fileID: 6205523899711794644}
farmer: {fileID: 2943047049103139379} farmer: {fileID: 2943047049103139379}
pickCurve: {fileID: 1367185960650937854}
--- !u!1 &5813499711658895222 --- !u!1 &5813499711658895222
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -982,6 +1077,61 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &6824902499205177888
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6378453749366738950}
- component: {fileID: 1367185960650937854}
m_Layer: 0
m_Name: PickCurve
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6378453749366738950
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6824902499205177888}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.29055557, y: 0.40266672, z: 0}
m_LocalScale: {x: 0.22222224, y: 0.22222224, z: 1}
m_Children:
- {fileID: 8229892935033794648}
- {fileID: 5727259875408126986}
- {fileID: 5887073583228178020}
m_Father: {fileID: 2890674062888421961}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1367185960650937854
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6824902499205177888}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
m_Name:
m_EditorClassIdentifier:
curveColor: {r: 0, g: 1, b: 0, a: 1}
startPointColor: {r: 1, g: 0, b: 0, a: 1}
endPointColor: {r: 0, g: 0, b: 1, a: 1}
sampling: 25
keyPoints:
- {fileID: 2500821779944748825}
- {fileID: 3508802522248597681}
- {fileID: 1230221333052491558}
normalizedTime: 0.5
--- !u!1 &6990946600413379120 --- !u!1 &6990946600413379120
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1107,7 +1257,7 @@ Transform:
m_Children: m_Children:
- {fileID: 3400679188163948944} - {fileID: 3400679188163948944}
m_Father: {fileID: 2890674062888421961} m_Father: {fileID: 2890674062888421961}
m_RootOrder: 0 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8546211236212805674 --- !u!212 &8546211236212805674
SpriteRenderer: SpriteRenderer:
@ -1179,6 +1329,53 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &8177810443694880834
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5727259875408126986}
- component: {fileID: 3508802522248597681}
m_Layer: 0
m_Name: Point 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5727259875408126986
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8177810443694880834}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.79, y: 5.8, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6378453749366738950}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3508802522248597681
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8177810443694880834}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
m_Name:
m_EditorClassIdentifier:
curve: {fileID: 1367185960650937854}
handleType: 0
leftHandleLocalPosition: {x: -1, y: -0, z: 0}
rightHandleLocalPosition: {x: 1, y: 0, z: -0}
--- !u!1 &8284146705987220773 --- !u!1 &8284146705987220773
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1207,6 +1404,7 @@ Transform:
m_LocalPosition: {x: 5, y: -1.9, z: 0} m_LocalPosition: {x: 5, y: -1.9, z: 0}
m_LocalScale: {x: 4.5, y: 4.5, z: 1} m_LocalScale: {x: 4.5, y: 4.5, z: 1}
m_Children: m_Children:
- {fileID: 6378453749366738950}
- {fileID: 4454582336686680825} - {fileID: 4454582336686680825}
- {fileID: 2611897720283921090} - {fileID: 2611897720283921090}
m_Father: {fileID: 3229117913716202416} m_Father: {fileID: 3229117913716202416}
@ -1266,7 +1464,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2890674062888421961} m_Father: {fileID: 2890674062888421961}
m_RootOrder: 1 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8250682435774137887 --- !u!212 &8250682435774137887
SpriteRenderer: SpriteRenderer:
@ -1319,3 +1517,34 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &9068570991608772132
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1306622253208457060}
m_Layer: 0
m_Name: Pivot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1306622253208457060
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9068570991608772132}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.84, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5722828240178235474}
m_Father: {fileID: 7001187974207596949}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 846fce928f1403a4d913323050c3ad10
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 58b4fa23fa22709409ac534d16680002
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 5cf7fb383a785c142afd865b84fca424
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System; using System;
using NaughtyBezierCurves;
using DG.Tweening; using DG.Tweening;
using RhythmHeavenMania.Util; using RhythmHeavenMania.Util;
@ -35,6 +36,7 @@ namespace RhythmHeavenMania.Games.CropStomp
public Transform scrollingHolder; public Transform scrollingHolder;
public Transform veggieHolder; public Transform veggieHolder;
public Farmer farmer; public Farmer farmer;
public BezierCurve3D pickCurve;
private Tween shakeTween; private Tween shakeTween;

View file

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using NaughtyBezierCurves; using NaughtyBezierCurves;
using DG.Tweening;
using RhythmHeavenMania.Util; using RhythmHeavenMania.Util;
@ -9,6 +10,8 @@ namespace RhythmHeavenMania.Games.CropStomp
{ {
public class Veggie : PlayerActionObject public class Veggie : PlayerActionObject
{ {
static float pickedRotationSpeed = -1080f;
public bool isMole; public bool isMole;
public Sprite[] veggieSprites; public Sprite[] veggieSprites;
public Sprite[] moleSprites; public Sprite[] moleSprites;
@ -18,11 +21,14 @@ namespace RhythmHeavenMania.Games.CropStomp
public float targetBeat; public float targetBeat;
private float stompedBeat; private float stompedBeat;
private float pickedBeat;
private int veggieState = 0; private int veggieState = 0;
private bool boinked; // Player got barely when trying to pick. private bool boinked; // Player got barely when trying to pick.
private float landBeat; private float landBeat;
private Tween squashTween;
private CropStomp game; private CropStomp game;
private void Start() private void Start()
@ -91,7 +97,7 @@ namespace RhythmHeavenMania.Games.CropStomp
{ {
veggieState = -1; veggieState = -1;
// Stuff that happens upon veggie landing goes here. Jukebox.PlayOneShotGame("cropStomp/veggieMiss");
return; return;
} }
@ -107,7 +113,7 @@ namespace RhythmHeavenMania.Games.CropStomp
veggieState = -1; veggieState = -1;
boinked = true; boinked = true;
// Stuff that happens upon boink goes here. Jukebox.PlayOneShot("miss");
MissedUpdate(); MissedUpdate();
} }
@ -132,7 +138,14 @@ namespace RhythmHeavenMania.Games.CropStomp
private void PickedUpdate() private void PickedUpdate()
{ {
float pickPosition = Conductor.instance.GetPositionFromBeat(pickedBeat, 1f);
pickPosition = Mathf.Clamp(pickPosition, 0, 1);
veggieTrans.position = game.pickCurve.GetPoint(pickPosition);
veggieTrans.rotation = Quaternion.Euler(0, 0, veggieTrans.rotation.eulerAngles.z + (pickedRotationSpeed * Time.deltaTime));
var veggieScale = Mathf.Min(1.5f - pickPosition, 1f);
veggieTrans.localScale = Vector2.one * veggieScale;
} }
private void StompVeggie(bool autoTriggered) private void StompVeggie(bool autoTriggered)
@ -160,6 +173,18 @@ namespace RhythmHeavenMania.Games.CropStomp
game.bodyAnim.Play("Stomp", 0, 0); game.bodyAnim.Play("Stomp", 0, 0);
} }
if (!isMole)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(targetBeat - 0.5f, delegate { Jukebox.PlayOneShotGame("cropStomp/veggieOh"); })
});
}
var veggieScale = veggieTrans.localScale;
veggieTrans.localScale = new Vector3(veggieScale.x * 0.5f, veggieScale.y, veggieScale.z);
squashTween = veggieTrans.DOScaleX(veggieScale.x, cond.secPerBeat * 0.5f / cond.musicSource.pitch);
ResetState(); ResetState();
Update(); // Update flying veggie state immediately. Update(); // Update flying veggie state immediately.
@ -174,8 +199,26 @@ namespace RhythmHeavenMania.Games.CropStomp
game.bodyAnim.Play("Pick", 0, 0); game.bodyAnim.Play("Pick", 0, 0);
game.isFlicking = true; game.isFlicking = true;
} }
var key1 = game.pickCurve.KeyPoints[0];
var keyPos = key1.Position;
key1.Position = new Vector3(keyPos.x, veggieTrans.position.y, keyPos.z);
// Stuff that happens upon veggie picking goes here. pickedBeat = Conductor.instance.songPositionInBeats;
if (!isMole)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(pickedBeat + 0.5f, delegate { veggieSprite.sortingOrder = -1; }),
new BeatAction.Action(pickedBeat + 1f, delegate { GameObject.Destroy(gameObject); })
});
Jukebox.PlayOneShotGame("cropStomp/veggieKay");
}
if (squashTween != null)
squashTween.Kill(true);
PickedUpdate(); PickedUpdate();
} }