void Awake() { InitPlayerTags(); InitPlayerIndex(); InitPlayerSettings(); m_DefaultPalette = m_InitialPalette; m_CurrentPalette = m_DefaultPalette; InitPalette(); GameManager.Instance.RegisterPlayer(gameObject); #if DEBUG_DISPLAY || UNITY_EDITOR PlayerAnimationHelper.CheckAnimationsNaming(gameObject); #endif }
public void SetPalette(EPalette Palette) { switch (Palette) { case EPalette.Gray: this.SetPalette(Color.White, Color.Black, (int)byte.MaxValue); break; case EPalette.Rainbow: Color[] Colors = new Color[160]; int num = 0; foreach (Color color in this.CreatePalette(Color.Purple, Color.Blue, 32)) { Colors[num++] = color; } foreach (Color color in this.CreatePalette(Color.Blue, Color.FromArgb(0, 128, (int)byte.MaxValue), 16)) { Colors[num++] = color; } Color color1 = Color.FromArgb(0, 200, 0); foreach (Color color2 in this.CreatePalette(Color.FromArgb(0, 128, (int)byte.MaxValue), color1, 16)) { Colors[num++] = color2; } foreach (Color color2 in this.CreatePalette(color1, Color.Yellow, 32)) { Colors[num++] = color2; } foreach (Color color2 in this.CreatePalette(Color.Yellow, Color.Orange, 32)) { Colors[num++] = color2; } foreach (Color color2 in this.CreatePalette(Color.Orange, Color.Red, 32)) { Colors[num++] = color2; } this.SetPalette(Colors, 160); break; } }
public void SetPalette(EPalette Palette) { switch (Palette) { case EPalette.Gray: this.SetPalette(Color.White, Color.Black, (int)byte.MaxValue); break; case EPalette.Rainbow: Color[] Colors = new Color[160]; int num = 0; foreach (Color color in this.CreatePalette(Color.Purple, Color.Blue, 32)) Colors[num++] = color; foreach (Color color in this.CreatePalette(Color.Blue, Color.FromArgb(0, 128, (int) byte.MaxValue), 16)) Colors[num++] = color; Color color1 = Color.FromArgb(0, 200, 0); foreach (Color color2 in this.CreatePalette(Color.FromArgb(0, 128, (int) byte.MaxValue), color1, 16)) Colors[num++] = color2; foreach (Color color2 in this.CreatePalette(color1, Color.Yellow, 32)) Colors[num++] = color2; foreach (Color color2 in this.CreatePalette(Color.Yellow, Color.Orange, 32)) Colors[num++] = color2; foreach (Color color2 in this.CreatePalette(Color.Orange, Color.Red, 32)) Colors[num++] = color2; this.SetPalette(Colors, 160); break; } }
public void SetDefaultAndCurrentPalette(EPalette palette) { m_DefaultPalette = palette; SetCurrentPalette(palette); }
public void ResetCurrentPalette() { m_CurrentPalette = m_DefaultPalette; InitPalette(); }
public void SetCurrentPalette(EPalette palette) { m_CurrentPalette = palette; InitPalette(); }
public void ResetDefaultAndCurrentPalette() { m_DefaultPalette = m_InitialPalette; ResetCurrentPalette(); }
/// <summary> /// LoadPalette /// ----------- /// Loads the palette from preset palette /// </summary> private byte[] LoadPalette(EPalette palette) { byte[] q1palette; byte[] q2palette; byte[] h2palette; #region Quake1 Palette q1palette = new byte[768] { 000, 000, 000, 015, 015, 015, 031, 031, 031, 047, 047, 047, 063, 063, 063, 075, 075, 075, 091, 091, 091, 107, 107, 107, 123, 123, 123, 139, 139, 139, 155, 155, 155, 171, 171, 171, 187, 187, 187, 203, 203, 203, 219, 219, 219, 235, 235, 235, 015, 011, 007, 023, 015, 011, 031, 023, 011, 039, 027, 015, 047, 035, 019, 055, 043, 023, 063, 047, 023, 075, 055, 027, 083, 059, 027, 091, 067, 031, 099, 075, 031, 107, 083, 031, 115, 087, 031, 123, 095, 035, 131, 103, 035, 143, 111, 035, 011, 011, 015, 019, 019, 027, 027, 027, 039, 039, 039, 051, 047, 047, 063, 055, 055, 075, 063, 063, 087, 071, 071, 103, 079, 079, 115, 091, 091, 127, 099, 099, 139, 107, 107, 151, 115, 115, 163, 123, 123, 175, 131, 131, 187, 139, 139, 203, 000, 000, 000, 007, 007, 000, 011, 011, 000, 019, 019, 000, 027, 027, 000, 035, 035, 000, 043, 043, 007, 047, 047, 007, 055, 055, 007, 063, 063, 007, 071, 071, 007, 075, 075, 011, 083, 083, 011, 091, 091, 011, 099, 099, 011, 107, 107, 015, 007, 000, 000, 015, 000, 000, 023, 000, 000, 031, 000, 000, 039, 000, 000, 047, 000, 000, 055, 000, 000, 063, 000, 000, 071, 000, 000, 079, 000, 000, 087, 000, 000, 095, 000, 000, 103, 000, 000, 111, 000, 000, 119, 000, 000, 127, 000, 000, 019, 019, 000, 027, 027, 000, 035, 035, 000, 047, 043, 000, 055, 047, 000, 067, 055, 000, 075, 059, 007, 087, 067, 007, 095, 071, 007, 107, 075, 011, 119, 083, 015, 131, 087, 019, 139, 091, 019, 151, 095, 027, 163, 099, 031, 175, 103, 035, 035, 019, 007, 047, 023, 011, 059, 031, 015, 075, 035, 019, 087, 043, 023, 099, 047, 031, 115, 055, 035, 127, 059, 043, 143, 067, 051, 159, 079, 051, 175, 099, 047, 191, 119, 047, 207, 143, 043, 223, 171, 039, 239, 203, 031, 255, 243, 027, 011, 007, 000, 027, 019, 000, 043, 035, 015, 055, 043, 019, 071, 051, 027, 083, 055, 035, 099, 063, 043, 111, 071, 051, 127, 083, 063, 139, 095, 071, 155, 107, 083, 167, 123, 095, 183, 135, 107, 195, 147, 123, 211, 163, 139, 227, 179, 151, 171, 139, 163, 159, 127, 151, 147, 115, 135, 139, 103, 123, 127, 091, 111, 119, 083, 099, 107, 075, 087, 095, 063, 075, 087, 055, 067, 075, 047, 055, 067, 039, 047, 055, 031, 035, 043, 023, 027, 035, 019, 019, 023, 011, 011, 015, 007, 007, 187, 115, 159, 175, 107, 143, 163, 095, 131, 151, 087, 119, 139, 079, 107, 127, 075, 095, 115, 067, 083, 107, 059, 075, 095, 051, 063, 083, 043, 055, 071, 035, 043, 059, 031, 035, 047, 023, 027, 035, 019, 019, 023, 011, 011, 015, 007, 007, 219, 195, 187, 203, 179, 167, 191, 163, 155, 175, 151, 139, 163, 135, 123, 151, 123, 111, 135, 111, 095, 123, 099, 083, 107, 087, 071, 095, 075, 059, 083, 063, 051, 067, 051, 039, 055, 043, 031, 039, 031, 023, 027, 019, 015, 015, 011, 007, 111, 131, 123, 103, 123, 111, 095, 115, 103, 087, 107, 095, 079, 099, 087, 071, 091, 079, 063, 083, 071, 055, 075, 063, 047, 067, 055, 043, 059, 047, 035, 051, 039, 031, 043, 031, 023, 035, 023, 015, 027, 019, 011, 019, 011, 007, 011, 007, 255, 243, 027, 239, 223, 023, 219, 203, 019, 203, 183, 015, 187, 167, 015, 171, 151, 011, 155, 131, 007, 139, 115, 007, 123, 099, 007, 107, 083, 000, 091, 071, 000, 075, 055, 000, 059, 043, 000, 043, 031, 000, 027, 015, 000, 011, 007, 000, 000, 000, 255, 011, 011, 239, 019, 019, 223, 027, 027, 207, 035, 035, 191, 043, 043, 175, 047, 047, 159, 047, 047, 143, 047, 047, 127, 047, 047, 111, 047, 047, 095, 043, 043, 079, 035, 035, 063, 027, 027, 047, 019, 019, 031, 011, 011, 015, 043, 000, 000, 059, 000, 000, 075, 007, 000, 095, 007, 000, 111, 015, 000, 127, 023, 007, 147, 031, 007, 163, 039, 011, 183, 051, 015, 195, 075, 027, 207, 099, 043, 219, 127, 059, 227, 151, 079, 231, 171, 095, 239, 191, 119, 247, 211, 139, 167, 123, 059, 183, 155, 055, 199, 195, 055, 231, 227, 087, 127, 191, 255, 171, 231, 255, 215, 255, 255, 103, 000, 000, 139, 000, 000, 179, 000, 000, 215, 000, 000, 255, 000, 000, 255, 243, 147, 255, 247, 199, 255, 255, 255, 159, 091, 083 }; #endregion #region Quake2 Palette q2palette = new byte[768] { 000, 000, 000, 015, 015, 015, 031, 031, 031, 047, 047, 047, 063, 063, 063, 075, 075, 075, 091, 091, 091, 107, 107, 107, 123, 123, 123, 139, 139, 139, 155, 155, 155, 171, 171, 171, 187, 187, 187, 203, 203, 203, 219, 219, 219, 235, 235, 235, 099, 075, 035, 091, 067, 031, 083, 063, 031, 079, 059, 027, 071, 055, 027, 063, 047, 023, 059, 043, 023, 051, 039, 019, 047, 035, 019, 043, 031, 019, 039, 027, 015, 035, 023, 015, 027, 019, 011, 023, 015, 011, 019, 015, 007, 015, 011, 007, 095, 095, 111, 091, 091, 103, 091, 083, 095, 087, 079, 091, 083, 075, 083, 079, 071, 075, 071, 063, 067, 063, 059, 059, 059, 055, 055, 051, 047, 047, 047, 043, 043, 039, 039, 039, 035, 035, 035, 027, 027, 027, 023, 023, 023, 019, 019, 019, 143, 119, 083, 123, 099, 067, 115, 091, 059, 103, 079, 047, 207, 151, 075, 167, 123, 059, 139, 103, 047, 111, 083, 039, 235, 159, 039, 203, 139, 035, 175, 119, 031, 147, 099, 027, 119, 079, 023, 091, 059, 015, 063, 039, 011, 035, 023, 007, 167, 059, 043, 159, 047, 035, 151, 043, 027, 139, 039, 019, 127, 031, 015, 115, 023, 011, 103, 023, 007, 087, 019, 000, 075, 015, 000, 067, 015, 000, 059, 015, 000, 051, 011, 000, 043, 011, 000, 035, 011, 000, 027, 007, 000, 019, 007, 000, 123, 095, 075, 115, 087, 067, 107, 083, 063, 103, 079, 059, 095, 071, 055, 087, 067, 051, 083, 063, 047, 075, 055, 043, 067, 051, 039, 063, 047, 035, 055, 039, 027, 047, 035, 023, 039, 027, 019, 031, 023, 015, 023, 015, 011, 015, 011, 007, 111, 059, 023, 095, 055, 023, 083, 047, 023, 067, 043, 023, 055, 035, 019, 039, 027, 015, 027, 019, 011, 015, 011, 007, 179, 091, 079, 191, 123, 111, 203, 155, 147, 215, 187, 183, 203, 215, 223, 179, 199, 211, 159, 183, 195, 135, 167, 183, 115, 151, 167, 091, 135, 155, 071, 119, 139, 047, 103, 127, 023, 083, 111, 019, 075, 103, 015, 067, 091, 011, 063, 083, 007, 055, 075, 007, 047, 063, 007, 039, 051, 000, 031, 043, 000, 023, 031, 000, 015, 019, 000, 007, 011, 000, 000, 000, 139, 087, 087, 131, 079, 079, 123, 071, 071, 115, 067, 067, 107, 059, 059, 099, 051, 051, 091, 047, 047, 087, 043, 043, 075, 035, 035, 063, 031, 031, 051, 027, 027, 043, 019, 019, 031, 015, 015, 019, 011, 011, 011, 007, 007, 000, 000, 000, 151, 159, 123, 143, 151, 115, 135, 139, 107, 127, 131, 099, 119, 123, 095, 115, 115, 087, 107, 107, 079, 099, 099, 071, 091, 091, 067, 079, 079, 059, 067, 067, 051, 055, 055, 043, 047, 047, 035, 035, 035, 027, 023, 023, 019, 015, 015, 011, 159, 075, 063, 147, 067, 055, 139, 059, 047, 127, 055, 039, 119, 047, 035, 107, 043, 027, 099, 035, 023, 087, 031, 019, 079, 027, 015, 067, 023, 011, 055, 019, 011, 043, 015, 007, 031, 011, 007, 023, 007, 000, 011, 000, 000, 000, 000, 000, 119, 123, 207, 111, 115, 195, 103, 107, 183, 099, 099, 167, 091, 091, 155, 083, 087, 143, 075, 079, 127, 071, 071, 115, 063, 063, 103, 055, 055, 087, 047, 047, 075, 039, 039, 063, 035, 031, 047, 027, 023, 035, 019, 015, 023, 011, 007, 007, 155, 171, 123, 143, 159, 111, 135, 151, 099, 123, 139, 087, 115, 131, 075, 103, 119, 067, 095, 111, 059, 087, 103, 051, 075, 091, 039, 063, 079, 027, 055, 067, 019, 047, 059, 011, 035, 047, 007, 027, 035, 000, 019, 023, 000, 011, 015, 000, 000, 255, 000, 035, 231, 015, 063, 211, 027, 083, 187, 039, 095, 167, 047, 095, 143, 051, 095, 123, 051, 255, 255, 255, 255, 255, 211, 255, 255, 167, 255, 255, 127, 255, 255, 083, 255, 255, 039, 255, 235, 031, 255, 215, 023, 255, 191, 015, 255, 171, 007, 255, 147, 000, 239, 127, 000, 227, 107, 000, 211, 087, 000, 199, 071, 000, 183, 059, 000, 171, 043, 000, 155, 031, 000, 143, 023, 000, 127, 015, 000, 115, 007, 000, 095, 000, 000, 071, 000, 000, 047, 000, 000, 027, 000, 000, 239, 000, 000, 055, 055, 255, 255, 000, 000, 000, 000, 255, 043, 043, 035, 027, 027, 023, 019, 019, 015, 235, 151, 127, 195, 115, 083, 159, 087, 051, 123, 063, 027, 235, 211, 199, 199, 171, 155, 167, 139, 119, 135, 107, 087, 159, 091, 083 }; #endregion #region Hexen2 Palette h2palette = new byte[768] { 000, 000, 000, 000, 000, 000, 008, 008, 008, 016, 016, 016, 024, 024, 024, 032, 032, 032, 040, 040, 040, 048, 048, 048, 056, 056, 056, 064, 064, 064, 072, 072, 072, 080, 080, 080, 084, 084, 084, 088, 088, 088, 096, 096, 096, 104, 104, 104, 112, 112, 112, 120, 120, 120, 128, 128, 128, 136, 136, 136, 148, 148, 148, 156, 156, 156, 168, 168, 168, 180, 180, 180, 184, 184, 184, 196, 196, 196, 204, 204, 204, 212, 212, 212, 224, 224, 224, 232, 232, 232, 240, 240, 240, 252, 252, 252, 008, 008, 012, 016, 016, 020, 024, 024, 028, 028, 032, 036, 036, 036, 044, 044, 044, 052, 048, 052, 060, 056, 056, 068, 064, 064, 072, 076, 076, 088, 092, 092, 104, 108, 112, 128, 128, 132, 152, 152, 156, 176, 168, 172, 196, 188, 196, 220, 032, 024, 020, 040, 032, 028, 048, 036, 032, 052, 044, 040, 060, 052, 044, 068, 056, 052, 076, 064, 056, 084, 072, 064, 092, 076, 072, 100, 084, 076, 108, 092, 084, 112, 096, 088, 120, 104, 096, 128, 112, 100, 136, 116, 108, 144, 124, 112, 020, 024, 020, 028, 032, 028, 032, 036, 032, 040, 044, 040, 044, 048, 044, 048, 056, 048, 056, 064, 056, 064, 068, 064, 068, 076, 068, 084, 092, 084, 104, 112, 104, 120, 128, 120, 140, 148, 136, 156, 164, 152, 172, 180, 168, 188, 196, 184, 048, 032, 008, 060, 040, 008, 072, 048, 016, 084, 056, 020, 092, 064, 028, 100, 072, 036, 108, 080, 044, 120, 092, 052, 136, 104, 060, 148, 116, 072, 160, 128, 084, 168, 136, 092, 180, 144, 100, 188, 152, 108, 196, 160, 116, 204, 168, 124, 016, 020, 016, 020, 028, 020, 024, 032, 024, 028, 036, 028, 032, 044, 032, 036, 048, 036, 040, 056, 040, 044, 060, 044, 048, 068, 048, 052, 076, 052, 060, 084, 060, 068, 092, 064, 076, 100, 072, 084, 108, 076, 092, 116, 084, 100, 128, 092, 024, 012, 008, 032, 016, 008, 040, 020, 008, 052, 024, 012, 060, 028, 012, 068, 032, 012, 076, 036, 016, 084, 044, 020, 092, 048, 024, 100, 056, 028, 112, 064, 032, 120, 072, 036, 128, 080, 044, 144, 092, 056, 168, 112, 072, 192, 132, 088, 024, 004, 004, 036, 004, 004, 048, 000, 000, 060, 000, 000, 068, 000, 000, 080, 000, 000, 088, 000, 000, 100, 000, 000, 112, 000, 000, 132, 000, 000, 152, 000, 000, 172, 000, 000, 192, 000, 000, 212, 000, 000, 232, 000, 000, 252, 000, 000, 016, 012, 032, 028, 020, 048, 032, 028, 056, 040, 036, 068, 052, 044, 080, 060, 056, 092, 068, 064, 104, 080, 072, 116, 088, 084, 128, 100, 096, 140, 108, 108, 152, 120, 116, 164, 132, 132, 176, 144, 144, 188, 156, 156, 200, 172, 172, 212, 036, 020, 004, 052, 024, 004, 068, 032, 004, 080, 040, 000, 100, 048, 004, 124, 060, 004, 140, 072, 004, 156, 088, 008, 172, 100, 008, 188, 116, 012, 204, 128, 012, 220, 144, 016, 236, 160, 020, 252, 184, 056, 248, 200, 080, 248, 220, 120, 020, 016, 004, 028, 024, 008, 036, 032, 008, 044, 040, 012, 052, 048, 016, 056, 056, 016, 064, 064, 020, 068, 072, 024, 072, 080, 028, 080, 092, 032, 084, 104, 040, 088, 116, 044, 092, 128, 052, 092, 140, 052, 092, 148, 056, 096, 160, 064, 060, 016, 016, 072, 024, 024, 084, 028, 028, 100, 036, 036, 112, 044, 044, 124, 052, 048, 140, 064, 056, 152, 076, 064, 044, 020, 008, 056, 028, 012, 072, 032, 016, 084, 040, 020, 096, 044, 028, 112, 052, 032, 124, 056, 040, 140, 064, 048, 024, 020, 016, 036, 028, 020, 044, 036, 028, 056, 044, 032, 064, 052, 036, 072, 060, 044, 080, 068, 048, 092, 076, 052, 100, 084, 060, 112, 092, 068, 120, 100, 072, 132, 112, 080, 144, 120, 088, 152, 128, 096, 160, 136, 104, 168, 148, 112, 036, 024, 012, 044, 032, 016, 052, 040, 020, 060, 044, 020, 072, 052, 024, 080, 060, 028, 088, 068, 028, 104, 076, 032, 148, 096, 056, 160, 108, 064, 172, 116, 072, 180, 124, 080, 192, 132, 088, 204, 140, 092, 216, 156, 108, 060, 020, 092, 100, 036, 116, 168, 072, 164, 204, 108, 192, 004, 084, 004, 004, 132, 004, 000, 180, 000, 000, 216, 000, 004, 004, 144, 016, 068, 204, 036, 132, 224, 088, 168, 232, 216, 004, 004, 244, 072, 000, 252, 128, 000, 252, 172, 024, 252, 252, 252 }; #endregion if (palette == EPalette.Quake1) return q1palette; else if (palette == EPalette.Quake2) return q2palette; else if (palette == EPalette.Hexen2) return h2palette; return null; }