示例#1
0
        protected virtual void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent <BoxCollider>();

            // Get the Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector as well.
            interpolator = gameObject.GetComponent <Interpolator>();
            interpolator.SmoothLerpToTarget      = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;
        }
        virtual protected void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent <BoxCollider>();
            if (!tagalongCollider)
            {
                // If we can't find one, disable the script.
                enabled = false;
            }

            // Add an Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector.
            interpolator = gameObject.AddComponent <Interpolator>();
            interpolator.SmoothLerpToTarget      = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;
        }