Files
PacManUdon/Assets/Scripts/Sequences/AttractScreenIntroduction.cs

180 lines
6.8 KiB
C#

using UnityEngine;
namespace Marro.PacManUdon
{
public partial class GameManager
{
private void TimeSequenceStepAttractScreenIntroduction(int sequenceProgress)
{
switch (sequenceProgress)
{
case 0:
SetGameState(PacManGameState.AttractMode);
// Initialize
soundManager.SuppressSound(true);
RestartLevel();
HideEverything();
SetFrozen(true);
attractScreen.gameObject.SetActive(true);
attractScreen.Initialize();
for (int i = 0; i <= 15; i++)
{
// Debug.Log($"{gameObject} TimeSequenceAttractScreen deactivating with iteration i");
attractScreenElements[i].SetActive(false);
}
attractScreen.SetPowerPelletsBlink(false);
break;
case 1:
// show "Character / Nickname"
attractScreenElements[0].SetActive(true);
break;
case 2:
// Show blinky sprite
attractScreenElements[1].SetActive(true);
break;
case 3:
// Show blinky character
attractScreenElements[2].SetActive(true);
break;
case 4:
// Show blinky nickname
attractScreenElements[3].SetActive(true);
break;
case 5:
// Show pinky sprite
attractScreenElements[4].SetActive(true);
break;
case 6:
// Show pinky character
attractScreenElements[5].SetActive(true);
break;
case 7:
// Show pinky nickname
attractScreenElements[6].SetActive(true);
break;
case 8:
// Show inky sprite
attractScreenElements[7].SetActive(true);
break;
case 9:
// Show inky character
attractScreenElements[8].SetActive(true);
break;
case 10:
// Show inky nickname
attractScreenElements[9].SetActive(true);
break;
case 11:
// Show clyde sprite
attractScreenElements[10].SetActive(true);
break;
case 12:
// Show clyde character
attractScreenElements[11].SetActive(true);
break;
case 13:
// Show clyde nickname
attractScreenElements[12].SetActive(true);
break;
case 14:
// Show pellet point values
attractScreenElements[13].SetActive(true);
break;
case 15:
// Show copyright message, setup pellet demonstration
attractScreenElements[14].SetActive(true);
attractScreenElements[15].SetActive(true);
pacMan.Reset();
pacMan.SetLevel(1);
pacMan.SetKinematic(true);
pacMan.SetActive(true);
pacMan.SetPosition(attractScreenElements[16].transform.localPosition);
pacMan.SetDirection(Vector2.left);
ghostManager.Reset();
ghostManager.SetLevel(2);
ghostManager.SetKinematic(true);
ghostManager.SetActive(true);
Ghost[] ghosts = ghostManager.Ghosts;
for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].SetPosition(attractScreenElements[17 + i].transform.localPosition);
ghosts[i].SetDirection(Vector2.left);
ghosts[i].SetState(PacManGhostState.Normal);
}
break;
case 16:
attractScreen.SetPowerPelletsBlink(true);
SetFrozen(false);
break;
case 17:
ghostManager.SetPowerPellet(true);
pacMan.SetPowerPellet(true);
attractScreenElements[15].SetActive(false);
break;
case 18:
// Turn PacMan around after eating power pellet
pacMan.SetDirection(Vector2.right);
pacMan.SetTargetDirection(Vector2.right);
break;
case 19:
ghostManager.Ghosts[0].Caught(200);
pacMan.SetActive(false);
SetFrozen(true);
break;
case 20:
ghostManager.Ghosts[0].ReturnHome();
ghostManager.Ghosts[0].SetActive(false);
pacMan.SetActive(true);
SetFrozen(false);
break;
case 21:
ghostManager.Ghosts[1].Caught(400);
pacMan.SetActive(false);
SetFrozen(true);
break;
case 22:
ghostManager.Ghosts[1].ReturnHome();
ghostManager.Ghosts[1].SetActive(false);
pacMan.SetActive(true);
SetFrozen(false);
break;
case 23:
ghostManager.Ghosts[2].Caught(800);
pacMan.SetActive(false);
SetFrozen(true);
break;
case 24:
ghostManager.Ghosts[2].ReturnHome();
ghostManager.Ghosts[2].SetActive(false);
pacMan.SetActive(true);
SetFrozen(false);
break;
case 25:
ghostManager.Ghosts[3].Caught(1600);
pacMan.SetActive(false);
SetFrozen(true);
break;
case 26:
ghostManager.Ghosts[3].ReturnHome();
ghostManager.Ghosts[3].SetActive(false);
break;
}
}
private void TimeSequenceFinishedAttractScreenIntroduction()
{
// Hide elements, start demo
attractScreen.gameObject.SetActive(false);
StartTimeSequence(PacManTimeSequence.AttractScreenDemo);
}
}
}