public void FadeInBackLayOnLoad() { if (doFadeInBackLayOnLoad) { BackLay.gameObject.ValueTo(EGTween.Hash("From", 0F, "To", 0.5F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate")); } }
/// <summary> /// Fades the out backlay on destroy. /// </summary> public void FadeOutBacklayOnDestroy() { if (doFadeOutBacklayOnDestroy) { BackLay.gameObject.ValueTo(EGTween.Hash("From", 0.5F, "To", 0F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate", "onupdatetarget", gameObject)); } }
public void OnWindowRemove() { if ((doAnimateOnDestroy && (WindowContent != null))) { WindowContent.MoveTo(EGTween.Hash("x", 600F, "easeType", EGTween.EaseType.easeInBack, "time", TransitionDuration, "islocal", true, "ignoretimescale", true)); if (doFadeOutBacklayOnDestroy) { BackLay.gameObject.ValueTo(EGTween.Hash("From", TransitionDuration, "To", 0F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate", "ignoretimescale", true)); } Invoke("OnRemoveTransitionComplete", 0.5F); } else { if (doFadeOutBacklayOnDestroy) { BackLay.gameObject.ValueTo(EGTween.Hash("From", TransitionDuration, "To", 0F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate")); Invoke("OnRemoveTransitionComplete", 0.5F); } else { OnRemoveTransitionComplete(); } } }
void OnEnable() { GamePlay.instance.StopCoroutine("LoseTime"); BGMusicController.instance.StopBGMusic(); GameController.instance.isGamePaused = true; EGTween.Pause(GamePlay.instance.gameObject, true); }
void OnDisable() { GamePlay.instance.StartCoroutine("LoseTime"); BGMusicController.instance.StartBGMusic(); EGTween.Resume(GamePlay.instance.gameObject, true); GameController.instance.isGamePaused = false; }
public void StophandAnimation() { if (handImage.gameObject.activeSelf) { EGTween.Stop(handImage.gameObject); handImage.gameObject.SetActive(false); } }
public void AnimateWindowOnLoad() { if (doAnimateOnLoad && (WindowContent != null)) { WindowContent.MoveFrom(EGTween.Hash("x", 600, "easeType", EGTween.EaseType.easeOutBack, "time", TransitionDuration, "islocal", true)); } FadeInBackLayOnLoad(); }
public void AnimateWindowOnDestroy() { if (doAnimateOnDestroy && (WindowContent != null)) { WindowContent.MoveTo(EGTween.Hash("x", -600F, "easeType", EGTween.EaseType.easeInBack, "time", TransitionDuration, "islocal", true)); } FadeOutBacklayOnDestroy(); }
/// <summary> /// Raises the end drag event. /// </summary> /// <param name="eventData">Event data.</param> public virtual void OnEndDrag(PointerEventData eventData) { Vector2 points = btnToggleGraphics.rectTransform.anchoredPosition; points [0] = Mathf.Clamp(points.x, -(Mathf.Abs(btnToggleGraphicsPosition.x)), (Mathf.Abs(btnToggleGraphicsPosition.x))); btnToggleGraphics.rectTransform.anchoredPosition = points; bool toggleStatus = (points.x < 0F) ? false : true; EGTween.MoveTo(btnToggleGraphics.gameObject, EGTween.Hash("x", (toggleStatus ? (Mathf.Abs(btnToggleGraphicsPosition.x)) : -(Mathf.Abs(btnToggleGraphicsPosition.x))), "isLocal", true, "time", 0.5F, "easeType", EGTween.EaseType.easeOutExpo)); OnToggleStatusChanged(toggleStatus); }
/// <summary> /// This will execute on the time of screen spawn. /// </summary> public void OnWindowAdded() { if (doAnimateOnLoad && (WindowContent != null)) { WindowContent.MoveFrom(EGTween.Hash("x", -600, "easeType", EGTween.EaseType.easeOutBack, "time", TransitionDuration, "islocal", true, "ignoretimescale", true)); } if (doFadeInBackLayOnLoad) { BackLay.gameObject.ValueTo(EGTween.Hash("From", 0, "To", 0.7F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate", "onupdatetarget", gameObject, "ignoretimescale", true)); } }
IEnumerator LoadGameOver(string reason) { txtGameOverReason.text = reason.ToString(); txtGameOverReason.transform.parent.gameObject.ScaleTo(EGTween.Hash("X", 1, "Y", 1, "Z", 1, "Time", 0.7F)); yield return(new WaitForSeconds(2F)); txtGameOverReason.transform.parent.gameObject.ScaleTo(EGTween.Hash("X", 0, "Y", 0, "Z", 0, "Time", 0.7F)); yield return(new WaitForSeconds(0.4F)); GameController.instance.SpawnUIScreen("GameOver", true).GetComponent <GameOver> ().setScore(GamePlayMode, Score, BestScore, reason); AudioManager.instance.PlayOneShotClip(SFX_GameOver); }
public void TogglePauseGame(bool paused) { isGamePaused = paused; if (GamePlayMode == GameMode.timer) { if (isGamePaused) { EGTween.Pause(gameObject); } else { EGTween.Resume(gameObject); } } }
/// <summary> /// Sets the timer For Bar Progress /// this method will set and reset the timer on clearing row and column /// </summary> /// <param name="timerToIncrease">Timer to increase.</param> public void SetTimer(int timerToIncrease = 0) { if (GamePlayMode == GameMode.timer) { EGTween.Stop(gameObject); TimerValue = TimerValue + timerToIncrease; TimerValue = Mathf.Clamp(TimerValue, 0, TotalTimerValue); float currentBarProgress = ((float)TimerValue / (float)TotalTimerValue) * 100F; float barFillValue = (555.0F / (100 / currentBarProgress)); Timer.sizeDelta = new Vector2(barFillValue, Timer.sizeDelta.y); EGTween.ValueTo(gameObject, EGTween.Hash("from", (float)Timer.sizeDelta.x, "to", 0.0f, "time", TimerValue, "onUpdate", "BarProgress", "onComplete", "OnBarCompelete", "onCompleteTarget", gameObject)); } }
/// <summary> /// Starts the game. /// </summary> public void startGame() { int placedBlocks = 0; if (GameDataManager.instance.isHelpRunning == 0) { //OnPlacingBlock (); // string suggestedblock1 = GameController.instance.GameDoc.Root.Element("suggestedObject1").Attribute("objectName").Value; // string suggestedblock2 = GameController.instance.GameDoc.Root.Element("suggestedObject2").Attribute("objectName").Value; // string suggestedblock3 = GameController.instance.GameDoc.Root.Element("suggestedObject3").Attribute("objectName").Value; // // Debug.Log (suggestedblock1 + " : " + suggestedblock2 + " : " + suggestedblock3); for (int i = 0; i < 3; i++) { GameObject obj = null; string ObjectName = GameDataManager.instance.GameDoc.Root.Element("suggestedObject" + (i + 1)).Attribute("objectName").Value; ObjectName = ObjectName.Replace("(Clone)", ""); int index = blockList.FindIndex(o => o.name == ObjectName); if (index != -1) { //index = ProbabilityPool [UnityEngine.Random.Range (0, ProbabilityPool.Count)]; obj = (GameObject)Instantiate(blockList [index].gameObject); obj.transform.SetParent(blockContainer.GetChild(i).transform); obj.GetComponent <RectTransform> ().anchoredPosition3D = Vector3.zero; obj.transform.localScale = new Vector3(0.6f, 0.6f, 1); obj.gameObject.SetActive(true); placedBlocks++; } } EGTween.MoveFrom(blockContainer.gameObject, EGTween.Hash("isLocal", true, "x", 50, "time", blockTransitionTime)); } if (placedBlocks == 0) { OnPlacingBlock(); StartCoroutine("UpdateBlocksInCurrentMoveData"); } }
void HandAnimation() { if (HelpContent.FindChild("txt-help1").gameObject.activeSelf) { targetPosition = BlockManager.instance.BlockList.Find(o => o.rowId == 2 && o.columnId == 1).block.transform.position; blockPosition = blockContainer.GetChild(0).GetChild(0).position; } else { targetPosition = BlockManager.instance.BlockList.Find(o => o.rowId == 1 && o.columnId == 2).block.transform.position; blockPosition = blockContainer.GetChild(2).GetChild(0).position; } blockPosition.z = 0; targetPosition.z = 0; handImage.transform.position = blockPosition; handImage.gameObject.SetActive(true); EGTween.MoveTo(handImage.gameObject, EGTween.Hash("Delay", 1F, "x", targetPosition.x, "y", targetPosition.y, "time", 2.5f, "easeType", EGTween.EaseType.linear)); Invoke("RepeatHandAnimation", 4.5f); }
void OnEnable() { GamePlay.OnScoreUpdatedEvent += OnScoreUpdated; if (PlayerPrefs.GetInt("isRescued", 0) == 1) { rotateSpeed = ((rotateSpeed > minSpeed) ? rotateSpeed : minSpeed); if (currentRing == null) { currentRing = Rings [Random.Range(0, Rings.Count)]; } } else { currentRing = Rings [Random.Range(0, Rings.Count)]; rotateSpeed = minSpeed; } currentRing.SetActive(true); EGTween.Init(gameObject); StartRotation(); }
public void SpawnSuggetedBlocks() { for (int i = 0; i < 3; i++) { if (blockContainer.GetChild(i).childCount > 0) { Destroy(blockContainer.GetChild(i).GetChild(0).gameObject); } } int placedBlocks = 0; XDocument doc = XDocument.Parse(GameDataManager.instance.lastMoveData); for (int i = 0; i < 3; i++) { GameObject obj = null; string ObjectName = doc.Root.Element("suggestedObject" + (i + 1)).Attribute("objectName").Value; ObjectName = ObjectName.Replace("(Clone)", ""); int index = blockList.FindIndex(o => o.name == ObjectName); if (index != -1) { //index = ProbabilityPool [UnityEngine.Random.Range (0, ProbabilityPool.Count)]; obj = (GameObject)Instantiate(blockList [index].gameObject); obj.transform.SetParent(blockContainer.GetChild(i).transform); obj.GetComponent <RectTransform> ().anchoredPosition3D = Vector3.zero; obj.transform.localScale = new Vector3(0.6f, 0.6f, 1); obj.gameObject.SetActive(true); placedBlocks++; } } EGTween.MoveFrom(blockContainer.gameObject, EGTween.Hash("isLocal", true, "x", 50, "time", blockTransitionTime)); }
public static void ScaleBy(this GameObject target, Hashtable args) { EGTween.ScaleBy(target, args); }
public static void RotateFrom(this GameObject target, Vector3 rotation, float time) { EGTween.RotateFrom(target, EGTween.Hash("rotation", rotation, "time", time)); }
public static void RotateFrom(this GameObject target, Hashtable args) { EGTween.RotateFrom(target, args); }
/// <summary> /// Raises the disable event. /// </summary> void OnDisable() { EGTween.Stop(gameObject); }
/// <summary> /// Ends the rotation. /// </summary> public void EndRotation() { EGTween.Stop(gameObject); }
void OnDisable() { GamePlay.OnScoreUpdatedEvent -= OnScoreUpdated; EGTween.Stop(gameObject); currentRing.SetActive(false); }
/// <summary> /// Updates the speed. /// </summary> void UpdateSpeed() { EGTween.Stop(gameObject); StartRotation(); }
/// <summary> /// Raises the enable event. /// </summary> void OnEnable() { EGTween.Init(gameObject); StartRotation(); }
public static void RotateBy(this GameObject target, Vector3 amount, float time) { EGTween.RotateBy(target, EGTween.Hash("amount", amount, "time", time)); }
void RepeatHandAnimation() { handImage.transform.position = blockPosition; EGTween.MoveTo(handImage.gameObject, EGTween.Hash("Delay", 0.5F, "x", targetPosition.x, "y", targetPosition.y, "time", 2.5f, "easeType", EGTween.EaseType.linear)); Invoke("RepeatHandAnimation", 4.0f); }
public void PlaceObject() { int blockRemained = 0; List <Transform> blockList = BlockTrayManager.instance.blockList; foreach (Transform t in blockContainer) { if (t.childCount > 0) { blockRemained++; } } if (blockRemained == 2) { for (int i = 1; i <= 3; i++) { if (blockContainer.GetChild(i - 1).childCount <= 0) { if (i == 1) { if (blockContainer.GetChild(i).childCount > 0) { swapObject(blockContainer.GetChild(i - 1), blockContainer.GetChild(i).GetChild(0)); swapObject(blockContainer.GetChild(i), blockContainer.GetChild(i + 1).GetChild(0)); } } else if (i == 2) { if (blockContainer.GetChild(i).childCount >= 0) { swapObject(blockContainer.GetChild(i - 1), blockContainer.GetChild(i).GetChild(0)); } } else { GameObject obj = (GameObject)Instantiate(blockList [2].gameObject); obj.transform.SetParent(blockContainer.GetChild(i - 1).transform); obj.GetComponent <RectTransform> ().anchoredPosition3D = Vector3.zero; obj.transform.localScale = new Vector3(0.6f, 0.6f, 1); obj.gameObject.SetActive(true); EGTween.MoveFrom(obj, EGTween.Hash("isLocal", true, "x", 50, "time", blockTransitionTime)); } } } blockContainer.GetChild(1).GetComponent <Image> ().raycastTarget = true; blockContainer.GetChild(helpMode == "Horizontal" ? 2 : 0).GetComponent <Image> ().raycastTarget = true; } else if (blockRemained == 0) { blockContainer.GetChild(1).GetComponent <Image> ().raycastTarget = false; blockContainer.GetChild(helpMode == "Horizontal" ? 2 : 0).GetComponent <Image> ().raycastTarget = false; for (int i = 0; i < 3; i++) { GameObject obj = (GameObject)Instantiate(blockList [helpMode == "Horizontal" ? i:i + 2].gameObject); obj.transform.SetParent(blockContainer.GetChild(i).transform); obj.GetComponent <RectTransform> ().anchoredPosition3D = Vector3.zero; obj.transform.localScale = new Vector3(0.6f, 0.6f, 1); obj.gameObject.SetActive(true); } EGTween.MoveFrom(blockContainer.gameObject, EGTween.Hash("isLocal", true, "x", 50, "time", blockTransitionTime)); } }
/// <summary> /// Swaps the object. /// </summary> /// <param name="parentBlock">Parent block.</param> /// <param name="blockToTansit">Block to tansit.</param> public void swapObject(Transform parentBlock, Transform blockToTansit) { blockToTansit.SetParent(parentBlock); EGTween.MoveTo(blockToTansit.gameObject, EGTween.Hash("isLocal", true, "x", 0, "time", blockTransitionTime)); }
/// <summary> /// Starts the rotation. /// </summary> public void StartRotation() { EGTween.RotateBy(gameObject, EGTween.Hash("z", -1.0F, "speed", (rotateSpeed), "easeType", EGTween.EaseType.linear, "loopType", EGTween.LoopType.loop)); }