Beispiel #1
0
        /// <summary>
        /// If main object falldown fish swim to side
        /// </summary>
        /// <param name="completeCallBack"></param>
        /// <param name="showPrivateScore"></param>
        /// <param name="addPrivateScore"></param>
        /// <param name="privateScore"></param>
        public override void FallDownCollect(Action completeCallBack, bool showPrivateScore, bool addPrivateScore, int privateScore)
        {
            OverlayObject oO = GetComponent <OverlayObject>();

            if (oO && oO.OOData != null)
            {
                collectSequence = new TweenSeq();// Debug.Log("Fish collect " + ToString());
                float locScale = transform.localScale.x;
                oO.sRenderer.sprite = oO.OOData.GuiImage;

                collectSequence.Add((callBack) => // scale out
                {
                    SimpleTween.Value(gameObject, locScale, locScale * 1.2f, 0.20f).SetOnUpdate((float val) =>
                    {
                        transform.localScale = new Vector3(val, val, val);
                    }).AddCompleteCallBack(callBack);
                });

                collectSequence.Add((callBack) =>  //scale in
                {
                    SimpleTween.Value(gameObject, locScale * 1.2f, locScale, 0.20f).SetOnUpdate((float val) =>
                    {
                        transform.localScale = new Vector3(val, val, val);
                    }).AddCompleteCallBack(callBack);
                });

                collectSequence.Add((callBack) =>
                {
                    SoundMasterController.Instance.SoundPlayClipAtPos(0, oO.OOData.privateClip, null, transform.position, 1.0f);
                    GameObject aP = oO.OOData.hitAnimPrefab;
                    Transform rel = GetComponentInParent <GridCell>().transform;

                    SceneCurve path = (UnityEngine.Random.Range(0, 2) == 0) ? pathToLeft : pathToRight;
                    path.MoveAlongPath(gameObject, rel, path.Length / speed, 0, EaseAnim.EaseInOutSine, callBack);
                });

                collectSequence.Add((callBack) =>
                {
                    //   if (showPrivateScore) EffectsHolder.Instance.InstantiateScoreFlyerAtPosition(privateScore, transform.position, oO.OOData.privateFont);
                    //  if (addPrivateScore) BubblesPlayer.Instance.AddScore(privateScore);
                    if (completeCallBack != null)
                    {
                        completeCallBack();
                    }
                    DestroyImmediate(gameObject);
                    callBack();
                });

                collectSequence.Start();
            }
            else
            {
                if (completeCallBack != null)
                {
                    completeCallBack();
                }
            }
        }
Beispiel #2
0
        private void SetStars(int count)
        {
            if (!starLeftSet)
            {
                starLeftFull.SetActive(count >= 1);
            }
            if (!starMiddleSet)
            {
                starMiddleFull.SetActive(count >= 2);
            }
            if (!starRightSet)
            {
                starRightFull.SetActive(count >= 3);
            }

            ts = new TweenSeq();
            if (count >= 1 && !starLeftSet)
            {
                starLeftSet = true;

                ts.Add((callBack) =>
                {
                    if (curveLeft)
                    {
                        float time = curveLeft.Length / speed;
                        curveLeft.MoveAlongPath(starLeftFull.gameObject, starLeftEmpty.transform, time, 0f, EaseAnim.EaseInOutSine, callBack);
                    }
                    else
                    {
                        SimpleTween.Move(starLeftFull.gameObject, starLeftFull.transform.position, starLeftEmpty.transform.position, 0.5f).AddCompleteCallBack(() =>
                        {
                            callBack();
                        });
                    }
                });
            }
            if (count >= 2 && !starMiddleSet)
            {
                starMiddleSet = true;
                ts.Add((callBack) =>
                {
                    if (curveMiddle)
                    {
                        float time = curveMiddle.Length / speed;
                        curveMiddle.MoveAlongPath(starMiddleFull.gameObject, starMiddleEmpty.transform, time, 0f, EaseAnim.EaseInOutSine, callBack);
                    }
                    else
                    {
                        SimpleTween.Move(starMiddleFull.gameObject, starMiddleFull.transform.position, starMiddleEmpty.transform.position, 0.5f).AddCompleteCallBack(() =>
                        {
                            callBack();
                        });
                    }
                });
            }
            if (count >= 3 && !starRightSet)
            {
                starRightSet = true;
                ts.Add((callBack) =>
                {
                    if (curveRight)
                    {
                        float time = curveRight.Length / speed;
                        curveRight.MoveAlongPath(starRightFull.gameObject, starRightEmpty.transform, time, 0f, EaseAnim.EaseInOutSine, callBack);
                    }
                    else
                    {
                        SimpleTween.Move(starRightFull.gameObject, starRightFull.transform.position, starRightEmpty.transform.position, 0.5f).AddCompleteCallBack(() =>
                        {
                            callBack();
                        });
                    }
                });
            }
            ts.Start();
        }