Пример #1
0
 public void FadeInBackLayOnLoad()
 {
     if (doFadeInBackLayOnLoad)
     {
         BackLay.gameObject.ValueTo(EGTween.Hash("From", 0F, "To", 0.5F, "Time", TransitionDuration, "onupdate", "OnOpacityUpdate"));
     }
 }
Пример #2
0
 /// <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));
     }
 }
Пример #3
0
    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();
            }
        }
    }
Пример #4
0
    void OnEnable()
    {
        GamePlay.instance.StopCoroutine("LoseTime");

        BGMusicController.instance.StopBGMusic();
        GameController.instance.isGamePaused = true;
        EGTween.Pause(GamePlay.instance.gameObject, true);
    }
Пример #5
0
    void OnDisable()
    {
        GamePlay.instance.StartCoroutine("LoseTime");

        BGMusicController.instance.StartBGMusic();
        EGTween.Resume(GamePlay.instance.gameObject, true);
        GameController.instance.isGamePaused = false;
    }
Пример #6
0
 public void StophandAnimation()
 {
     if (handImage.gameObject.activeSelf)
     {
         EGTween.Stop(handImage.gameObject);
         handImage.gameObject.SetActive(false);
     }
 }
Пример #7
0
    public void AnimateWindowOnLoad()
    {
        if (doAnimateOnLoad && (WindowContent != null))
        {
            WindowContent.MoveFrom(EGTween.Hash("x", 600, "easeType", EGTween.EaseType.easeOutBack, "time", TransitionDuration, "islocal", true));
        }

        FadeInBackLayOnLoad();
    }
Пример #8
0
    public void AnimateWindowOnDestroy()
    {
        if (doAnimateOnDestroy && (WindowContent != null))
        {
            WindowContent.MoveTo(EGTween.Hash("x", -600F, "easeType", EGTween.EaseType.easeInBack, "time", TransitionDuration, "islocal", true));
        }

        FadeOutBacklayOnDestroy();
    }
Пример #9
0
    /// <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);
    }
Пример #10
0
    /// <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));
        }
    }
Пример #11
0
    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);
    }
Пример #12
0
 public void TogglePauseGame(bool paused)
 {
     isGamePaused = paused;
     if (GamePlayMode == GameMode.timer)
     {
         if (isGamePaused)
         {
             EGTween.Pause(gameObject);
         }
         else
         {
             EGTween.Resume(gameObject);
         }
     }
 }
Пример #13
0
    /// <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));
        }
    }
Пример #14
0
    /// <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");
        }
    }
Пример #15
0
    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);
    }
Пример #16
0
    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();
    }
Пример #17
0
    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));
    }
Пример #18
0
 public static void ScaleBy(this GameObject target, Hashtable args)
 {
     EGTween.ScaleBy(target, args);
 }
Пример #19
0
 public static void RotateFrom(this GameObject target, Vector3 rotation, float time)
 {
     EGTween.RotateFrom(target, EGTween.Hash("rotation", rotation, "time", time));
 }
Пример #20
0
 public static void RotateFrom(this GameObject target, Hashtable args)
 {
     EGTween.RotateFrom(target, args);
 }
Пример #21
0
 /// <summary>
 /// Raises the disable event.
 /// </summary>
 void OnDisable()
 {
     EGTween.Stop(gameObject);
 }
Пример #22
0
 /// <summary>
 /// Ends the rotation.
 /// </summary>
 public void EndRotation()
 {
     EGTween.Stop(gameObject);
 }
Пример #23
0
 void OnDisable()
 {
     GamePlay.OnScoreUpdatedEvent -= OnScoreUpdated;
     EGTween.Stop(gameObject);
     currentRing.SetActive(false);
 }
Пример #24
0
 /// <summary>
 /// Updates the speed.
 /// </summary>
 void UpdateSpeed()
 {
     EGTween.Stop(gameObject);
     StartRotation();
 }
Пример #25
0
 /// <summary>
 /// Raises the enable event.
 /// </summary>
 void OnEnable()
 {
     EGTween.Init(gameObject);
     StartRotation();
 }
Пример #26
0
 public static void RotateBy(this GameObject target, Vector3 amount, float time)
 {
     EGTween.RotateBy(target, EGTween.Hash("amount", amount, "time", time));
 }
Пример #27
0
 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);
 }
Пример #28
0
    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));
        }
    }
Пример #29
0
 /// <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));
 }
Пример #30
0
 /// <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));
 }