mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-08 18:55:07 +00:00
Mahou Tsukai Rework (#502)
* fixed not being able to whiff in tap trial * bored meeting fixes * more board meeting fix * ww now uses z axis instead of scale * Inputs are now reworked in mahou tsukai * Fixed the particle effect
This commit is contained in:
parent
c00b6f46c3
commit
d85580b14e
13 changed files with 5129 additions and 578 deletions
|
@ -1598,7 +1598,7 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 175559278565927848}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6892e03a2f2994b48a4b076fdfae805d, type: 3}
|
||||
m_Name:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,132 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Magic
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Shimmer
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_PPtrCurves:
|
||||
- curve:
|
||||
- time: 0
|
||||
value: {fileID: -4394865311163506109, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- time: 0.016666668
|
||||
value: {fileID: -6165325623540167759, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- time: 0.033333335
|
||||
value: {fileID: 3955841814209212924, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- time: 0.05
|
||||
value: {fileID: -6165325623540167759, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- time: 0.06666667
|
||||
value: {fileID: 3955841814209212924, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
script: {fileID: 0}
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 3491122176
|
||||
attribute: 2086281974
|
||||
script: {fileID: 0}
|
||||
typeID: 1
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 0
|
||||
script: {fileID: 0}
|
||||
typeID: 212
|
||||
customType: 23
|
||||
isPPtrCurve: 1
|
||||
pptrCurveMapping:
|
||||
- {fileID: -4394865311163506109, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- {fileID: -6165325623540167759, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- {fileID: 3955841814209212924, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- {fileID: -6165325623540167759, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
- {fileID: 3955841814209212924, guid: a7ebfee08631d124d9385ba110cd71c0, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0.083333336
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0.016666668
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_IsActive
|
||||
path: Shimmer
|
||||
classID: 1
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events:
|
||||
- time: 0.083333336
|
||||
functionName: Kill
|
||||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a129607f5aae4eb49b0ac18493244372
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,72 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1102 &-6929626609083400027
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Magic
|
||||
m_Speed: 0.25
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: a129607f5aae4eb49b0ac18493244372, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MagicAnimator
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 8758913436755009276}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1107 &8758913436755009276
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -6929626609083400027}
|
||||
m_Position: {x: 303, y: 44, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: -6929626609083400027}
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 39f83b785ae333946a675fe36007f143
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -68,6 +68,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
|
|||
rollLoop.KillLoop(0);
|
||||
rollLoop = null;
|
||||
}
|
||||
game.StopChairLoopSoundIfLastToStop();
|
||||
|
||||
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_BoardMeeting;
|
||||
using System;
|
||||
|
||||
public class BoardMeeting : Minigame
|
||||
{
|
||||
|
@ -94,7 +95,7 @@ namespace HeavenStudio.Games
|
|||
bool assistantCanBop = true;
|
||||
bool executivesCanBop = true;
|
||||
public GameEvent bop = new GameEvent();
|
||||
Sound chairLoopSound = null;
|
||||
[NonSerialized] public Sound chairLoopSound = null;
|
||||
int missCounter = 0;
|
||||
private Tween shakeTween;
|
||||
|
||||
|
@ -106,6 +107,19 @@ namespace HeavenStudio.Games
|
|||
InitExecutives();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
foreach(var evt in scheduledInputs)
|
||||
{
|
||||
evt.Disable();
|
||||
}
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
@ -124,6 +138,10 @@ namespace HeavenStudio.Games
|
|||
SoundByte.PlayOneShotGame("boardMeeting/miss");
|
||||
SoundByte.PlayOneShot("miss");
|
||||
ScoreMiss();
|
||||
foreach (var evt in scheduledInputs)
|
||||
{
|
||||
evt.Disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,6 +330,16 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
public void StopChairLoopSoundIfLastToStop()
|
||||
{
|
||||
if (executives.FindAll(x => x.spinning).Count > 1) return;
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitExecutives()
|
||||
{
|
||||
float startPos = farLeft.position.x;
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using System;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
||||
{
|
||||
public class MagicFX : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public SpriteRenderer spriteRenderer;
|
||||
public GameObject shimmer;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
int order = (int)Math.Round((transform.position.z - 2) * 1000);
|
||||
spriteRenderer.sortingOrder = order;
|
||||
shimmer.GetComponent<SpriteRenderer>().sortingOrder = order;
|
||||
animator.Play("Magic", 0, 0);
|
||||
|
||||
Rigidbody2D rb2d = gameObject.AddComponent<Rigidbody2D>();
|
||||
rb2d.gravityScale = 2.5f;
|
||||
}
|
||||
|
||||
public void Kill()
|
||||
{
|
||||
Destroy(shimmer);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b107d57be99ffe34ea2d14c49c15ff80
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -12,20 +12,20 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
|||
public double createBeat;
|
||||
|
||||
private WizardsWaltz game;
|
||||
private bool hit = false;
|
||||
private bool passed = false;
|
||||
|
||||
public int order = 0;
|
||||
|
||||
private void Awake()
|
||||
public void Init(bool spawnedInactive)
|
||||
{
|
||||
game = WizardsWaltz.instance;
|
||||
spriteRenderer.sortingOrder = order;
|
||||
animator.Play("Appear", 0, 0);
|
||||
animator.Play("Appear", 0, spawnedInactive ? 1 : 0);
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
game.ScheduleInput(createBeat, game.beatInterval, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out);
|
||||
public void StartInput(double beat, float length)
|
||||
{
|
||||
game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -65,13 +65,11 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
|||
public void Ace()
|
||||
{
|
||||
game.wizard.Magic(this, true);
|
||||
hit = true;
|
||||
}
|
||||
|
||||
public void NearMiss()
|
||||
{
|
||||
game.wizard.Magic(this, false);
|
||||
hit = true;
|
||||
}
|
||||
|
||||
private void Just(PlayerActionEvent caller, float state)
|
||||
|
|
|
@ -10,9 +10,6 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
|||
public Animator animator;
|
||||
public GameObject shadow;
|
||||
|
||||
private float newBeat = 0;
|
||||
private int beats = 0;
|
||||
|
||||
private WizardsWaltz game;
|
||||
private float songPos;
|
||||
|
||||
|
@ -25,17 +22,20 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz
|
|||
{
|
||||
songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - game.wizardBeatOffset);
|
||||
var am = game.beatInterval / 2f;
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||
var y = Mathf.Cos(Mathf.PI * songPos / am);
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * game.xRange;
|
||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * game.yRange;
|
||||
var z = Mathf.Cos(Mathf.PI * songPos / am) * game.zRange;
|
||||
//var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
|
||||
transform.position = new Vector3(x, 3f - y * 0.5f, 0);
|
||||
shadow.transform.position = new Vector3(x, -3f + y * 1.5f, 0);
|
||||
transform.position = new Vector3(x, 3f - y * 0.5f, z);
|
||||
shadow.transform.position = new Vector3(x, game.plantYOffset + y * 1.5f, z);
|
||||
|
||||
var xscale = scale;
|
||||
/*var xscale = scale;
|
||||
if (y > 0) xscale *= -1;
|
||||
transform.localScale = new Vector3(xscale, scale, 1);
|
||||
shadow.transform.localScale = new Vector3(scale, scale, 1);
|
||||
shadow.transform.localScale = new Vector3(scale, scale, 1);*/
|
||||
|
||||
transform.localScale = new Vector3((y > 0) ? -1 : 1, 1, 1);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
|
|
|
@ -17,16 +17,24 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
new GameAction("start interval", "Start Interval")
|
||||
{
|
||||
function = delegate { WizardsWaltz.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
|
||||
preFunction = delegate { var e = eventCaller.currentEntity; WizardsWaltz.PreInterval(e.beat, e.length, e["auto"]); },
|
||||
defaultLength = 6f,
|
||||
resizable = true,
|
||||
priority = 1
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("auto", true, "Auto Pass Turn")
|
||||
},
|
||||
preFunctionLength = 1
|
||||
},
|
||||
new GameAction("plant", "Plant")
|
||||
{
|
||||
function = delegate { WizardsWaltz.instance.SpawnFlower(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 0.5f,
|
||||
},
|
||||
new GameAction("passTurn", "Pass Turn")
|
||||
{
|
||||
preFunction = delegate { var e = eventCaller.currentEntity; WizardsWaltz.PrePassTurn(e.beat); },
|
||||
preFunctionLength = 1
|
||||
}
|
||||
},
|
||||
new List<string>() {"agb", "repeat"},
|
||||
"agbwizard", "en",
|
||||
|
@ -38,6 +46,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Jukebox;
|
||||
using Scripts_WizardsWaltz;
|
||||
|
||||
public class WizardsWaltz : Minigame
|
||||
|
@ -47,99 +56,220 @@ namespace HeavenStudio.Games
|
|||
public Girl girl;
|
||||
public GameObject plantHolder;
|
||||
public GameObject plantBase;
|
||||
public GameObject fxHolder;
|
||||
public GameObject fxBase;
|
||||
|
||||
private int timer = 0;
|
||||
public float beatInterval = 6f;
|
||||
double intervalStartBeat;
|
||||
bool intervalStarted;
|
||||
[Header("Properties")]
|
||||
[NonSerialized] public float beatInterval = 6f;
|
||||
[NonSerialized] public double intervalStartBeat;
|
||||
public double wizardBeatOffset = 0f;
|
||||
|
||||
[NonSerialized] public int plantsLeft = 0; //this variable is unused
|
||||
public float xRange = 5;
|
||||
public float zRange = 5;
|
||||
public float yRange = 0.5f;
|
||||
public float plantYOffset = -2f;
|
||||
private List<Plant> currentPlants = new();
|
||||
|
||||
public static WizardsWaltz instance;
|
||||
|
||||
private static CallAndResponseHandler crHandlerInstance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
wizard.Init();
|
||||
}
|
||||
|
||||
var nextStart = GameManager.instance.Beatmap.Entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeatsAsDouble);
|
||||
|
||||
if (nextStart != null)
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
EventCaller.instance.CallEvent(nextStart, true);
|
||||
SetWizardOffset(beat);
|
||||
crHandlerInstance = null;
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat)
|
||||
{
|
||||
SetWizardOffset(beat);
|
||||
if (queuedIntervals.Count > 0)
|
||||
{
|
||||
foreach (var interval in queuedIntervals)
|
||||
{
|
||||
SetIntervalStart(interval.beat, interval.interval, beat, interval.autoPassTurn);
|
||||
}
|
||||
queuedIntervals.Clear();
|
||||
}
|
||||
if (crHandlerInstance != null && crHandlerInstance.queuedEvents.Count > 0)
|
||||
{
|
||||
if (crHandlerInstance.queuedEvents.Find(x => x.beat >= beat) != null)
|
||||
{
|
||||
crHandlerInstance = null;
|
||||
return;
|
||||
}
|
||||
foreach (var crEvent in crHandlerInstance.queuedEvents)
|
||||
{
|
||||
SpawnFlower(crEvent.beat, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetWizardOffset(double beat)
|
||||
{
|
||||
var allIntervals = EventCaller.GetAllInGameManagerList("wizardsWaltz", new string[] { "start interval" });
|
||||
var tempEvents = allIntervals.FindAll(x => x.beat >= beat);
|
||||
if (tempEvents.Count > 0)
|
||||
{
|
||||
wizardBeatOffset = tempEvents[0].beat;
|
||||
beatInterval = tempEvents[0].length;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
||||
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
||||
{
|
||||
intervalStarted = false;
|
||||
if (passedTurns.Count > 0)
|
||||
{
|
||||
foreach (var pass in passedTurns)
|
||||
{
|
||||
PassTurnStandalone(pass);
|
||||
}
|
||||
passedTurns.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
private List<RiqEntity> GetAllPlantsBetweenBeat(double beat, double endBeat)
|
||||
{
|
||||
if (timer % 8 == 0 || UnityEngine.Random.Range(0,8) == 0)
|
||||
{
|
||||
var songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - wizardBeatOffset);
|
||||
var am = beatInterval / 2f;
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6 + UnityEngine.Random.Range(-0.5f, 0.5f);
|
||||
var y = Mathf.Cos(Mathf.PI * songPos / am) * 0.5f + UnityEngine.Random.Range(-0.5f, 0.5f);
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f + UnityEngine.Random.Range(-0.2f, 0.2f);
|
||||
|
||||
MagicFX magic = Instantiate(fxBase, fxHolder.transform).GetComponent<MagicFX>();
|
||||
|
||||
magic.transform.position = new Vector3(x, 2f + y, 0);
|
||||
magic.transform.localScale = wizard.gameObject.transform.localScale;
|
||||
magic.gameObject.SetActive(true);
|
||||
return EventCaller.GetAllInGameManagerList("wizardsWaltz", new string[] { "plant" }).FindAll(x => x.beat >= beat && x.beat < endBeat);
|
||||
}
|
||||
|
||||
timer++;
|
||||
}
|
||||
|
||||
public void SetIntervalStart(double beat, float interval = 4f)
|
||||
public void SetIntervalStart(double beat, float interval, double gameSwitchBeat, bool autoPassTurn)
|
||||
{
|
||||
// Don't do these things if the interval was already started.
|
||||
if (!intervalStarted)
|
||||
{
|
||||
plantsLeft = 0;
|
||||
intervalStarted = true;
|
||||
}
|
||||
|
||||
wizardBeatOffset = beat;
|
||||
intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
|
||||
CallAndResponseHandler newHandler = new();
|
||||
crHandlerInstance = newHandler;
|
||||
crHandlerInstance.StartInterval(beat, interval);
|
||||
var relevantPlantEvents = GetAllPlantsBetweenBeat(beat, beat + interval);
|
||||
foreach (var plant in relevantPlantEvents)
|
||||
{
|
||||
crHandlerInstance.AddEvent(plant.beat);
|
||||
SpawnFlower(plant.beat, plant.beat < gameSwitchBeat);
|
||||
}
|
||||
|
||||
public void SpawnFlower(double beat)
|
||||
if (autoPassTurn)
|
||||
{
|
||||
// If interval hasn't started, assume this is the first hair of the interval.
|
||||
if (!intervalStarted)
|
||||
SetIntervalStart(beat, beatInterval);
|
||||
PassTurn(beat + interval, newHandler);
|
||||
}
|
||||
}
|
||||
|
||||
SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat);
|
||||
Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>();
|
||||
public static void PreInterval(double beat, float interval, bool autoPassTurn)
|
||||
{
|
||||
if (GameManager.instance.currentGame == "wizardsWaltz")
|
||||
{
|
||||
instance.SetIntervalStart(beat, interval, beat, autoPassTurn);
|
||||
}
|
||||
else
|
||||
{
|
||||
queuedIntervals.Add(new QueuedInterval()
|
||||
{
|
||||
beat = beat,
|
||||
interval = interval,
|
||||
autoPassTurn = autoPassTurn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - wizardBeatOffset);
|
||||
private void PassTurnStandalone(double beat)
|
||||
{
|
||||
if (crHandlerInstance != null) PassTurn(beat, crHandlerInstance);
|
||||
}
|
||||
|
||||
public static void PrePassTurn(double beat)
|
||||
{
|
||||
if (GameManager.instance.currentGame == "wizardsWaltz")
|
||||
{
|
||||
instance.PassTurnStandalone(beat);
|
||||
}
|
||||
else
|
||||
{
|
||||
passedTurns.Add(beat);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<double> passedTurns = new();
|
||||
|
||||
private void PassTurn(double beat, CallAndResponseHandler crHandler)
|
||||
{
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat - 0.25, delegate
|
||||
{
|
||||
beatInterval = crHandler.intervalLength;
|
||||
wizardBeatOffset = beat;
|
||||
intervalStartBeat = beat;
|
||||
foreach (var plant in currentPlants)
|
||||
{
|
||||
var songPos = (float)(plant.createBeat - wizardBeatOffset);
|
||||
var am = (beatInterval / 2f);
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * 6;
|
||||
var y = -3f + Mathf.Cos(Mathf.PI * songPos / am) * 1.5f;
|
||||
var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange;
|
||||
var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f);
|
||||
var z = Mathf.Cos(Mathf.PI * songPos / am) * zRange;
|
||||
/*var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
var xscale = scale;
|
||||
if (y > -3.5f) xscale *= -1;
|
||||
if (y > -3.5f) xscale *= -1;*/
|
||||
|
||||
plant.transform.localPosition = new Vector3(x, y, 0);
|
||||
plant.transform.localScale = new Vector3(xscale, scale, 1);
|
||||
plant.transform.localPosition = new Vector3(x, y, z);
|
||||
//plant.transform.localScale = new Vector3(xscale, scale, 1);
|
||||
}
|
||||
|
||||
plant.order = (int)Math.Round((scale - 1) * 1000);
|
||||
plant.gameObject.SetActive(true);
|
||||
foreach (var crEvent in crHandler.queuedEvents)
|
||||
{
|
||||
Plant plantToInput = currentPlants.Find(x => x.createBeat == crEvent.beat);
|
||||
plantToInput.StartInput(beat - 0.25, (float)crEvent.relativeBeat + 0.25f);
|
||||
}
|
||||
crHandler.queuedEvents.Clear();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private static List<QueuedInterval> queuedIntervals = new();
|
||||
|
||||
private struct QueuedInterval
|
||||
{
|
||||
public double beat;
|
||||
public float interval;
|
||||
public bool autoPassTurn;
|
||||
}
|
||||
|
||||
public void SpawnFlower(double beat, bool spawnedInactive)
|
||||
{
|
||||
if (!spawnedInactive) SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat);
|
||||
Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>();
|
||||
currentPlants.Add(plant);
|
||||
var songPos = (float)(beat - wizardBeatOffset);
|
||||
var am = (beatInterval / 2f);
|
||||
var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange;
|
||||
var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f);
|
||||
var z = Mathf.Cos(Mathf.PI * songPos / am) * zRange;
|
||||
/*var scale = 1 - Mathf.Cos(Mathf.PI * songPos / am) * 0.35f;
|
||||
var xscale = scale;
|
||||
if (y > -3.5f) xscale *= -1;*/
|
||||
|
||||
plant.transform.localPosition = new Vector3(x, y, z);
|
||||
//plant.transform.localScale = new Vector3(xscale, scale, 1);
|
||||
|
||||
//plant.order = (int)Math.Round((scale - 1) * 1000);
|
||||
plant.order = (int)Math.Round(z * -1);
|
||||
|
||||
plant.createBeat = beat;
|
||||
plantsLeft++;
|
||||
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
plant.gameObject.SetActive(true);
|
||||
plant.Init(spawnedInactive);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue