Switched to Direction enum
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
namespace Marro.PacManUdon
|
||||
{
|
||||
using UnityEngine;
|
||||
using VRC.Udon;
|
||||
|
||||
public enum PacManFruitType
|
||||
public enum PacManFruitType
|
||||
{
|
||||
None = -1,
|
||||
Cherries = 0,
|
||||
@@ -15,7 +16,7 @@ namespace Marro.PacManUdon
|
||||
Key = 7
|
||||
}
|
||||
|
||||
public enum PacManGameState
|
||||
public enum PacManGameState
|
||||
{
|
||||
AttractMode,
|
||||
AttractModeDemo,
|
||||
@@ -23,14 +24,14 @@ namespace Marro.PacManUdon
|
||||
InGame,
|
||||
}
|
||||
|
||||
public enum PacManGhostFrozenState
|
||||
public enum PacManGhostFrozenState
|
||||
{
|
||||
Frozen,
|
||||
FrozenIfNotCaught,
|
||||
NotFrozen
|
||||
}
|
||||
|
||||
public enum PacManTimeSequence
|
||||
public enum PacManTimeSequence
|
||||
{
|
||||
AttractScreenIntroduction,
|
||||
AttractScreenDemo,
|
||||
@@ -49,16 +50,77 @@ namespace Marro.PacManUdon
|
||||
Intermission3
|
||||
}
|
||||
|
||||
public static class PacManConstants
|
||||
public enum PacManTileType
|
||||
{
|
||||
Empty = -1,
|
||||
Wall = -2,
|
||||
}
|
||||
|
||||
public static class PacManConstants
|
||||
{
|
||||
// Jagged or 2D arrays can't be static so we work with 1D arrays
|
||||
public static int[] GetMazeDefinition() => new int[] {
|
||||
-02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02,
|
||||
-02, 216, 215, 214, 213, 212, 196, 195, 194, 193, 192, 191, 190, -02, -02, 178, 179, 180, 181, 182, 183, 152, 151, 150, 149, 148, 147, -02,
|
||||
-02, 217, -02, -02, -02, -02, 197, -02, -02, -02, -02, -02, 189, -02, -02, 177, -02, -02, -02, -02, -02, 153, -02, -02, -02, -02, 146, -02,
|
||||
-02, 003, -02, -01, -01, -02, 198, -02, -01, -01, -01, -02, 188, -02, -02, 176, -02, -01, -01, -01, -02, 154, -02, -01, -01, -02, 002, -02,
|
||||
-02, 218, -02, -02, -02, -02, 199, -02, -02, -02, -02, -02, 187, -02, -02, 175, -02, -02, -02, -02, -02, 155, -02, -02, -02, -02, 145, -02,
|
||||
-02, 219, 220, 221, 222, 223, 200, 201, 202, 203, 204, 205, 186, 185, 184, 174, 173, 172, 165, 164, 163, 156, 157, 158, 159, 160, 144, -02,
|
||||
-02, 224, -02, -02, -02, -02, 231, -02, -02, 206, -02, -02, -02, -02, -02, -02, -02, -02, 166, -02, -02, 161, -02, -02, -02, -02, 143, -02,
|
||||
-02, 225, -02, -02, -02, -02, 232, -02, -02, 207, -02, -02, -02, -02, -02, -02, -02, -02, 167, -02, -02, 162, -02, -02, -02, -02, 142, -02,
|
||||
-02, 226, 227, 228, 229, 230, 233, -02, -02, 208, 209, 210, 211, -02, -02, 171, 170, 169, 168, -02, -02, 136, 137, 138, 139, 140, 141, -02,
|
||||
-02, -02, -02, -02, -02, -02, 234, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, 134, -02, -02, -02, -02, -02, -02,
|
||||
-01, -01, -01, -01, -01, -02, 235, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, 133, -02, -01, -01, -01, -01, -01,
|
||||
-01, -01, -01, -01, -01, -02, 236, -02, -02, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -02, -02, 132, -02, -01, -01, -01, -01, -01,
|
||||
-01, -01, -01, -01, -01, -02, 237, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, 131, -02, -01, -01, -01, -01, -01,
|
||||
-02, -02, -02, -02, -02, -02, 238, -02, -02, -01, -02, -01, -01, -01, -01, -01, -01, -02, -01, -02, -02, 130, -02, -02, -02, -02, -02, -02,
|
||||
-01, -01, -01, -01, -01, -01, 239, -01, -01, -01, -02, -01, -01, -01, -01, -01, -01, -02, -01, -01, -01, 129, -01, -01, -01, -01, -01, -01,
|
||||
-02, -02, -02, -02, -02, -02, 240, -02, -02, -01, -02, -01, -01, -01, -01, -01, -01, -02, -01, -02, -02, 128, -02, -02, -02, -02, -02, -02,
|
||||
-01, -01, -01, -01, -01, -02, 241, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, 127, -02, -01, -01, -01, -01, -01,
|
||||
-01, -01, -01, -01, -01, -02, 242, -02, -02, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -02, -02, 126, -02, -01, -01, -01, -01, -01,
|
||||
-01, -01, -01, -01, -01, -02, 243, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, 125, -02, -01, -01, -01, -01, -01,
|
||||
-02, -02, -02, -02, -02, -02, 244, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, 124, -02, -02, -02, -02, -02, -02,
|
||||
-02, 086, 087, 088, 089, 090, 091, 094, 095, 096, 097, 098, 099, -02, -02, 104, 105, 106, 107, 108, 109, 110, 123, 122, 121, 120, 119, -02,
|
||||
-02, 085, -02, -02, -02, -02, 092, -02, -02, -02, -02, -02, 100, -02, -02, 103, -02, -02, -02, -02, -02, 111, -02, -02, -02, -02, 118, -02,
|
||||
-02, 084, -02, -02, -02, -02, 093, -02, -02, -02, -02, -02, 101, -02, -02, 102, -02, -02, -02, -02, -02, 112, -02, -02, -02, -02, 117, -02,
|
||||
-02, 000, 083, 082, -02, -02, 010, 009, 008, 007, 006, 005, 004, -01, -01, 063, 062, 061, 060, 059, 058, 057, -02, -02, 115, 116, 001, -02,
|
||||
-02, -02, -02, 081, -02, -02, 011, -02, -02, 079, -02, -02, -02, -02, -02, -02, -02, -02, 064, -02, -02, 056, -02, -02, 114, -02, -02, -02,
|
||||
-02, -02, -02, 080, -02, -02, 012, -02, -02, 078, -02, -02, -02, -02, -02, -02, -02, -02, 065, -02, -02, 055, -02, -02, 113, -02, -02, -02,
|
||||
-02, 018, 017, 016, 015, 014, 013, -02, -02, 077, 076, 075, 074, -02, -02, 069, 068, 067, 066, -02, -02, 054, 053, 052, 051, 050, 049, -02,
|
||||
-02, 019, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 073, -02, -02, 070, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 048, -02,
|
||||
-02, 020, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 072, -02, -02, 071, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 047, -02,
|
||||
-02, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, -02,
|
||||
-02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02,
|
||||
};
|
||||
|
||||
public static int[] GetPelletIndices() => new int[]
|
||||
{
|
||||
645, 670, 110, 085, 656, 655, 654, 653, 652, 651, 650, 678, 706, 734, 733, 732,
|
||||
731, 730, 729, 757, 785, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823,
|
||||
824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 810,
|
||||
782, 754, 753, 752, 751, 750, 749, 721, 693, 665, 664, 663, 662, 661, 660, 659,
|
||||
690, 718, 746, 745, 744, 743, 771, 799, 796, 768, 740, 739, 738, 737, 709, 681,
|
||||
703, 675, 647, 646, 617, 589, 561, 562, 563, 564, 565, 566, 594, 622, 567, 568,
|
||||
569, 570, 571, 572, 600, 628, 631, 603, 575, 576, 577, 578, 579, 580, 581, 609,
|
||||
637, 724, 696, 668, 669, 642, 614, 586, 585, 584, 583, 582, 553, 525, 497, 469,
|
||||
441, 413, 385, 357, 329, 301, 273, 245, 245, 246, 247, 248, 249, 250, 222, 194,
|
||||
166, 138, 082, 054, 053, 052, 051, 050, 049, 077, 105, 133, 161, 162, 163, 164,
|
||||
165, 189, 217, 160, 159, 158, 186, 214, 242, 241, 240, 239, 157, 156, 155, 127,
|
||||
099, 071, 043, 044, 045, 046, 047, 048, 154, 153, 152, 124, 096, 068, 040, 039,
|
||||
038, 037, 036, 035, 034, 062, 090, 118, 146, 147, 148, 149, 150, 151, 177, 205,
|
||||
233, 234, 235, 236, 033, 032, 031, 030, 029, 057, 113, 141, 142, 143, 144, 145,
|
||||
169, 197, 225, 226, 227, 228, 229, 174, 202, 230, 258, 286, 314, 342, 370, 398,
|
||||
426, 454, 482, 510, 538,
|
||||
};
|
||||
|
||||
public static GameObject[] ComponentsToGameObjects(Component[] components, bool skipFirstComponent = false)
|
||||
{
|
||||
if (skipFirstComponent)
|
||||
{
|
||||
GameObject[] gameObjects = new GameObject[components.Length-1];
|
||||
for (int i = 0; i < components.Length-1; i++)
|
||||
GameObject[] gameObjects = new GameObject[components.Length - 1];
|
||||
for (int i = 0; i < components.Length - 1; i++)
|
||||
{
|
||||
gameObjects[i] = components[i+1].gameObject;
|
||||
gameObjects[i] = components[i + 1].gameObject;
|
||||
}
|
||||
return gameObjects;
|
||||
}
|
||||
@@ -71,7 +133,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
return gameObjects;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static float GetPowerPelletBlinkToggleInterval()
|
||||
@@ -81,9 +143,9 @@ namespace Marro.PacManUdon
|
||||
|
||||
public static PacManFruitType GetFruitTypeForLevel(int level)
|
||||
{
|
||||
PacManFruitType[] FruitTypePerLevel = new PacManFruitType[]
|
||||
PacManFruitType[] FruitTypePerLevel = new PacManFruitType[]
|
||||
{
|
||||
PacManFruitType.Cherries,
|
||||
PacManFruitType.Cherries,
|
||||
PacManFruitType.Strawberry,
|
||||
PacManFruitType.Peach,
|
||||
PacManFruitType.Peach,
|
||||
@@ -97,15 +159,15 @@ namespace Marro.PacManUdon
|
||||
PacManFruitType.Bell,
|
||||
PacManFruitType.Key
|
||||
};
|
||||
if (level-1 < 0)
|
||||
if (level - 1 < 0)
|
||||
{
|
||||
return PacManFruitType.None;
|
||||
}
|
||||
if (level-1 >= FruitTypePerLevel.Length)
|
||||
if (level - 1 >= FruitTypePerLevel.Length)
|
||||
{
|
||||
return FruitTypePerLevel[FruitTypePerLevel.Length-1];
|
||||
return FruitTypePerLevel[FruitTypePerLevel.Length - 1];
|
||||
}
|
||||
return FruitTypePerLevel[level-1];
|
||||
return FruitTypePerLevel[level - 1];
|
||||
}
|
||||
|
||||
public static float GetGhostHomeSpeed()
|
||||
@@ -113,101 +175,101 @@ namespace Marro.PacManUdon
|
||||
return 3.5f;
|
||||
}
|
||||
|
||||
public static float GetPacManDefaultSpeedForLevel(int level)
|
||||
public static float GetPacManDefaultSpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 7.576f;
|
||||
if(level <= 4) return 8.523f;
|
||||
if(level <= 20) return 9.470f;
|
||||
return 8.523f;
|
||||
if (level <= 1) return 7.576f;
|
||||
if (level <= 4) return 8.523f;
|
||||
if (level <= 20) return 9.470f;
|
||||
return 8.523f;
|
||||
}
|
||||
|
||||
public static float GetPacManPowerPelletSpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 8.523f;
|
||||
if(level <= 4) return 8.996f;
|
||||
return 9.470f;
|
||||
if (level <= 1) return 8.523f;
|
||||
if (level <= 4) return 8.996f;
|
||||
return 9.470f;
|
||||
}
|
||||
|
||||
public static float GetGhostDefaultSpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 7.102f;
|
||||
if(level <= 4) return 8.049f;
|
||||
return 8.996f;
|
||||
if (level <= 1) return 7.102f;
|
||||
if (level <= 4) return 8.049f;
|
||||
return 8.996f;
|
||||
}
|
||||
|
||||
public static float GetGhostTunnelSpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 3.788f;
|
||||
if(level <= 4) return 4.261f;
|
||||
return 4.735f;
|
||||
if (level <= 1) return 3.788f;
|
||||
if (level <= 4) return 4.261f;
|
||||
return 4.735f;
|
||||
}
|
||||
|
||||
public static float GetBlinkyElroy1SpeedForLevel(int level)
|
||||
public static float GetBlinkyElroy1SpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 7.576f;
|
||||
if(level <= 4) return 8.523f;
|
||||
return 9.470f;
|
||||
if (level <= 1) return 7.576f;
|
||||
if (level <= 4) return 8.523f;
|
||||
return 9.470f;
|
||||
}
|
||||
|
||||
public static float GetBlinkyElroy2SpeedForLevel(int level)
|
||||
public static float GetBlinkyElroy2SpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 8.049f;
|
||||
if(level <= 4) return 8.996f;
|
||||
return 9.943f;
|
||||
if (level <= 1) return 8.049f;
|
||||
if (level <= 4) return 8.996f;
|
||||
return 9.943f;
|
||||
}
|
||||
|
||||
public static float GetGhostScaredSpeedForLevel(int level)
|
||||
public static float GetGhostScaredSpeedForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 4.735f;
|
||||
if(level <= 4) return 5.208f;
|
||||
return 5.682f;
|
||||
if (level <= 1) return 4.735f;
|
||||
if (level <= 4) return 5.208f;
|
||||
return 5.682f;
|
||||
}
|
||||
|
||||
public static int GetElroy1PelletsRemainingForLevel(int level)
|
||||
public static int GetElroy1PelletsRemainingForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 20;
|
||||
if(level <= 2) return 30;
|
||||
if(level <= 5) return 40;
|
||||
if(level <= 8) return 50;
|
||||
if(level <= 11) return 60;
|
||||
if(level <= 14) return 80;
|
||||
if(level <= 18) return 100;
|
||||
return 120;
|
||||
if (level <= 1) return 20;
|
||||
if (level <= 2) return 30;
|
||||
if (level <= 5) return 40;
|
||||
if (level <= 8) return 50;
|
||||
if (level <= 11) return 60;
|
||||
if (level <= 14) return 80;
|
||||
if (level <= 18) return 100;
|
||||
return 120;
|
||||
}
|
||||
|
||||
public static int GetElroy2PelletsRemainingForLevel(int level)
|
||||
public static int GetElroy2PelletsRemainingForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return 10;
|
||||
if(level <= 2) return 15;
|
||||
if(level <= 5) return 20;
|
||||
if(level <= 8) return 25;
|
||||
if(level <= 11) return 30;
|
||||
if(level <= 14) return 40;
|
||||
if(level <= 18) return 50;
|
||||
return 60;
|
||||
if (level <= 1) return 10;
|
||||
if (level <= 2) return 15;
|
||||
if (level <= 5) return 20;
|
||||
if (level <= 8) return 25;
|
||||
if (level <= 11) return 30;
|
||||
if (level <= 14) return 40;
|
||||
if (level <= 18) return 50;
|
||||
return 60;
|
||||
}
|
||||
|
||||
public static float GetGhostHousePelletTimeoutLimitForLevel(int level)
|
||||
{
|
||||
if(level <= 4) return 4;
|
||||
return 3;
|
||||
if (level <= 4) return 4;
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static int[] GetGhostHousePrivatePelletCounterLimitForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return new int[] { 0, 0, 30, 60};
|
||||
if(level <= 2) return new int[] { 0, 0, 0, 50};
|
||||
return new int[] { 0, 0, 0, 0};
|
||||
if (level <= 1) return new int[] { 0, 0, 30, 60 };
|
||||
if (level <= 2) return new int[] { 0, 0, 0, 50 };
|
||||
return new int[] { 0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
public static float[] GetScatterPatternForLevel(int level)
|
||||
public static float[] GetScatterPatternForLevel(int level)
|
||||
{
|
||||
if(level <= 1) return new float[] { 7, 27, 34, 54, 59, 79, 84 };
|
||||
if(level <= 4) return new float[] { 7, 27, 34, 54, 59, 1092, 1092.0166667f};
|
||||
return new float[] { 5, 25, 30, 50, 55, 1092, 1092.0166667f};
|
||||
if (level <= 1) return new float[] { 7, 27, 34, 54, 59, 79, 84 };
|
||||
if (level <= 4) return new float[] { 7, 27, 34, 54, 59, 1092, 1092.0166667f };
|
||||
return new float[] { 5, 25, 30, 50, 55, 1092, 1092.0166667f };
|
||||
}
|
||||
|
||||
public static float GetScaredDurationForLevel(int level)
|
||||
public static float GetScaredDurationForLevel(int level)
|
||||
{
|
||||
float[] scaredDurationPerLevel =
|
||||
{
|
||||
@@ -231,18 +293,18 @@ namespace Marro.PacManUdon
|
||||
1,
|
||||
0
|
||||
};
|
||||
if (level-1 < 0)
|
||||
if (level - 1 < 0)
|
||||
{
|
||||
return scaredDurationPerLevel[0];
|
||||
}
|
||||
if (level-1 >= scaredDurationPerLevel.Length)
|
||||
if (level - 1 >= scaredDurationPerLevel.Length)
|
||||
{
|
||||
return scaredDurationPerLevel[scaredDurationPerLevel.Length-1];
|
||||
return scaredDurationPerLevel[scaredDurationPerLevel.Length - 1];
|
||||
}
|
||||
return scaredDurationPerLevel[level-1];
|
||||
return scaredDurationPerLevel[level - 1];
|
||||
}
|
||||
|
||||
public static float GetScaredNumberOfFlashesForLevel(int level)
|
||||
public static float GetScaredNumberOfFlashesForLevel(int level)
|
||||
{
|
||||
int[] scaredNumberOfFlashesPerLevel = new int[]
|
||||
{
|
||||
@@ -266,19 +328,20 @@ namespace Marro.PacManUdon
|
||||
3,
|
||||
0
|
||||
};
|
||||
if (level-1 < 0)
|
||||
if (level - 1 < 0)
|
||||
{
|
||||
return scaredNumberOfFlashesPerLevel[0];
|
||||
}
|
||||
if (level-1 >= scaredNumberOfFlashesPerLevel.Length)
|
||||
if (level - 1 >= scaredNumberOfFlashesPerLevel.Length)
|
||||
{
|
||||
return scaredNumberOfFlashesPerLevel[scaredNumberOfFlashesPerLevel.Length-1];
|
||||
return scaredNumberOfFlashesPerLevel[scaredNumberOfFlashesPerLevel.Length - 1];
|
||||
}
|
||||
return scaredNumberOfFlashesPerLevel[level-1];
|
||||
return scaredNumberOfFlashesPerLevel[level - 1];
|
||||
}
|
||||
|
||||
public static int FruitTypeToValue(PacManFruitType fruitType) { // I can't get casting from enum to int to work so this is a workaround
|
||||
switch (fruitType)
|
||||
public static int FruitTypeToValue(PacManFruitType fruitType)
|
||||
{ // I can't get casting from enum to int to work so this is a workaround
|
||||
switch (fruitType)
|
||||
{
|
||||
default:
|
||||
case PacManFruitType.None:
|
||||
|
||||
Reference in New Issue
Block a user