Skip to content

Commit

Permalink
Updated clang formatting for switch statements (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonPacewic authored May 18, 2023
1 parent 89f7949 commit b8f0402
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 243 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ IndentWidth: 4
AccessModifierOffset: -4
ColumnLimit: 120
AllowShortFunctionsOnASingleLine: None
IndentCaseLabels: true
74 changes: 37 additions & 37 deletions Assets/Scripts/Audio/MusicPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public void SuddenTransition(string music, string sfxType)

switch (sfxType.ToLower())
{
case "enemy transition":
clip = EnemyTransition;
break;
default:
Debug.LogError(sfxType + " is a invalid music type");
return;
case "enemy transition":
clip = EnemyTransition;
break;
default:
Debug.LogError(sfxType + " is a invalid music type");
return;
}

CurrentMusic = music;
Expand Down Expand Up @@ -138,22 +138,22 @@ private void Play(string musicType)

switch (musicType.ToLower())
{
case "enemy room":
music = enemyRoom;
break;
case "menu":
music = menu;
break;
case "peaceful":
music = peaceful;
break;
case "boss":
source.clip = boss[SelectBossMusic()];
source.Play();
return;
default:
Debug.LogError(musicType + " is a invalid music type");
return;
case "enemy room":
music = enemyRoom;
break;
case "menu":
music = menu;
break;
case "peaceful":
music = peaceful;
break;
case "boss":
source.clip = boss[SelectBossMusic()];
source.Play();
return;
default:
Debug.LogError(musicType + " is a invalid music type");
return;
}

int random = Random.Range(0, music.Length);
Expand All @@ -165,21 +165,21 @@ private int SelectBossMusic()
{
switch (BossPhaseManager.CurrentPhase)
{
case BossPhaseManager.Phases.Ignoring:
return 0;
case BossPhaseManager.Phases.Denial:
return 1;
case BossPhaseManager.Phases.Anger:
return 2;
case BossPhaseManager.Phases.Bargaining:
return 3;
case BossPhaseManager.Phases.Depression:
return 4;
case BossPhaseManager.Phases.Acceptance:
return 5;
default:
Debug.LogError("Invalid phase");
return 0;
case BossPhaseManager.Phases.Ignoring:
return 0;
case BossPhaseManager.Phases.Denial:
return 1;
case BossPhaseManager.Phases.Anger:
return 2;
case BossPhaseManager.Phases.Bargaining:
return 3;
case BossPhaseManager.Phases.Depression:
return 4;
case BossPhaseManager.Phases.Acceptance:
return 5;
default:
Debug.LogError("Invalid phase");
return 0;
}
}
}
24 changes: 12 additions & 12 deletions Assets/Scripts/Dialogue/DialogueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ private void HandleTags(List<string> tags)

switch (tagKey)
{
case speakerTag:
DialogueProfile profile = DialogueProfiles.Find(x => x.Name == tagValue);
Assert.Boolean(profile != null, "Invalid speaker: " + tagValue);
SpeakerText.text = profile.Name;
PortraitImage.GetComponent<Image>().sprite = profile.Portrait;
break;
case layoutTag:
layoutAnimator.Play(tagValue);
break;
default:
Assert.Boolean(false, "Invalid tag: " + tag);
break; // Will never reach.
case speakerTag:
DialogueProfile profile = DialogueProfiles.Find(x => x.Name == tagValue);
Assert.Boolean(profile != null, "Invalid speaker: " + tagValue);
SpeakerText.text = profile.Name;
PortraitImage.GetComponent<Image>().sprite = profile.Portrait;
break;
case layoutTag:
layoutAnimator.Play(tagValue);
break;
default:
Assert.Boolean(false, "Invalid tag: " + tag);
break; // Will never reach.
}
}
}
Expand Down
40 changes: 20 additions & 20 deletions Assets/Scripts/Enemies/Boss/BossAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ private void Update()
{
switch (BossPhaseManager.CurrentPhase)
{
case BossPhaseManager.Phases.Ignoring:
anim.Play("Ignoring");
break;
case BossPhaseManager.Phases.Denial:
anim.Play("Denial");
break;
case BossPhaseManager.Phases.Anger:
anim.Play("Anger");
break;
case BossPhaseManager.Phases.Bargaining:
anim.Play("Bargaining");
break;
case BossPhaseManager.Phases.Depression:
anim.Play("Depression");
break;
case BossPhaseManager.Phases.Acceptance:
anim.Play("Acceptance");
break;
default:
break;
case BossPhaseManager.Phases.Ignoring:
anim.Play("Ignoring");
break;
case BossPhaseManager.Phases.Denial:
anim.Play("Denial");
break;
case BossPhaseManager.Phases.Anger:
anim.Play("Anger");
break;
case BossPhaseManager.Phases.Bargaining:
anim.Play("Bargaining");
break;
case BossPhaseManager.Phases.Depression:
anim.Play("Depression");
break;
case BossPhaseManager.Phases.Acceptance:
anim.Play("Acceptance");
break;
default:
break;
}
}
}
36 changes: 18 additions & 18 deletions Assets/Scripts/Enemies/Boss/BossDialogueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ private void SetInkJSONPhase()
{
switch (BossPhaseManager.CurrentPhase)
{
case BossPhaseManager.Phases.Ignoring:
InkJSON = IgnoringText;
break;
case BossPhaseManager.Phases.Denial:
InkJSON = DenialText;
break;
case BossPhaseManager.Phases.Anger:
InkJSON = AngerText;
break;
case BossPhaseManager.Phases.Bargaining:
InkJSON = BargainingText;
break;
case BossPhaseManager.Phases.Depression:
InkJSON = DepressionText;
break;
case BossPhaseManager.Phases.Acceptance:
InkJSON = AcceptanceText;
break;
case BossPhaseManager.Phases.Ignoring:
InkJSON = IgnoringText;
break;
case BossPhaseManager.Phases.Denial:
InkJSON = DenialText;
break;
case BossPhaseManager.Phases.Anger:
InkJSON = AngerText;
break;
case BossPhaseManager.Phases.Bargaining:
InkJSON = BargainingText;
break;
case BossPhaseManager.Phases.Depression:
InkJSON = DepressionText;
break;
case BossPhaseManager.Phases.Acceptance:
InkJSON = AcceptanceText;
break;
}
}
}
76 changes: 38 additions & 38 deletions Assets/Scripts/Enemies/Boss/BossPhaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ private void Update()
// Spawns bullets based off of boss phase
switch (CurrentPhase)
{
case Phases.Ignoring:
StartCoroutine(BossBullets.IgnoringPhase());
break;
case Phases.Denial:
StartCoroutine(BossBullets.IgnoringPhase());
BossBullets.DenialPhase();
break;
case Phases.Anger:
StartCoroutine(BossBullets.AngerPhase(Random.Range(-10, 6)));
break;
case Phases.Bargaining:
StartCoroutine(BossBullets.BargainingPhase());
break;
case Phases.Depression:
StartCoroutine(BossBullets.DepressionPhase());
BossBullets.DepressionPhaseSecondaryAttack();
break;
case Phases.Acceptance:
StartCoroutine(BossBullets.AcceptancePhase());
break;
case Phases.Ignoring:
StartCoroutine(BossBullets.IgnoringPhase());
break;
case Phases.Denial:
StartCoroutine(BossBullets.IgnoringPhase());
BossBullets.DenialPhase();
break;
case Phases.Anger:
StartCoroutine(BossBullets.AngerPhase(Random.Range(-10, 6)));
break;
case Phases.Bargaining:
StartCoroutine(BossBullets.BargainingPhase());
break;
case Phases.Depression:
StartCoroutine(BossBullets.DepressionPhase());
BossBullets.DepressionPhaseSecondaryAttack();
break;
case Phases.Acceptance:
StartCoroutine(BossBullets.AcceptancePhase());
break;
}
}

Expand All @@ -83,24 +83,24 @@ private void SetPhase(float healthChunck = 1500.0f, float addedEndHealth = 2500.

switch (phaseIndex)
{
case 5:
CurrentPhase = Phases.Ignoring;
break;
case 4:
CurrentPhase = Phases.Denial;
break;
case 3:
CurrentPhase = Phases.Anger;
break;
case 2:
CurrentPhase = Phases.Bargaining;
break;
case 1:
CurrentPhase = Phases.Depression;
break;
default:
CurrentPhase = Phases.Acceptance;
break;
case 5:
CurrentPhase = Phases.Ignoring;
break;
case 4:
CurrentPhase = Phases.Denial;
break;
case 3:
CurrentPhase = Phases.Anger;
break;
case 2:
CurrentPhase = Phases.Bargaining;
break;
case 1:
CurrentPhase = Phases.Depression;
break;
default:
CurrentPhase = Phases.Acceptance;
break;
}
}

Expand Down
Loading

0 comments on commit b8f0402

Please sign in to comment.