예제 #1
0
    public static AnimData ColorTo(GameObject animObject, Color from, Color to,

                                   float time             = 0.5f,
                                   float delayTime        = 0,
                                   InterpType interp      = InterpType.Default,
                                   bool isChild           = true,
                                   bool IsIgnoreTimeScale = false,
                                   RepeatType repeatType  = RepeatType.Once,
                                   int repeatCount        = -1,
                                   AnimCallBack callBack  = null,
                                   object[] parameter     = null)
    {
        AnimData l_tmp = HeapObjectPool.GetObject <AnimData>("AnimData");

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.Color;
        l_tmp.m_fromColor      = from;
        l_tmp.m_toColor        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #2
0
    private IEnumerator moveToDestination(AnimCallBack onEnd)
    {
        //go to next pos
        Vector3 tmp;
        Vector3 target = points[0];
        float   delta  = Mathf.Abs(target.y - start_y);

        while (Vector3.Distance(target, go1.transform.position) > delta)
        {
            float step = speed * Time.deltaTime * 5;
            tmp   = Vector3.MoveTowards(go1.transform.position, target, step);
            tmp.y = start_y;
            go1.transform.position = tmp;
            yield return(null);
        }

        //place second object on second point
        go2.transform.parent   = null;
        go2.transform.position = points[1];


        yield return(new WaitForSeconds(1));

        onEnd.Invoke();
        Debug.Log("End Animate");
    }
예제 #3
0
    private IEnumerator Start()
    {
        GameController.Instance.AnimController = this;
        yield return(null);

        playAnimCallback += Next;
    }
예제 #4
0
    public static AnimData Blink(GameObject animObject, float space,

                                 float time             = 0.5f,
                                 float delayTime        = 0,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 AnimCallBack callBack  = null,
                                 object[] parameter     = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animType       = AnimType.Blink;
        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_space          = space;

        l_tmp.m_delayTime       = delayTime;
        l_tmp.m_totalTime       = time;
        l_tmp.m_repeatType      = repeatType;
        l_tmp.m_repeatCount     = repeatCount;
        l_tmp.m_callBack        = callBack;
        l_tmp.m_parameter       = parameter;
        l_tmp.m_ignoreTimeScale = IsIgnoreTimeScale;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #5
0
    public static AnimData UguiSizeDelta(GameObject animObject, Vector2 to, float time,
                                         InterpType interp = InterpType.Default, AnimCallBack callBack = null, params object[] parameter)
    {
        Vector2 from = animObject.GetComponent <RectTransform>().sizeDelta;

        return(UguiSizeDelta(animObject, from, to, time, interp, callBack, parameter));
    }
예제 #6
0
 public override void setDelegate(Delegate anyDelegate, String delegateName)
 {
     if (delegateName == "limit")
     {
         m_limitCallback = (LimitCallBack)anyDelegate;
     }
     else if (delegateName == "drag")
     {
         m_dragCallback = (DragCallBack)anyDelegate;
     }
     else if (delegateName == "dynamic")
     {
         m_dynamicCallback = (DynamicCallBack)anyDelegate;
     }
     else if (delegateName == "anim")
     {
         m_animCallback = (AnimCallBack)anyDelegate;
     }
     else if (delegateName == "scrollbar")
     {
         m_scrollbarCallback = (ScrollBarCallBack)anyDelegate;
     }
     else
     {
         throw new CKLBException("Unvalid delegate name");
     }
 }
예제 #7
0
    public static AnimData Scale(GameObject animObject, Vector3?from, Vector3 to,
                                 float time             = 0.5f,
                                 InterpType interp      = InterpType.Default,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 float delayTime        = 0,
                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        Vector3 fromTmp = from ?? animObject.transform.localScale;

        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.LocalScale;
        l_tmp.m_fromV3         = fromTmp;
        l_tmp.m_toV3           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #8
0
    public static AnimData UguiMove(GameObject animObject, Vector3 to, float time,
                                    InterpType interp = InterpType.Default, AnimCallBack callBack = null, params object[] parameter)
    {
        Vector3 from = animObject.GetComponent <RectTransform>().anchoredPosition;

        return(UguiMove(animObject, from, to, time, interp, callBack, parameter));
    }
예제 #9
0
    static int Blink(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 9);
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
            float        arg1           = (float)LuaDLL.luaL_checknumber(L, 2);
            float        arg2           = (float)LuaDLL.luaL_checknumber(L, 3);
            float        arg3           = (float)LuaDLL.luaL_checknumber(L, 4);
            bool         arg4           = LuaDLL.luaL_checkboolean(L, 5);
            RepeatType   arg5           = (RepeatType)ToLua.CheckObject(L, 6, typeof(RepeatType));
            int          arg6           = (int)LuaDLL.luaL_checknumber(L, 7);
            AnimCallBack arg7           = null;
            LuaTypes     funcType8      = LuaDLL.lua_type(L, 8);

            if (funcType8 != LuaTypes.LUA_TFUNCTION)
            {
                arg7 = (AnimCallBack)ToLua.CheckObject(L, 8, typeof(AnimCallBack));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 8);
                arg7 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
            }

            object[] arg8 = ToLua.CheckObjectArray(L, 9);
            AnimData o    = AnimSystem.Blink(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #10
0
    public static void Rotate(GameObject animObject, Vector3 from, Vector3 to, float time,
                              InterpType interp     = InterpType.Default,
                              RepeatType repeatType = RepeatType.Once,
                              bool isLocal          = true,
                              AnimCallBack callBack = null, params object[] parameter)
    {
        AnimType animType;

        if (isLocal)
        {
            animType = AnimType.LocalRotate;
        }
        else
        {
            animType = AnimType.Rotate;
        }

        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, animType,
            AnimParamType.FromV3, from,
            AnimParamType.ToV3, to,
            AnimParamType.Time, time,
            AnimParamType.InteType, interp,
            AnimParamType.IsLocal, isLocal,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        ValueTo(animParnHash);
    }
예제 #11
0
    public static AnimData Rotation(GameObject animObject, Vector3?from, Vector3 to,

                                    float time             = 0.5f,
                                    float delayTime        = 0,
                                    bool isLocal           = true,
                                    InterpType interp      = InterpType.Default,
                                    bool IsIgnoreTimeScale = false,
                                    RepeatType repeatType  = RepeatType.Once,
                                    int repeatCount        = -1,

                                    AnimCallBack callBack = null, object[] parameter = null)
    {
        Quaternion?quaternion = null;

        if (from != null)
        {
            quaternion = Quaternion.Euler((Vector3)from);
        }
        return(Rotation(animObject, quaternion, Quaternion.Euler(to),

                        time,
                        delayTime,
                        isLocal,
                        interp,
                        IsIgnoreTimeScale,
                        repeatType,
                        repeatCount,

                        callBack, parameter));
    }
예제 #12
0
    public static AnimData UguiSizeDelta(GameObject animObject, Vector2?from, Vector2 to,

                                         float time             = 0.5f,
                                         float delayTime        = 0,
                                         InterpType interp      = InterpType.Default,
                                         bool IsIgnoreTimeScale = false,
                                         RepeatType repeatType  = RepeatType.Once,
                                         int repeatCount        = -1,
                                         AnimCallBack callBack  = null,
                                         object[] parameter     = null)
    {
        Vector2 fromTmp = from ?? animObject.GetComponent <RectTransform>().sizeDelta;

        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.UGUI_SizeDetal,
            AnimParamType.FromV2, fromTmp,
            AnimParamType.ToV2, to,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.InteType, interp,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #13
0
    public static AnimData CustomMethodToVector3(AnimCustomMethodVector3 method, Vector3 from, Vector3 to,
                                                 float time             = 0.5f,
                                                 float delayTime        = 0,
                                                 InterpType interp      = InterpType.Default,
                                                 bool IsIgnoreTimeScale = false,
                                                 RepeatType repeatType  = RepeatType.Once,
                                                 int repeatCount        = -1,
                                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.AnimType, AnimType.Custom_Vector3,
            AnimParamType.FromV3, from,
            AnimParamType.ToV3, to,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.InteType, interp,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CustomMethodV3, method,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #14
0
    public static AnimData Blink(GameObject animObject, float space,

                                 float time             = 0.5f,
                                 float delayTime        = 0,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 AnimCallBack callBack  = null,
                                 object[] parameter     = null)
    {
        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.Blink,
            AnimParamType.Space, space,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #15
0
    //传From,传准确控制点随机范围
    public static AnimData BezierMove(GameObject animObject, Vector3 from, Vector3 to, float time, RepeatType repeatType,
                                      InterpType interp              = InterpType.Default,
                                      bool isLocal                   = true,
                                      PathType bezierMoveType        = PathType.Bezier2,
                                      float[] t_Bezier_contralRadius = null,
                                      AnimCallBack callBack          = null, object[] parameter = null)
    {
        AnimType animType;

        if (isLocal)
        {
            animType = AnimType.LocalPosition;
        }
        else
        {
            animType = AnimType.Position;
        }

        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, animType,
            AnimParamType.FromV3, from,
            AnimParamType.ToV3, to,
            AnimParamType.Time, time,
            AnimParamType.InteType, interp,
            AnimParamType.IsLocal, isLocal,
            AnimParamType.PathType, bezierMoveType,
            AnimParamType.floatControl, t_Bezier_contralRadius,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #16
0
    public static AnimData AlphaTo(GameObject animObject, float from, float to,

                                   float time             = 0.5f,
                                   float delayTime        = 0,
                                   InterpType interp      = InterpType.Default,
                                   bool IsIgnoreTimeScale = false,
                                   RepeatType repeatType  = RepeatType.Once,
                                   int repeatCount        = -1,
                                   bool isChild           = true,
                                   AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.Alpha,
            AnimParamType.FromFloat, from,
            AnimParamType.ToFloat, to,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.InteType, interp,
            AnimParamType.IsIncludeChild, isChild,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #17
0
    public static AnimData Scale(GameObject animObject, Vector3?from, Vector3 to,
                                 float time             = 0.5f,
                                 InterpType interp      = InterpType.Default,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 float delayTime        = 0,
                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        Vector3 fromTmp = from ?? animObject.transform.localScale;

        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.LocalScale,
            AnimParamType.FromV3, fromTmp,
            AnimParamType.ToV3, to,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.InteType, interp,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #18
0
    public static AnimData UguiSizeDelta(GameObject animObject, Vector2?from, Vector2 to,

                                         float time             = 0.5f,
                                         float delayTime        = 0,
                                         InterpType interp      = InterpType.Default,
                                         bool IsIgnoreTimeScale = false,
                                         RepeatType repeatType  = RepeatType.Once,
                                         int repeatCount        = -1,
                                         AnimCallBack callBack  = null,
                                         object[] parameter     = null)
    {
        Vector2 fromTmp = from ?? animObject.GetComponent <RectTransform>().sizeDelta;

        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_SizeDetal;
        l_tmp.m_fromV2         = fromTmp;
        l_tmp.m_toV2           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #19
0
 public static AnimData UguiAlpha(GameObject animObject, float from, float to, float time,
                                  InterpType interp     = InterpType.Default,
                                  bool isChild          = true,
                                  AnimCallBack callBack = null, params object[] parameter)
 {
     return(UguiAlpha(animObject, from, to, time, RepeatType.Once, interp, isChild, callBack, parameter));
 }
예제 #20
0
 /// <summary>
 /// 回收脚本时
 /// 初始化
 /// </summary>
 public void OnPush()
 {
     loopType          = LoopType.Once;
     easeType          = Ease.Linear;
     isPause           = false;
     isIgnoreTimeScale = false;
     delayTime         = 0;
     isDone            = false;
     currentTime       = 0;
     totalTime         = 0;
     loopCount         = -1;
     pathType          = PathType.Line;
     pathPoints        = null;
     currentStep       = 0;
     // m_floatContral = null;
     toTransform       = null;
     customMethodV3    = null;
     customMethodV2    = null;
     customMethodFloat = null;
     m_rectRransform   = null;
     m_transform       = null;
     curve             = null;
     pathPoints        = null;
     pathWeith         = null;
     m_oldColor.Clear();
     animCallBack  = null;
     animParameter = null;
 }
예제 #21
0
    public static AnimData CustomMethodToVector4(AnimCustomMethodVector4 method, Vector4 from, Vector4 to,
                                                 float time             = 0.5f,
                                                 float delayTime        = 0,
                                                 InterpType interp      = InterpType.Default,
                                                 bool IsIgnoreTimeScale = false,
                                                 RepeatType repeatType  = RepeatType.Once,
                                                 int repeatCount        = -1,
                                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animType       = AnimType.Custom_Vector4;
        l_tmp.m_fromV4         = from;
        l_tmp.m_toV4           = to;
        l_tmp.m_customMethodV4 = method;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #22
0
 public TweenScript SetCallBack(AnimCallBack callBack, object[] parameter = null)
 {
     animCallBack      = callBack;
     animParameter     = parameter;
     isExcutedCallback = false;
     return(this);
 }
예제 #23
0
    public static AnimData CustomMethodToFloat(AnimCustomMethodFloat method, float from, float to,
                                               float time             = 0.5f,
                                               float delayTime        = 0,
                                               InterpType interp      = InterpType.Default,
                                               bool IsIgnoreTimeScale = false,
                                               RepeatType repeatType  = RepeatType.Once,
                                               int repeatCount        = -1,
                                               AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = HeapObjectPool <AnimData> .GetObject();;

        l_tmp.m_animType          = AnimType.Custom_Float;
        l_tmp.m_fromFloat         = from;
        l_tmp.m_toFloat           = to;
        l_tmp.m_customMethodFloat = method;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #24
0
    public static AnimData UguiMove(GameObject animObject, Vector3?from, Vector3 to,
                                    float time             = 0.5f,
                                    float delayTime        = 0,
                                    InterpType interp      = InterpType.Default,
                                    bool IsIgnoreTimeScale = false,
                                    RepeatType repeatType  = RepeatType.Once,
                                    int repeatCount        = -1,
                                    AnimCallBack callBack  = null,
                                    object[] parameter     = null)
    {
        Vector3 fromTmp = from ?? animObject.GetComponent <RectTransform>().anchoredPosition;

        AnimData l_tmp = HeapObjectPool <AnimData> .GetObject();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_AnchoredPosition;
        l_tmp.m_fromV3         = fromTmp;
        l_tmp.m_toV3           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #25
0
    public static AnimData AlphaTo(GameObject animObject, float from, float to,

                                   float time             = 0.5f,
                                   float delayTime        = 0,
                                   InterpType interp      = InterpType.Default,
                                   bool IsIgnoreTimeScale = false,
                                   RepeatType repeatType  = RepeatType.Once,
                                   int repeatCount        = -1,
                                   bool isChild           = true,
                                   AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.Alpha;
        l_tmp.m_fromFloat      = from;
        l_tmp.m_toFloat        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
예제 #26
0
    public override void Animate(AnimCallBack onEnd)
    {
        Debug.Log("Animate");

        if (!Check())
        {
            onEnd.Invoke();
            Debug.Log("invalid paramenters");
            return;
        }
        // StartCoroutine(move(onEnd));
        if (go1.GetComponent <EnvironmentObject>().unityChan)
        {
            go1.GetComponent <UChanVoice>().PlayYo();
            agent    = go1.GetComponent <NavMeshAgent>();
            animator = go1.GetComponent <Animator>();

            if (go2.transform.position.y > 0f)
            {
                points[0] = new Vector3(go2.transform.position.x, 0f, go2.transform.position.z);
            }
            Debug.Log(points[0]);

            NavMeshHit hit;
            if (NavMesh.SamplePosition(go2.transform.position, out hit, 2.0f, NavMesh.AllAreas))
            {
                NavMeshPath path = new NavMeshPath();
                if (NavMesh.CalculatePath(go1.transform.position, hit.position, NavMesh.AllAreas, path))
                {
                    agent.path      = path;
                    agent.isStopped = false;
                    animator.SetBool("run", true);
                    startAnimSpeed  = animator.speed;
                    startAgentSpeed = agent.speed;
                    animator.speed  = speed;
                    agent.speed     = speed * 4;
                    StartCoroutine(CheckIfOnPlace(onEnd));
                }
                else
                {
                    onEnd.Invoke();
                    Debug.Log("Invalid Path. End Animate");
                }


                // agent.destination = hit.position;
            }
            else
            {
                onEnd.Invoke();
                Debug.Log("Invalid Path. End Animate");
            }
        }
        else
        {
            onEnd.Invoke();
            Debug.Log("Not a unity chan!");
        }
    }
예제 #27
0
 public static AnimData BezierMove(GameObject animObject, Vector3 from, Vector3 to, float time,
                                   InterpType interp              = InterpType.Default, bool isLocal = true,
                                   PathType bezierMoveType        = PathType.Bezier2,
                                   float[] t_Bezier_contralRadius = null,
                                   AnimCallBack callBack          = null, object[] parameter = null)
 {
     return(BezierMove(animObject, from, to, time, RepeatType.Once, interp, isLocal, bezierMoveType, t_Bezier_contralRadius, callBack, parameter));
 }
예제 #28
0
 public static AnimData Move(GameObject animObject, Vector3 from, Vector3 to,
                             float time            = 0.5f,
                             InterpType interp     = InterpType.Default,
                             bool isLocal          = true,
                             AnimCallBack callBack = null, params object[] parameter)
 {
     return(Move(animObject, from, to, time, interp, RepeatType.Once, isLocal, callBack, parameter));
 }
예제 #29
0
    // IEnumerator move( AnimCallBack onEnd)
    // {


    //     yield return null;
    // }

    IEnumerator CheckIfOnPlace(AnimCallBack onEnd)
    {
        Vector3 target = points[0];

        while (Vector3.Distance(target, go1.transform.position) > 2f)
        {
            yield return(new WaitForSeconds(0.1f));

            NavMeshHit hit;
            if (NavMesh.SamplePosition(points[0], out hit, 2.0f, NavMesh.AllAreas))
            {
                NavMeshPath path = new NavMeshPath();
                if (NavMesh.CalculatePath(go1.transform.position, hit.position, NavMesh.AllAreas, path))
                {
                    agent.path = path;
                }
                else
                {
                    animator.speed  = startAnimSpeed;
                    agent.speed     = startAgentSpeed;
                    animator.speed  = startAnimSpeed;
                    agent.isStopped = true;
                    animator.SetBool("run", false);
                    onEnd.Invoke();
                    Debug.Log("Invalid Path. End Animate");
                    break;
                }


                // agent.destination = hit.position;
            }
            else
            {
                animator.speed  = startAnimSpeed;
                agent.speed     = startAgentSpeed;
                agent.isStopped = true;
                animator.SetBool("run", false);
                onEnd.Invoke();
                Debug.Log("Invalid Path. End Animate");
                break;
            }
        }

        go1.GetComponent <UChanVoice>().PlayLaught();
        animator.speed  = startAnimSpeed;
        agent.speed     = startAgentSpeed;
        agent.isStopped = true;
        animator.SetBool("run", false);
        go1.GetComponent <UChanVoice>().PlayBreathing();
        yield return(new WaitForSeconds(1));

        onEnd.Invoke();
        Debug.Log("End Animate");

        yield return(null);
    }
예제 #30
0
    public static AnimData Scale(GameObject animObject, Vector3 to,
                                 float time,
                                 RepeatType repeatType = RepeatType.Once,
                                 InterpType interp     = InterpType.Default,
                                 AnimCallBack callBack = null, params object[] parameter)
    {
        Vector3 from = animObject.transform.localScale;

        return(Scale(animObject, from, to, time, repeatType, interp, callBack, parameter));
    }
예제 #31
0
 public override void setDelegate(Delegate anyDelegate, String delegateName)
 {
     if(delegateName == "anim")
     {
         m_animCallback = (AnimCallBack)anyDelegate;
     }
     else
     {
         throw new CKLBException("Unvalid delegate name");
     }
 }
예제 #32
0
 public override void setDelegate(Delegate anyDelegate, String delegateName)
 {
     if(delegateName == "limit") {
         m_limitCallback = (LimitCallBack)anyDelegate;
     } else if(delegateName == "drag") {
         m_dragCallback = (DragCallBack)anyDelegate;
     } else if(delegateName == "dynamic") {
         m_dynamicCallback = (DynamicCallBack)anyDelegate;
     } else if(delegateName == "anim") {
         m_animCallback = (AnimCallBack)anyDelegate;
     } else if(delegateName == "scrollbar") {
         m_scrollbarCallback = (ScrollBarCallBack)anyDelegate;
     } else {
         throw new CKLBException("Unvalid delegate name");
     }
 }