// Update is called once per frame void Update() { if (timer <= 0 && !load) { CallLevelLoad.SetLevelLoad(Application.loadedLevel + 1, 1); load = true; } timer -= Time.deltaTime; }
// Update is called once per frame void Update() { #region Select Profile if (state == ProfileManagerState.SelectProfile) { for (int i = 0; i < newButtons.Length; i++) { if (newButtons[i].DetectClick()) { currentProfileIndex = i; state = ProfileManagerState.Moving; nextState = ProfileManagerState.CreateName; profiles[currentProfileIndex].CreateProfile(i); SetProfileBoardButtonActive(false); profileCamera.SetMove(); } } for (int i = 0; i < deleteButtons.Length; i++) { if (deleteButtons[i].DetectClick()) { profiles[i].DeleteProfile(i); SetProfileBoard(i); } } for (int i = 0; i < playButtons.Length; i++) { if (playButtons[i].DetectClick()) { currentProfile = profiles[i]; currentProfileIndex = i; PlayerPrefs.SetInt("CurrentProfile", i); CallLevelLoad.SetLevelLoad(3, .5f); } } } #endregion #region Create Name else if (state == ProfileManagerState.CreateName) { acceptButton.gameObject.SetActive(true); acceptButton.isActive = true; if (acceptButton.DetectClick()) { if (avatars == null) { // avatarParent = new GameObject(); avatars = LoadAvatars(); GameObject platforms = GameObject.Find("AvatarPlatforms"); for (int i = 0; i < avatars.Length; i++) { avatars[i] = (GameObject)GameObject.Instantiate(avatars[i], new Vector3(i * avatarOffset, 0, 0), Quaternion.identity); avatars[i].transform.parent = platforms.transform.FindChild(i.ToString()); } } state = ProfileManagerState.Moving; nextState = ProfileManagerState.SelectAvatar; profileCamera.SetMove(); acceptButton.gameObject.SetActive(false); } for (int i = 0; i < backButtons.Length; i++) { if (backButtons[i].DetectClick()) { profiles[i].DeleteProfile(i); SetProfileBoard(i); state = ProfileManagerState.Moving; nextState = ProfileManagerState.SelectProfile; profileCamera.SetMove(); SetProfileBoardButtonActive(true); acceptButton.gameObject.SetActive(false); } } } #endregion #region Select Avatar else if (state == ProfileManagerState.SelectAvatar) { acceptButton.gameObject.SetActive(true); if (acceptButton.DetectClick()) { profileCamera.SetZoomIn(); state = ProfileManagerState.Moving; nextState = ProfileManagerState.SelectOutfit; acceptButton.gameObject.SetActive(false); profiles[currentProfileIndex].AvatarType = (Profile.Avatar)profileCamera.selection; } } #endregion #region Select Outfit else if (state == ProfileManagerState.SelectOutfit) { acceptButton.gameObject.SetActive(true); if (acceptButton.DetectClick()) { profileCamera.SetZoomOut(); state = ProfileManagerState.Moving; nextState = ProfileManagerState.AvatarComplete; acceptButton.gameObject.SetActive(false); //profiles[currentProfileIndex].Outfit = } } #endregion #region Animation else if (state == ProfileManagerState.AvatarComplete) { if (!startedAnimation) { avatars[profileCamera.selection].transform.parent.animation.Play(); startedAnimation = true; } else { if (!avatars[profileCamera.selection].transform.parent.animation.isPlaying) { avatars[profileCamera.selection].transform.parent.gameObject.SetActive(false); state = ProfileManagerState.Moving; nextState = ProfileManagerState.SelectCrew; acceptButton.gameObject.SetActive(false); SetCrewButtonActive(true); crewButtons[profileCamera.selection].isActive = false; profileCamera.SetMove(); } } } #endregion #region Select Crew else if (state == ProfileManagerState.SelectCrew) { for (int i = 0; i < crewButtons.Length; i++) { if (crewButtons[i].DetectClick()) { if (avatars[i].transform.parent.position.y == .5f) { avatars[i].transform.parent.position = new Vector3(avatars[i].transform.parent.position.x, -.5f, avatars[i].transform.parent.position.z); RemoveCrewMember(i); crewMembersSelected--; } else if (crewMembersSelected < 3 && avatars[i].transform.parent.position.y == -.5f) { avatars[i].transform.parent.position = new Vector3(avatars[i].transform.parent.position.x, .5f, avatars[i].transform.parent.position.z); AddCrewMember(i, crewMembersSelected); crewMembersSelected++; } } } if (crewMembersSelected == 3) { acceptButton.gameObject.SetActive(true); } else { acceptButton.gameObject.SetActive(false); } if (acceptButton.DetectClick()) { SetCrewButtonActive(false); state = ProfileManagerState.Moving; nextState = ProfileManagerState.SelectProfile; profileCamera.SetMove(); acceptButton.gameObject.SetActive(false); profiles[currentProfileIndex].Crew = crew; profiles[currentProfileIndex].SaveProfile(); SetProfileBoard(currentProfileIndex); SetProfileBoardButtonActive(true); for (int i = 0; i < crew.Length; i++) { Debug.Log(crew[i]); } } } #endregion }