public void LevelSelectionControls(GameObject hit) { CardLevel card = hit.transform.gameObject.GetComponent <CardLevel>(); if (card != null && !menuUI.ACardInfoIsShown && !menuUI.IsACardMoving && !menuUI.IsACardInfoMoving && !menuUI.IsACardInfoMovingForShowing) { AudioManager.Instance.PlayOneShot(AudioManager.Instance.paperSelectSound, 0.5f); if (card.gameObject == menuUI.LevelCardSelected) { menuUI.LevelCardSelected.GetComponent <CardLevel>().IsSelected = false; menuManager.CardLevelSelected = -1; menuManager.DeckOfCardsSelected = string.Empty; if (menuManager.currentMiniature != null) { GameObject.Destroy(menuManager.currentMiniature.gameObject); } GameManager.Instance.ListEventSelected.Clear(); menuManager.SetActiveChatBoxes(false); menuUI.previousCardSelected = null; } else { menuUI.previousCardSelected = menuUI.LevelCardSelected; menuUI.LevelCardSelected = card.gameObject; menuUI.LevelCardSelected.GetComponent <CardLevel>().IsSelected = true; menuManager.CardLevelSelected = card.levelIndex; menuManager.DeckOfCardsSelected = Leveldb.GetLevelById(card.levelIndex).deckId; menuManager.currentMiniature = Instantiate(menuManager.prefabsMiniatures[card.levelIndex - 1], menuManager.trVortex.position + Vector3.up * 0.2f, Quaternion.identity).GetComponent <Miniature>(); menuManager.currentMiniature.bStartHidden = true; GameManager.Instance.ListEventSelected.Clear(); for (int i = 0; i < Leveldb.GetLevelById(card.levelIndex).listEventsId.Count; i++) { if (GameManager.Instance.PersistenceLoader.Pd.dicPersistenceEvents[Leveldb.GetLevelById(card.levelIndex).listEventsId[i]] == true) { GameManager.Instance.ListEventSelected.Add(Leveldb.GetLevelById(card.levelIndex).listEventsId[i]); } } menuManager.SetActiveChatBoxes(true); menuUI.IsACardMoving = true; } menuUI.UpdateDeckSelected(); menuUI.UpdateStartButton(); boxOpener.UpdateLockAspect(); } }
void UpdateCardLevelPositions() { carLevelfLerp += Time.unscaledDeltaTime * 3.5f; if (carLevelfLerp > 1) { carLevelfLerp = 1; } if (carLevelfLerp > (!menuManager.GoDeck.GetComponent <Deck>().IsOpen ? 0.4 : 0.4f) && !hasReachStepOne) { whereTheCardiS.Clear(); whereTheCardiSrotation.Clear(); for (int i = 0; i < menuManager.GoCardsLevels.Count; i++) { whereTheCardiS.Add(menuManager.GoCardsLevels[i].transform.position); whereTheCardiSrotation.Add(menuManager.GoCardsLevels[i].transform.rotation); } hasReachStepOne = true; carLevelfLerp = 0; index = 1; } if (carLevelfLerp > (!menuManager.GoDeck.GetComponent <Deck>().IsOpen? 0.5 : 0.95f) && !hasReachStepTwo && hasReachStepOne) { whereTheCardiS.Clear(); whereTheCardiSrotation.Clear(); for (int i = 0; i < menuManager.GoCardsLevels.Count; i++) { whereTheCardiS.Add(menuManager.GoCardsLevels[i].transform.localPosition); whereTheCardiSrotation.Add(menuManager.GoCardsLevels[i].transform.localRotation); } carLevelfLerp = 0; hasReachStepTwo = true; index = 2; if (menuManager.GoDeck.GetComponent <Deck>().IsOpen) { for (int i = 0; i < menuManager.GoCardsLevels.Count; i++) { GlowController.UnregisterObject(menuManager.GoCardsLevels[i].GetComponent <GlowObjectCmd>()); } menuManager.SetActiveChatBoxes(true); } else { for (int i = 0; i < menuManager.GoCardsLevels.Count; i++) { GlowController.RegisterObject(menuManager.GoCardsLevels[i].GetComponent <GlowObjectCmd>()); } menuManager.SetActiveChatBoxes(false); } } for (int i = 0; i < menuManager.GoCardsLevels.Count; i++) { if (!menuManager.GoDeck.GetComponent <Deck>().IsOpen) { if (menuManager.GoCardsLevels[i] != LevelCardSelected) { if (index == 2) { Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().bloomIntensity = 1f - (carLevelfLerp * 0.65f); Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().sepBlurSpread = 1.5f - (carLevelfLerp * 1.4f); } menuManager.GoCardsLevels[i].transform.position = Vector3.Lerp(whereTheCardiS[i], levelCardKeyPoses[i][index].v3Pos, carLevelfLerp); menuManager.GoCardsLevels[i].transform.rotation = Quaternion.Lerp(whereTheCardiSrotation[i], levelCardKeyPoses[i][index].quatRot, carLevelfLerp); } } else { if (menuManager.GoCardsLevels[i] != LevelCardSelected && menuManager.GoCardsLevels[i] != previousCardSelected) { menuManager.GoCardsLevels[i].transform.position = Vector3.Lerp(whereTheCardiS[i], levelCardKeyPoses[i][levelCardKeyPoses[i].Count - (index) - 1].v3Pos, carLevelfLerp); menuManager.GoCardsLevels[i].transform.rotation = Quaternion.Lerp(whereTheCardiSrotation[i], levelCardKeyPoses[i][levelCardKeyPoses[i].Count - (index) - 1].quatRot, carLevelfLerp); } else { if (previousCardSelected != null && menuManager.GoCardsLevels[i] == previousCardSelected && previousCardSelected.GetComponent <CardLevel>().IsSelected) { if (hasReachStepTwo) { previousCardSelected.transform.position = Vector3.Lerp(levelCardKeyPoses[0][1].v3Pos, levelCardKeyPoses[0][0].v3Pos, carLevelfLerp); previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardKeyPoses[0][1].quatRot, levelCardKeyPoses[0][0].quatRot, carLevelfLerp); } else if (hasReachStepOne) { previousCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition2.position, levelCardKeyPoses[0][1].v3Pos, carLevelfLerp); previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition2.rotation, levelCardKeyPoses[0][1].quatRot, carLevelfLerp); } else { previousCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition.position, levelCardSelectedPosition2.position, carLevelfLerp); previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition.rotation, levelCardSelectedPosition2.rotation, carLevelfLerp); } } } } } if (carLevelfLerp == 1) { menuManager.GoDeck.GetComponent <Deck>().IsOpen = !menuManager.GoDeck.GetComponent <Deck>().IsOpen; aCardIsShown = !aCardIsShown; box.UpdateLockAspect(); isACardMoving = false; carLevelfLerp = 0; index = 1; hasReachStepOne = false; hasReachStepTwo = false; } }