// Use this for initialization void Awake() { Ghost ghost = GhostDeserializer.Deserialize("Challenge" + GameController.gameType); Data data = DataDeserializer.Deserialize(); if (data.getShowGhost()) { positionsX = ghost.getGhostPlayerX(); positionsY = ghost.getGhostPlayerY(); positionsFlip = ghost.getGhostPlayerFlip(); positionsSpeed = ghost.getGhostPlayerSpeed(); } else { positionsX = new List <float>(); positionsY = new List <float>(); positionsFlip = new List <bool>(); positionsSpeed = new List <float>(); } animator = gameObject.GetComponent <Animator>(); spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); animationSkinList.Add(animationSkin1); animationSkinList.Add(animationSkin2); animationSkinList.Add(animationSkin3); animationSkinList.Add(animationSkin4); animationSkinList.Add(animationSkin5); animationSkinList.Add(animationSkin6); RuntimeAnimatorController controller = animationSkinList[ghost.getSelectedSkin() - 1]; GetComponent <Animator>().runtimeAnimatorController = controller as RuntimeAnimatorController; }
public void OnClickChallenge(int index) { switch (index) { case 1: GameController.gameType = index; if (GhostDeserializer.Deserialize("Challenge" + index).getGhostPlayerX().Count == 0) { SceneManager.LoadScene("Instructions"); } else { SceneManager.LoadScene("Challenge100"); } break; case 2: GameController.gameType = index; if (GhostDeserializer.Deserialize("Challenge" + index).getGhostPlayerX().Count == 0) { SceneManager.LoadScene("Instructions"); } else { SceneManager.LoadScene("Challenge100"); } break; case 3: GameController.gameType = index; if (GhostDeserializer.Deserialize("Challenge" + index).getGhostPlayerX().Count == 0) { SceneManager.LoadScene("Instructions"); } else { SceneManager.LoadScene("Challenge100"); } break; case 4: break; case 5: break; case 6: break; default: break; } }