Пример #1
0
    public override void Execute()
    {
        if (m_DOTweenAction == null)
        {
            Debug.LogError("무브 액션이 설정안된 객체입니다. 설정해주시기 바랍니다. 에러객체 이름 및 좌표 : " + m_MonoBehaviour.gameObject.name + " / " + m_MonoBehaviour.gameObject.transform.position);
            return;
        }

        switch (m_DOTweenActionType)
        {
        case DOTweenActionType.MoveTo:
        {
            MoveTo to = m_DOTweenAction as MoveTo;



            m_MonoBehaviour.gameObject.transform
            .DOMove(to.GetEndPoint(), to.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.MoveBy:
        {
            MoveBy by = m_DOTweenAction as MoveBy;
            m_MonoBehaviour.gameObject.transform
            .DOBlendableMoveBy(by.GetEndPoint(), by.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.MovePaths:
        {
            MovePaths paths = m_DOTweenAction as MovePaths;
            m_MonoBehaviour.gameObject.transform
            .DOPath(paths.GetPaths(), paths.GetDuration(), paths.GetPathType())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.RotateTo:
        {
            RotateTo roateto = m_DOTweenAction as RotateTo;
            m_MonoBehaviour.gameObject.transform
            .DORotate(roateto.GetEndPoint(), roateto.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.RotateBy:
        {
            RotateBy roateby = m_DOTweenAction as RotateBy;
            m_MonoBehaviour.gameObject.transform
            .DOBlendableLocalRotateBy(roateby.GetEndPoint(), roateby.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.ColorTo:
        {
            ColorTo colorto = m_DOTweenAction as ColorTo;
            m_MonoBehaviour.gameObject.GetComponentInChildren <MeshRenderer>().material
            .DOColor(colorto.GetEndPoint(), colorto.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.ColorRewind:
        {
            ColorTo  colorto  = m_DOTweenAction as ColorTo;
            Material material = m_MonoBehaviour.gameObject.GetComponentInChildren <MeshRenderer>().material;
            Color    oriColor = material.color;
            float    duration = colorto.GetDuration() / 2;
            DOTween.Sequence()
            .Append(material.DOColor(oriColor, duration))
            .Append(material.DOColor(colorto.GetEndPoint(), duration))
            .OnComplete(() => m_IsCompleted = true);
        }
        break;

        case DOTweenActionType.ScaleTo:
        {
            ScaleTo scaleTo = m_DOTweenAction as ScaleTo;
            m_MonoBehaviour.gameObject.transform
            .DOScale(scaleTo.GetEndPoint(), scaleTo.GetDuration())
            .OnComplete(() => m_IsCompleted = true);
        }
        break;
        }
    }