Beispiel #1
0
        internal static void Unregister(BoingBehavior behavior)
        {
            if (OnBehaviorUnregister != null)
            {
                OnBehaviorUnregister(behavior);
            }

            s_behaviorMap.Remove(behavior.GetInstanceID());
            PostUnregisterBehavior();
        }
Beispiel #2
0
        internal static void Register(BoingBehavior behavior)
        {
            PreRegisterBehavior();
            s_behaviorMap.Add(behavior.GetInstanceID(), behavior);

            if (OnBehaviorRegister != null)
            {
                OnBehaviorRegister(behavior);
            }
        }
Beispiel #3
0
        internal static Vector3 ComputeTranslationalResults(Transform t, Vector3 src, Vector3 dst, BoingBehavior b)
        {
            if (!b.LockTranslationX && !b.LockTranslationY && !b.LockTranslationZ)
            {
                return(dst);
            }
            else
            {
                Vector3 delta = dst - src;

                switch (b.TranslationLockSpace)
                {
                case BoingManager.TranslationLockSpace.Global:
                    if (b.LockTranslationX)
                    {
                        delta.x = 0.0f;
                    }
                    if (b.LockTranslationY)
                    {
                        delta.y = 0.0f;
                    }
                    if (b.LockTranslationZ)
                    {
                        delta.z = 0.0f;
                    }
                    break;

                case BoingManager.TranslationLockSpace.Local:
                    if (b.LockTranslationX)
                    {
                        delta -= Vector3.Project(delta, t.right);
                    }
                    if (b.LockTranslationY)
                    {
                        delta -= Vector3.Project(delta, t.up);
                    }
                    if (b.LockTranslationZ)
                    {
                        delta -= Vector3.Project(delta, t.forward);
                    }
                    break;
                }

                return(src + delta);
            }
        }