New Version 1.42

Moving cam replay.
Fixed the bugs.

New Version 1.42

Moving cam replay.
Fixed the bugs.

New Version 1.42

Moving cam replay,
Fixed the bugs.
This commit is contained in:
SkunkStudios 2025-01-29 09:54:37 +07:00
parent dcb7df5fd1
commit 1c033119df
7079 changed files with 186851 additions and 48991 deletions

View file

@ -113,6 +113,7 @@ public class Ball : MonoBehaviour
if (collision.gameObject.tag == "Lane" && type == BallType.ThrowBall)
{
rollAudio.Play();
gutterAudio.Stop();
isGutter = false;
game.isPin = false;
roll.enabled = true;

View file

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamReplay : MonoBehaviour
{
public Transform[] endPoint;
public IEnumerator ReplayMove()
{
GameObject.FindObjectOfType<CameraFollow>().transform.position = transform.position;
GameObject.FindObjectOfType<CameraFollow>().transform.rotation = transform.rotation;
float time = 0;
int randomReplay = Random.Range(0, endPoint.Length);
while (time < 1)
{
GameObject.FindObjectOfType<CameraFollow>().transform.position = Vector3.Lerp(transform.position, endPoint[randomReplay].position, time);
GameObject.FindObjectOfType<CameraFollow>().transform.rotation = Quaternion.Lerp(transform.rotation, endPoint[randomReplay].rotation, time);
time += Time.deltaTime * 1;
yield return null;
}
GameObject.FindObjectOfType<CameraFollow>().transform.position = endPoint[randomReplay].position;
GameObject.FindObjectOfType<CameraFollow>().transform.rotation = endPoint[randomReplay].rotation;
GameObject.FindObjectOfType<CameraFollow>().type = CameraFollow.CameraType.Replay2;
}
}

View file

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

View file

@ -12,6 +12,7 @@ public class CameraFollow : MonoBehaviour
public float smoothRotSpeed = 10f;
private Vector3 fallMove;
private Coroutine replayCoroutine;
void Update()
{
@ -64,6 +65,10 @@ public class CameraFollow : MonoBehaviour
{
transform.Translate(-fallMove.x * 0.125f * Time.fixedDeltaTime, 7.5f * Time.fixedDeltaTime, 30 * Time.fixedDeltaTime, Space.World);
}
else if (type == CameraType.Replay2)
{
transform.Translate(Vector3.forward * 60 * Time.fixedDeltaTime, Space.World);
}
else if (type == CameraType.ReturnBall)
{
transform.Translate(-10f * Time.fixedDeltaTime, -5f * Time.fixedDeltaTime, 500 * Time.fixedDeltaTime, Space.World);
@ -76,8 +81,7 @@ public class CameraFollow : MonoBehaviour
public void Replay(int index)
{
type = CameraType.Replay;
transform.position = GameObject.FindObjectOfType<PinSetter>().replays[index].position;
transform.rotation = GameObject.FindObjectOfType<PinSetter>().replays[index].rotation;
replayCoroutine = StartCoroutine(GameObject.FindObjectOfType<PinSetter>().replays[index].ReplayMove());
}
public void React(int index)
@ -89,9 +93,24 @@ public class CameraFollow : MonoBehaviour
public void Reset()
{
transform.rotation = Quaternion.Euler(GameObject.FindObjectOfType<PinSetter>().rot * GameObject.FindObjectOfType<PinSetter>().rotSetX, 180, 0);
if (replayCoroutine != null)
{
StopCoroutine(replayCoroutine);
}
Vector3 desiredPosition = new Vector3(ball.transform.position.x + GameObject.FindObjectOfType<PinSetter>().pos.x, GameObject.FindObjectOfType<PinSetter>().pos.y, GameObject.FindObjectOfType<PinSetter>().pos.z);
transform.position = desiredPosition;
transform.rotation = Quaternion.Euler(GameObject.FindObjectOfType<PinSetter>().rot * GameObject.FindObjectOfType<PinSetter>().rotSetX, 180, 0);
}
public void EndCam()
{
if (replayCoroutine != null)
{
StopCoroutine(replayCoroutine);
}
type = CameraType.ReactCam;
transform.position = new Vector3(-GameObject.FindObjectOfType<PinSetter>().winPos.x, GameObject.FindObjectOfType<PinSetter>().winPos.y, GameObject.FindObjectOfType<PinSetter>().winPos.z);
transform.rotation = Quaternion.Euler(-GameObject.FindObjectOfType<PinSetter>().winRot.x, 180 - GameObject.FindObjectOfType<PinSetter>().winRot.y, 0);
}
public void FallMove(Vector3 camMove)

View file

@ -63,7 +63,6 @@ public class Game : MonoBehaviour
public AnimationScenes animations;
public enum Crowds { NoCrowd, CheerBig, CheerMed, CrowdOk, CrowdHohum, CrowdCrap, Laugh, Oooh, Firework }
public Crowds crowdType;
public enum AllVoices { Strike, Spare, Gutterball, Double, Turkey, Split, Split710, SplitPick, Most, Few, One, Miss, EndBad, EndOk, EndGood, EndGreat, Perfect }
public ScoreDisplay[] scoreDisplay;
public ScoreDisplayBall3[] scoreDisplay3;
public GameObject[] scoreCards = new GameObject[3];
@ -206,7 +205,6 @@ public class Game : MonoBehaviour
private GameObject[] sounds;
private bool isIntro = true;
private GameManager gameManager;
private AllVoices allVoices;
private Commentator commentator;
private Ball ball;
private Pin pin1;
@ -223,8 +221,6 @@ public class Game : MonoBehaviour
private Coroutine b;
private ActionReplay[] replays;
private bool is710;
private bool isCommentator = true;
private float commentatorTime = 0;
private int commentatorIndex = 0;
private bool isEndGame;
private int introAnimIndex;
@ -236,7 +232,6 @@ public class Game : MonoBehaviour
private int rainIndex = 0;
private bool isAnim = false;
private int chargeBallIndex;
private float openingTime;
private bool isResetPins = false;
private int pinCounts;
public delegate void OnHighscoreListChanged(List<ScoreBowler> list);
@ -578,11 +573,7 @@ public class Game : MonoBehaviour
winBallRender4.material = gameManager.chooseBalls[gameManager.turnBalls4].ballMat;
winBallRenderCPU.material = gameManager.chooseBalls[gameManager.compuObj[gameManager.turnBallsCPU].cpuIndex].ballMat;
AlleyRegister();
if (GameManager.isOpening)
{
openingTime += Time.deltaTime;
}
if (GameManager.isOpening && openingTime >= 14 || GameManager.isOpening && !opening.isPlaying)
if (GameManager.isOpening && opening.time >= 14)
{
music.Play();
GameManager.isOpening = false;
@ -1159,22 +1150,19 @@ public class Game : MonoBehaviour
{
rainIndex = 0;
}
if (commentatorAudio.isPlaying == isCommentator && commentatorIndex == 1 && allVoices < AllVoices.Perfect)
if (!commentatorAudio.isPlaying && commentatorIndex == 1)
{
commentatorAudio.clip = Resources.Load<AudioClip>("Sound/silence_sm");
commentatorAudio.Play();
commentatorIndex = 2;
}
if (commentatorIndex == 2 && allVoices < AllVoices.Perfect)
{
commentatorTime += Time.unscaledDeltaTime;
}
if (commentatorTime >= 0.5f && commentatorIndex == 2)
if (!commentatorAudio.isPlaying && commentatorIndex == 2)
{
commentator.SecondVoice(commentatorAudio);
commentatorAudio.Play();
commentatorTime = 0;
commentatorIndex = 3;
}
if (commentatorAudio.isPlaying == isCommentator && commentatorIndex == 3 || commentatorAudio.isPlaying == isCommentator && allVoices == AllVoices.Perfect)
if (!commentatorAudio.isPlaying && commentatorIndex == 3)
{
if (crowdType == Crowds.CheerBig)
{
@ -1209,8 +1197,6 @@ public class Game : MonoBehaviour
winCrowd.Play();
fireworksMulti.Play();
}
isCommentator = true;
commentatorTime = 0;
commentatorIndex = 0;
}
pinCounter.UpdateStandingCountAndSettle();
@ -1253,7 +1239,7 @@ public class Game : MonoBehaviour
float nextIndex;
if (isCurrentReplay)
{
nextIndex = currentReplayIndex + 1;
nextIndex = currentReplayIndex + 0.75f;
for (int i = 0; i < replays.Length; i++)
{
@ -1474,7 +1460,7 @@ public class Game : MonoBehaviour
replays[i].SetTransform(0);
}
cameraFollow.Replay(replayIndex);
yield return new WaitForSeconds(replayTime);
yield return new WaitForSeconds(replayTime * 1.5f);
replayText.SetActive(false);
for (int i = 0; i < replays.Length; i++)
{
@ -3384,10 +3370,6 @@ public class Game : MonoBehaviour
if (pinCounts == 5 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 6 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 7 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 8 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 9 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay)
{
VoiceMost();
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu)
{
isCommentator = false;
}
crowdType = Crowds.NoCrowd;
}
}
@ -3428,11 +3410,6 @@ public class Game : MonoBehaviour
if (pinCounts == 5 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 6 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 7 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 8 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 9 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay || pinCounts == 10 && PinCounter.pinCount > 0 && GameManager.type == GameManager.GameState.Replay)
{
VoiceMost();
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu)
{
isCommentator = false;
crowdAudio.Stop();
}
if (pinCounts == 5 || pinCounts == 6)
{
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
@ -3458,15 +3435,12 @@ public class Game : MonoBehaviour
public void VoiceStrike()
{
allVoices = AllVoices.Strike;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Strike(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3476,15 +3450,12 @@ public class Game : MonoBehaviour
public void VoiceSpare()
{
allVoices = AllVoices.Spare;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Spare(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3494,15 +3465,12 @@ public class Game : MonoBehaviour
public void VoiceGutterball()
{
allVoices = AllVoices.Gutterball;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Gutterball(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3512,15 +3480,12 @@ public class Game : MonoBehaviour
public void VoiceDouble()
{
allVoices = AllVoices.Double;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Double(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3530,15 +3495,12 @@ public class Game : MonoBehaviour
public void VoiceTurkey()
{
allVoices = AllVoices.Turkey;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Turkey(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3548,15 +3510,12 @@ public class Game : MonoBehaviour
public void VoiceSplit()
{
allVoices = AllVoices.Split;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Split(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3566,15 +3525,12 @@ public class Game : MonoBehaviour
public void VoiceSplit710()
{
allVoices = AllVoices.Split710;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Split710(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3584,15 +3540,12 @@ public class Game : MonoBehaviour
public void VoiceSplitPick()
{
allVoices = AllVoices.SplitPick;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.SplitPick(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3602,11 +3555,9 @@ public class Game : MonoBehaviour
public void VoiceMost()
{
allVoices = AllVoices.Most;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Most(commentatorAudio);
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
}
@ -3614,15 +3565,12 @@ public class Game : MonoBehaviour
public void VoiceFew()
{
allVoices = AllVoices.Few;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Few(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3632,15 +3580,12 @@ public class Game : MonoBehaviour
public void VoiceOne()
{
allVoices = AllVoices.One;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.One(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3650,15 +3595,12 @@ public class Game : MonoBehaviour
public void VoiceMiss()
{
allVoices = AllVoices.Miss;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.Miss(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3668,14 +3610,11 @@ public class Game : MonoBehaviour
public void VoiceEndBad()
{
allVoices = AllVoices.EndBad;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.EndBad(commentatorAudio);
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3685,14 +3624,11 @@ public class Game : MonoBehaviour
public void VoiceEndOk()
{
allVoices = AllVoices.EndOk;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.EndOk(commentatorAudio);
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3702,14 +3638,11 @@ public class Game : MonoBehaviour
public void VoiceEndGood()
{
allVoices = AllVoices.EndGood;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.EndGood(commentatorAudio);
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3719,14 +3652,11 @@ public class Game : MonoBehaviour
public void VoiceEndGreat()
{
allVoices = AllVoices.EndGreat;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentator.EndGreat(commentatorAudio);
commentatorTime = 0;
commentatorIndex = 1;
commentatorAudio.Play();
isCommentator = false;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3736,18 +3666,16 @@ public class Game : MonoBehaviour
public void PerfectGame()
{
allVoices = AllVoices.Perfect;
if (GameManager.isVoice && GameManager.type != GameManager.GameState.Menu && maxBalls != 1)
{
commentatorAudio.clip = Resources.Load<AudioClip>("Sound/crowd-perfect");
commentatorAudio.Play();
isCommentator = false;
commentatorIndex = 3;
}
else
{
crowdAudio.Stop();
commentatorAudio.Stop();
isCommentator = true;
}
if (GameManager.isVoice || crowdType > Crowds.NoCrowd)
{
@ -3790,9 +3718,7 @@ public class Game : MonoBehaviour
commentator.commentators2[(int)GameManager.voices2].EndGood.voiceIndex = Random.Range(0, commentator.commentators2[(int)GameManager.voices2].EndGood.voices.Length);
commentator.commentators2[(int)GameManager.voices2].EndGreat.voiceIndex = Random.Range(0, commentator.commentators2[(int)GameManager.voices2].EndGreat.voices.Length);
commentatorIndex = 0;
commentatorTime = 0;
commentatorAudio.Stop();
isCommentator = true;
}
public void CrowdStop()
@ -3879,7 +3805,6 @@ public class Game : MonoBehaviour
crowdAudio.Stop();
commentatorIndex = 3;
commentatorAudio.Play();
isCommentator = false;
}
crowdType = Crowds.Laugh;
}
@ -3993,12 +3918,9 @@ public class Game : MonoBehaviour
{
ballObject.SetActive(false);
}
cameraFollow.type = CameraFollow.CameraType.ReactCam;
cameraFollow.EndCam();
GameManager.type = GameManager.GameState.EndGame;
CrowdStop();
cameraFollow.transform.rotation = Quaternion.Euler(-GameObject.FindObjectOfType<PinSetter>().winRot.x, 180 - GameObject.FindObjectOfType<PinSetter>().winRot.y, 0);
Vector3 desiredPosition = new Vector3(-GameObject.FindObjectOfType<PinSetter>().winPos.x, GameObject.FindObjectOfType<PinSetter>().winPos.y, GameObject.FindObjectOfType<PinSetter>().winPos.z);
cameraFollow.transform.position = desiredPosition;
if (maxBalls == 1)
{
winGameBalls[17].SetActive(true);
@ -5288,10 +5210,8 @@ public class Game : MonoBehaviour
OpeningStop();
commentator.PlayGutterball1(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 0;
commentatorAudio.Play();
isCommentator = true;
}
}
@ -5307,10 +5227,8 @@ public class Game : MonoBehaviour
OpeningStop();
commentator.PlayGutterball1(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 0;
commentatorAudio.Play();
isCommentator = true;
}
}
@ -5326,10 +5244,8 @@ public class Game : MonoBehaviour
OpeningStop();
commentator.PlayGutterball2(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 0;
commentatorAudio.Play();
isCommentator = true;
}
}
@ -5345,10 +5261,8 @@ public class Game : MonoBehaviour
OpeningStop();
commentator.PlayGutterball2(commentatorAudio);
crowdAudio.Stop();
commentatorTime = 0;
commentatorIndex = 0;
commentatorAudio.Play();
isCommentator = true;
}
}

View file

@ -12,7 +12,7 @@ public class PinSetter : MonoBehaviour
public Vector3 pos;
public Vector3 ballPos;
public float rot;
public Transform[] replays;
public CamReplay[] replays;
public Transform[] reacts;
public Vector3 winPos;
public Vector3 winRot;

View file

@ -30,9 +30,9 @@ public static class ScoreMasterBall3
{
if (frames.Count == 10) { break; } // Prevents 11th frame score
if (rolls[i - 1] + rolls[i] + rolls[i + 1] < 10)
if (rolls[i - 1] + rolls[i + 1] < 10)
{ // Normal "OPEN" frame
frames.Add(rolls[i - 1] + rolls[i] + rolls[i + 1]);
frames.Add(rolls[i - 1] + rolls[i + 1]);
}
if (rolls.Count - i <= 1) { break; } // Ensure at least 1 look-ahead available
@ -40,16 +40,11 @@ public static class ScoreMasterBall3
if (rolls[i - 1] == 10)
{
i--; // STRIKE frame has just one bowl
frames.Add(20 + rolls[i + 1]);
frames.Add(10 + rolls[i + 1] + rolls[i + 2]);
}
else if (rolls[i - 1] + rolls[i] == 10)
{ // SPARE bonus
i--;
frames.Add(20);
}
else if (rolls[i - 1] + rolls[i] + rolls[i + 1] == 10)
{
frames.Add(10);
frames.Add(10 + rolls[i + 1]);
}
}
return frames;