예제 #1
0
        public static LerpCoroutine <Quaternion> SetRotation(this Transform self, Quaternion rotation, float duration, bool slerp = true)
        {
            QuaternionRange range = new QuaternionRange(self.rotation, rotation);

            LerpCoroutine <Quaternion> coroutine;

            if (slerp)
            {
                coroutine = new LerpCoroutine <Quaternion>(duration, range, Quaternion.Slerp,
                                                           (l) => { if (self)
                                                                    {
                                                                        self.rotation = l;
                                                                    }
                                                           });
            }
            else
            {
                coroutine = new LerpCoroutine <Quaternion>(duration, range,
                                                           (l) => { if (self)
                                                                    {
                                                                        self.rotation = l;
                                                                    }
                                                           }
                                                           );
            }

            coroutine.Start();

            return(coroutine);
        }
예제 #2
0
        public static LerpCoroutine <Vector3> SetLocalScale(this Transform self, Vector3 scale, float duration)
        {
            LerpCoroutine <Vector3> coroutine = new LerpCoroutine <Vector3>(duration,
                                                                            new Vector3Range(self.localScale, scale),
                                                                            (l) => { if (self)
                                                                                     {
                                                                                         self.localScale = l;
                                                                                     }
                                                                            }
                                                                            );

            coroutine.Start();
            return(coroutine);
        }
예제 #3
0
        public static LerpCoroutine <Vector3> SetPosition(this Transform self, Vector3 position, float duration)
        {
            LerpCoroutine <Vector3> coroutine = new LerpCoroutine <Vector3>(duration,
                                                                            new Vector3Range(self.position, position),
                                                                            (l) => { if (self)
                                                                                     {
                                                                                         self.position = l;
                                                                                     }
                                                                            }
                                                                            );

            coroutine.Start();
            return(coroutine);
        }