예제 #1
0
 public void Init()
 {
     if (image_Crab != null)
     {
         image_Crab.DORewind();
         image_Crab.transform.localPosition = initPos;
         tween.DORestart();
     }
 }
예제 #2
0
    void WebAnim()
    {
        //DORestart:  recalculate the relative path
        lp.DORestart(true);
        rp.DORestart(true);
        lp.DOPlay();
        rp.DOPlay();
        SetWebNodeForge(0);
        lp.gameObject.transform.DOLocalRotate(new Vector3(75, 0, -8), 0.4f, RotateMode.Fast).onComplete = delegate {
            lp.gameObject.transform.DOLocalRotate(new Vector3(0, 0, 7), 0.6f, RotateMode.Fast).onComplete = delegate { SetWebNodeForge(forge); };
        };
        rp.gameObject.transform.DOLocalRotate(new Vector3(75, 0, 8), 0.4f, RotateMode.Fast).onComplete = delegate {
            rp.gameObject.transform.DOLocalRotate(new Vector3(0, 0, -7), 0.6f, RotateMode.Fast);
        };

        DOTweenPath t;

        GameObject[] os = GameObject.FindGameObjectsWithTag("WebNode");
        foreach (GameObject o in os)
        {
            if (o.GetComponent <DOTweenPath>())
            {
                t = o.GetComponent <DOTweenPath>();
                t.DORestart(true);
                t.DOPlay();
            }
        }
    }
    private IEnumerator Start()
    {
        _dotWeenPath = GetComponent <DOTweenPath>();

        yield return(new WaitForSeconds(1f));

        _dotWeenPath.DORestart();
    }
예제 #4
0
    protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
    {
        switch (Mode)
        {
        case Modes.DOPlay:
            TargetDOTweenPath.DOPlay();
            break;

        case Modes.DOPlayBackwards:
            TargetDOTweenPath.DOPlayBackwards();
            break;

        case Modes.DOPlayForward:
            TargetDOTweenPath.DOPlayForward();
            break;

        case Modes.DOPause:
            TargetDOTweenPath.DOPause();
            break;

        case Modes.DOTogglePause:
            TargetDOTweenPath.DOTogglePause();
            break;

        case Modes.DORewind:
            TargetDOTweenPath.DORewind();
            break;

        case Modes.DORestart:
            TargetDOTweenPath.DORestart();
            break;

        case Modes.DOComplete:
            TargetDOTweenPath.DOComplete();
            break;

        case Modes.DOKill:
            TargetDOTweenPath.DOKill();
            break;
        }
    }
예제 #5
0
    void AddFlyFont(IEntity entity, EntityType type, DamageType damType, FlyFont font, float damage = 0)
    {
        Transform  posRoot = null;
        DamageType dt      = damType;

        if (testType != DamageType.None)
        {
            dt = testType;
        }
        bool bSelf = false;

        if (type == EntityType.EntityType_Player)
        {
            if (ClientGlobal.Instance().MainPlayer.GetUID() == entity.GetUID())
            {
                bSelf = true;
            }
        }
        if (damage == 0 && damType == DamageType.Normal)
        {
            //  Log.Error("damage == 0 && damType == DamageType.Normal  parent is flyroot");
            ReturnFlyFont(dt, font);
            return;
        }
        SetFontText(font, (int)damage, dt, bSelf);
        font.SetActive(true);

        GameObject rootGo = m_posRootPool.Alloc();

        posRoot        = rootGo.transform;
        posRoot.parent = this.transform;
        Vector3 enpos = entity.GetPos();
        Vector3 pos   = Vector3.zero;

        entity.GetLocatorPos(m_strLocatorName, Vector3.zero, Quaternion.identity, ref pos, true);
        float r = 0;// entity.GetRadius() * 2;

        posRoot.position = new Vector3(enpos.x, pos.y + r, enpos.z);

        posRoot.transform.rotation = GetLookRotation();
        Transform fontTrans = font.GetFontTransform();

        posRoot.name = entity.GetName();
        if (fontTrans != null && posRoot != null)
        {
            fontTrans.parent        = posRoot;
            fontTrans.localPosition = Vector3.zero;
            fontTrans.localRotation = Quaternion.identity;
            MeshText mt = font.GetMt();
            if (mt != null)
            {
                DOTweenAnimation[] tweenArray = font.GetTweens();
                DOTweenPath        pathTween  = font.GetPathTween();

                Tween maxAni = null;
                float during = 0;
                for (int i = 0; i < tweenArray.Length; i++)
                {
                    DOTweenAnimation tweenAni = tweenArray[i];

                    float totalTime = tweenAni.duration + tweenAni.delay;
                    if (totalTime > during)
                    {
                        maxAni = tweenAni.tween;
                        during = totalTime;
                    }
                    if (pathTween != null)
                    {
                        if (pathTween.duration + pathTween.delay > during)
                        {
                            maxAni = pathTween.tween;
                            during = pathTween.duration + pathTween.delay;
                        }
                    }
                    if (tweenAni.animationType == DOTweenAnimationType.Color)
                    {
                        int a = 10;
                    }
                    tweenAni.tween.Restart();
                    tweenAni.tween.Play();
                    // tweenAni.DOPlay();
                    //if (tweenAni.animationType == DOTweenAnimationType.Color)
                    //{
                    //    tweenAni.tween.Restart();
                    //    tweenAni.tween.Kill();
                    //    tweenAni.CreateTween();
                    //    //tweenAni.DOPlay();
                    //}
                    //else
                    //{
                    //    tweenAni.tween.Kill();
                    //    tweenAni.CreateTween();
                    //   // tweenAni.tween.Restart();
                    //}
                }

                if (pathTween != null)
                {
                    pathTween.DORestart();
                    pathTween.DOPlay();
                }


                maxAni.OnComplete(() =>
                {
                    ReturnFlyFont(dt, font);
                });
            }
        }
        else
        {
            ReturnFlyFont(dt, font);
        }
    }