Beispiel #1
0
 //-------------------------------------------------
 void Awake()
 {
     if (linearMapping == null)
     {
         linearMapping = GetComponent <LinearMapping>();
     }
 }
        //-------------------------------------------------
        void Start()
        {
            initialPosition = transform.localPosition;

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }
        }
        //-------------------------------------------------
        void Awake()
        {
            if (skinnedMesh == null)
            {
                skinnedMesh = GetComponent <SkinnedMeshRenderer>();
            }

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }
        }
Beispiel #4
0
        //-------------------------------------------------
        void Awake()
        {
            if (audioSource == null)
            {
                audioSource = GetComponent <AudioSource>();
            }

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }
        }
        //-------------------------------------------------
        void Start()
        {
            if (childCollider == null)
            {
                childCollider = GetComponentInChildren <Collider>();
            }

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }

            if (linearMapping == null)
            {
                linearMapping = gameObject.AddComponent <LinearMapping>();
            }

            worldPlaneNormal = new Vector3(0.0f, 0.0f, 0.0f);
            worldPlaneNormal[(int)axisOfRotation] = 1.0f;

            localPlaneNormal = worldPlaneNormal;

            if (transform.parent)
            {
                worldPlaneNormal = transform.parent.localToWorldMatrix.MultiplyVector(worldPlaneNormal).normalized;
            }

            if (limited)
            {
                start    = Quaternion.identity;
                outAngle = transform.localEulerAngles[(int)axisOfRotation];

                if (forceStart)
                {
                    outAngle = Mathf.Clamp(startAngle, minAngle, maxAngle);
                }
            }
            else
            {
                start    = Quaternion.AngleAxis(transform.localEulerAngles[(int)axisOfRotation], localPlaneNormal);
                outAngle = 0.0f;
            }

            if (debugText)
            {
                debugText.alignment = TextAlignment.Left;
                debugText.anchor    = TextAnchor.UpperLeft;
            }

            UpdateAll();
        }
        //-------------------------------------------------
        void Awake()
        {
            if (animator == null)
            {
                animator = GetComponent <Animator>();
            }

            animator.speed = 0.0f;

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }
        }
Beispiel #7
0
        //-------------------------------------------------
        void Start()
        {
            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }

            if (linearMapping == null)
            {
                linearMapping = gameObject.AddComponent <LinearMapping>();
            }

            initialMappingOffset = linearMapping.value;

            if (repositionGameObject)
            {
                UpdateLinearMapping(transform);
            }
        }
        //-------------------------------------------------
        void Awake()
        {
            if (animation == null)
            {
                animation = GetComponent <Animation>();
            }

            if (linearMapping == null)
            {
                linearMapping = GetComponent <LinearMapping>();
            }

            //We're assuming the animation has a single clip, and that's the one we're
            //going to scrub with the linear mapping.
            animation.playAutomatically = true;
            animState = animation[animation.clip.name];

            //If the anim state's (i.e. clip's) wrap mode is Once (the default) or ClampForever,
            //Unity will automatically stop playing the anim, regardless of subsequent changes
            //to animState.time. Thus, we set the wrap mode to PingPong.
            animState.wrapMode = WrapMode.PingPong;
            animState.speed    = 0;
            animLength         = animState.length;
        }