public void Reset() { //GameGlobals.Instance.playerController.SetActive(true); //playerAnimator.Play("lookAround", 0, 0); if (ShopWindow.Instance != null) { ShopWindowCharacterItem selectedCharacter = ShopWindow.Instance.getSelectedCharacter(); if (selectedCharacter != null) { setCharacter(selectedCharacter.getPlayerClone()); } } playerX = 0; playerZ = 0; currentPosition = new Vector3(0, 0, 0); player.transform.position = new Vector3(0, 0, 0); startTime = Time.time; timeEplased = 0; // currentLevelSpeed = this.Accelerate(Time.time - startTime); trackIndex = 0; trackIndexTarget = 0; trackIndexPosition = trackIndex; trackSpacing = 6f; isRolling = false; isJumping = false; isGameOver = false; }
public void addCharacter(ShopWindowCharacterItem character) { if (characters == null) { characters = new List <ShopWindowCharacterItem>(); } characters.Add(character); }
public void selectCharacter(int characterID) { ShopWindowCharacterItem character = getCharacterItem(characterID); if (character == null) { return; } selectedCharacter = character; DialogWindow.Instance.showDialog(DialogWindow.DialogType.YesNo, "Are you sure you want to select this character ?", selectharacterDialogResult); }
public void buyCharacter(int characterID) { ShopWindowCharacterItem character = getCharacterItem(characterID); if (character == null) { return; } selectedCharacter = character; if (selectedCharacter.characterPrice > GameGlobals.Instance.achievements.totalCoins) { DialogWindow.Instance.showDialog(DialogWindow.DialogType.OkOnly, "No enough coins to buy this character", null); GameGlobals.Instance.audioController.playSound("UIError", false); return; } else { DialogWindow.Instance.showDialog(DialogWindow.DialogType.YesNo, "Are you sure you want to buy this character ?", buyCharacterDialogResult); } }
private void Awake() { // Singleton instance = this; shopWindowHolder.SetActive(false); // Loading Characters From Shop Window Component[] components = charactersContentHolder.transform.GetComponentsInChildren(typeof(ShopWindowCharacterItem), true); for (int i = 0; i < components.Length; i++) { ShopWindowCharacterItem currentCharacter = components[i] as ShopWindowCharacterItem; currentCharacter.characterID = i; if (PlayerPrefs.GetInt("character" + i.ToString() + "_unlocked", 0) == 1) { currentCharacter.unlocked = true; } addCharacter(currentCharacter); currentCharacter.onAdded(); } }