prefab done
fixes to camera, bops and player input
This commit is contained in:
parent
481a6c77f9
commit
dea7f8a521
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 51 KiB |
|
|
@ -51,7 +51,7 @@ TextureImporter:
|
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
|
|
|
|||
|
|
@ -2,14 +2,17 @@
|
|||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: ball_trail
|
||||
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _GLOSSYREFLECTIONS_OFF
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _ALPHAPREMULTIPLY_ON
|
||||
- _GLOSSYREFLECTIONS_OFF
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
|
|
@ -49,7 +52,7 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: bc88d6ad84763e146a8a1618d386f8e4, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
|
|
@ -80,6 +83,7 @@ Material:
|
|||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _AlphaClip: 0
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -16,6 +16,9 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
|
|||
private Animator opponentAnim;
|
||||
private Conductor cond;
|
||||
|
||||
public bool PlayerDown { get { return playerDown; } }
|
||||
bool playerDown = false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
game = RhythmRally.instance;
|
||||
|
|
@ -31,20 +34,23 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
|
|||
if (PlayerInput.GetIsAction(RhythmRally.InputAction_BasicPress))
|
||||
{
|
||||
playerAnim.Play("Ready1");
|
||||
playerDown = true;
|
||||
}
|
||||
if (PlayerInput.GetIsAction(RhythmRally.InputAction_BasicRelease))
|
||||
{
|
||||
playerAnim.Play("UnReady1");
|
||||
playerDown = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!game.served || game.missed || !game.started) return;
|
||||
if (!game.started) return;
|
||||
}
|
||||
if (PlayerInput.GetIsAction(RhythmRally.InputAction_FlickPress) && !game.IsExpectingInputNow(RhythmRally.InputAction_FlickPress))
|
||||
{
|
||||
// Play "whoosh" sound here
|
||||
playerAnim.DoScaledAnimationAsync("Swing", 0.5f);
|
||||
playerDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +71,8 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
|
|||
bounceBeat = game.serveBeat + game.targetBeat + 0.5f;
|
||||
}
|
||||
|
||||
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
|
||||
playerAnim.DoScaledAnimationAsync("Swing", 0.5f);
|
||||
playerDown = false;
|
||||
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Return", hitBeat), new MultiSound.Sound("rhythmRally/ReturnBounce", bounceBeat) });
|
||||
BounceFX(bounceBeat);
|
||||
game.ball.SetActive(true);
|
||||
|
|
@ -75,7 +82,8 @@ namespace HeavenStudio.Games.Scripts_RhythmRally
|
|||
{
|
||||
MissBall();
|
||||
SoundByte.PlayOneShot("miss");
|
||||
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
|
||||
playerAnim.DoScaledAnimationAsync("Swing", 0.5f);
|
||||
playerDown = false;
|
||||
|
||||
game.missCurve.KeyPoints[0].Position = game.ball.transform.position;
|
||||
game.missCurve.transform.localScale = new Vector3(-state, 1f, 1f);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NaughtyBezierCurves;
|
||||
using DG.Tweening;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.InputSystem;
|
||||
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
|
|
@ -88,16 +89,16 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
function = delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
var rotation = new Vector3(0, e["valA"], 0);
|
||||
RhythmRally.instance.ChangeCameraAngle(rotation, e["valB"], e.length, (Ease)e["type"], (RotateMode)e["type2"]);
|
||||
// var rotation = new Vector3(0, e["valA"], 0);
|
||||
RhythmRally.instance.ChangeCameraAngle(e.beat, e["valA"], e["valB"], e.length, (Util.EasingFunction.Ease)e["type"]);
|
||||
},
|
||||
defaultLength = 4,
|
||||
resizable = true,
|
||||
parameters = new List<Param>() {
|
||||
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Angle", "The rotation of the camera around the center of the table"),
|
||||
new Param("valB", new EntityTypes.Float(0.5f, 4f, 1), "Zoom", "The camera's level of zoom (Lower value = Zoomed in)"),
|
||||
new Param("type", Ease.Linear, "Ease", "The easing function to use"),
|
||||
new Param("type2", RotateMode.Fast, "Rotation Mode", "The rotation mode to use")
|
||||
new Param("type", Util.EasingFunction.Ease.Linear, "Ease", "The easing function to use"),
|
||||
// new Param("type2", RotateMode.Fast, "Rotation Mode", "The rotation mode to use")
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
@ -125,7 +126,7 @@ namespace HeavenStudio.Games
|
|||
[Header("Ball and curve info")]
|
||||
public GameObject ball;
|
||||
public GameObject ballShadow;
|
||||
public TrailRenderer ballTrail;
|
||||
public ParticleSystem ballTrail;
|
||||
public BezierCurve3D serveCurve;
|
||||
public BezierCurve3D returnCurve;
|
||||
public BezierCurve3D tossCurve;
|
||||
|
|
@ -167,8 +168,19 @@ namespace HeavenStudio.Games
|
|||
SetupBopRegion("rhythmRally", "bop", "bopAuto");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
EntityPreCheck(Conductor.instance.songPositionInBeatsAsDouble);
|
||||
}
|
||||
|
||||
const float tableHitTime = 0.58f;
|
||||
bool opponentServing = false; // Opponent serving this frame?
|
||||
double cameraRotateBeat = double.MaxValue;
|
||||
double cameraRotateLength;
|
||||
Util.EasingFunction.Ease cameraRotateEase;
|
||||
float cameraRotateLast = 0, cameraScaleLast = 1;
|
||||
float cameraRotateNext = 0, cameraScaleNext = 1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
|
@ -274,10 +286,8 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Make conditional so ball shadow only appears when over table.
|
||||
ballShadow.transform.position = new Vector3(ball.transform.position.x, -0.399f, ball.transform.position.z);
|
||||
|
||||
|
||||
var timeBeforeNextHit = hitBeat + beatDur1 + beatDur2 - currentBeat;
|
||||
|
||||
// Check if the opponent should swing.
|
||||
|
|
@ -342,7 +352,8 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
|
||||
// If player never swung and is still in ready state, snap them out of it.
|
||||
if (missed && playerState.IsName("Ready1"))
|
||||
// only if they're not manually preparing via touch controls
|
||||
if (missed && playerState.IsName("Ready1") && (!paddlers.PlayerDown))
|
||||
playerAnim.Play("Beat");
|
||||
}
|
||||
}
|
||||
|
|
@ -358,6 +369,47 @@ namespace HeavenStudio.Games
|
|||
opponentServing = false;
|
||||
|
||||
//update camera
|
||||
UpdateCamera(currentBeat);
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
EntityPreCheck(beat);
|
||||
}
|
||||
|
||||
void EntityPreCheck(double beat)
|
||||
{
|
||||
cameraRotateBeat = double.MaxValue;
|
||||
cameraRotateLength = 0;
|
||||
cameraRotateEase = Util.EasingFunction.Ease.Linear;
|
||||
cameraRotateLast = 0; cameraScaleLast = 1;
|
||||
cameraRotateNext = 0; cameraScaleNext = 1;
|
||||
|
||||
List<RiqEntity> prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.beat < beat && c.datamodel.Split(0) == "rhythmRally");
|
||||
RiqEntity lastGameSwitch = GameManager.instance.Beatmap.Entities.FindLast(c => c.beat <= beat && c.datamodel == "gameManager/switchGame/rhythmRally");
|
||||
|
||||
if (lastGameSwitch == null) return;
|
||||
List<RiqEntity> cameraEntities = prevEntities.FindAll(c => c.beat >= lastGameSwitch.beat && c.datamodel == "rhythmRally/camera");
|
||||
|
||||
foreach (var entity in cameraEntities)
|
||||
{
|
||||
ChangeCameraAngle(entity.beat, entity["valA"], entity["valB"], entity.length, (Util.EasingFunction.Ease)entity["type"]);
|
||||
}
|
||||
|
||||
UpdateCamera(beat);
|
||||
}
|
||||
|
||||
void UpdateCamera(double beat)
|
||||
{
|
||||
if (beat >= cameraRotateBeat)
|
||||
{
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(cameraRotateEase);
|
||||
float rotProg = Conductor.instance.GetPositionFromBeat(cameraRotateBeat, cameraRotateLength, true);
|
||||
float rot = func(cameraRotateLast, cameraRotateNext, rotProg);
|
||||
cameraPivot.rotation = Quaternion.Euler(0, rot, 0);
|
||||
cameraPivot.localScale = Vector3.one * func(cameraScaleLast, cameraScaleNext, rotProg);
|
||||
}
|
||||
|
||||
GameCamera.AdditionalPosition = cameraPos.position + (Quaternion.Euler(cameraPos.rotation.eulerAngles) * Vector3.forward * 10f);
|
||||
GameCamera.AdditionalRotEuler = cameraPos.rotation.eulerAngles;
|
||||
GameCamera.AdditionalFoV = cameraFOV;
|
||||
|
|
@ -395,10 +447,10 @@ namespace HeavenStudio.Games
|
|||
|
||||
bool playerPrepping = false; // Player using prep animation?
|
||||
bool opponentPrepping = false; // Opponent using prep animation?
|
||||
if (!playerPrepping && (playerAnim.IsAnimationNotPlaying() || playerState.IsName("Idle") || playerState.IsName("Beat")))
|
||||
if ((!playerPrepping) && (!paddlers.PlayerDown) && (playerAnim.IsAnimationNotPlaying() || playerState.IsName("Idle") || playerState.IsName("Beat")))
|
||||
playerAnim.DoScaledAnimationAsync("Beat", 0.5f);
|
||||
|
||||
if (!opponentPrepping && !opponentServing && !tossing && (opponentAnim.IsAnimationNotPlaying() || opponentState.IsName("Idle") || opponentState.IsName("Beat")))
|
||||
if ((!opponentPrepping) && (!opponentServing) && (!tossing) && (opponentAnim.IsAnimationNotPlaying() || opponentState.IsName("Idle") || opponentState.IsName("Beat")))
|
||||
opponentAnim.DoScaledAnimationAsync("Beat", 0.5f);
|
||||
}
|
||||
|
||||
|
|
@ -492,11 +544,15 @@ namespace HeavenStudio.Games
|
|||
inPose = true;
|
||||
}
|
||||
|
||||
public void ChangeCameraAngle(Vector3 rotation, float camZoom, float length, Ease ease, RotateMode rotateMode)
|
||||
public void ChangeCameraAngle(double beat, float rotation, float camZoom, double length, Util.EasingFunction.Ease ease)
|
||||
{
|
||||
var len = length * Conductor.instance.secPerBeat;
|
||||
cameraPivot.DORotate(rotation, len, rotateMode).SetEase(ease);
|
||||
cameraPivot.DOScale(camZoom, len).SetEase(ease);
|
||||
cameraRotateBeat = beat;
|
||||
cameraRotateLength = length;
|
||||
cameraRotateEase = ease;
|
||||
cameraRotateLast = cameraRotateNext;
|
||||
cameraScaleLast = cameraScaleNext;
|
||||
cameraRotateNext = rotation;
|
||||
cameraScaleNext = camZoom;
|
||||
}
|
||||
|
||||
public void PrepareFastRally(double beat, RallySpeed speedChange, bool muteAudio = false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue