/* EVENT HANDLERS */ private void OnMiniGameStepComplete(System.Type pType) { _updateMinigame = false; if (pType == typeof(MiniGameYoga)) { MiniGameYoga game = _currentGame as MiniGameYoga; bool isComplete = game.CheckGameComplete(); _debugText.text = string.Format("Step Complete: PASS"); if (isComplete) { Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, true); } else { game.fadedRT.DOScale(Vector3.zero, 0.35f).SetEase(Ease.InBack); game.scalingRT.DOScale(Vector3.zero, 0.35f * game.scalingRT.localScale.x / 1.0f).SetEase(Ease.InBack); DOTween.Sequence().InsertCallback(0.45f, () => { Destroy(game.scalingRT.gameObject); Destroy(game.fadedRT.gameObject); ShowNextInput(game.GetType()); }); } } }
private void ShowNextInput(System.Type pType) { if (pType == typeof(MiniGameYoga)) { MiniGameYoga game = _currentGame as MiniGameYoga; game.fadedRT = Instantiate(Resources.Load <GameObject>("Prefabs/Controller/" + game.CurrentControl.ToString()), Vector3.zero, Quaternion.identity, _inputActionPanel).GetComponent <RectTransform>(); game.scalingRT = Instantiate(Resources.Load <GameObject>("Prefabs/Controller/" + game.CurrentControl.ToString()), Vector3.zero, Quaternion.identity, _inputActionPanel).GetComponent <RectTransform>(); game.layoutElement = game.scalingRT.GetComponent <LayoutElement>(); game.layoutElement.ignoreLayout = true; game.fadedRT.localScale = Vector3.zero; game.scalingRT.gameObject.SetActive(false); StartCoroutine(DeepCopyLayout(game.scalingRT, game.fadedRT)); game.fadedImg = game.fadedRT.GetComponent <Image>(); game.fadedImg.SetAlpha(0.5f); game.fadedRT.DOScale(Vector3.one, 0.35f).SetEase(Ease.OutBack); DOTween.Sequence().InsertCallback(0.5f, () => { _updateMinigame = true; game.scalingRT.DOScale(Vector3.one, game.TimeToScale); }); } }
public MiniGame CreateMiniGame(Constants.GameType pType) { MiniGame m = null; switch (pType) { case Constants.GameType.Yoga: m = new MiniGameYoga(0, 10f); break; } return(m); }