コード例 #1
0
ファイル: Screw.cs プロジェクト: xkteng/VR2019
        protected void OnTriggerExit(Collider other)
        {
#if Debug
            print("TriggerExit");
#endif
            ScrewDriver screwDriver = other.GetComponentInParent <ScrewDriver>();
            if (screwDriver && screwDriver.ScrewType == this.ScrewType && IsStarted && !IsFinished)
            {
                ToggleHighlight(false);
            }
        }
コード例 #2
0
ファイル: Screw.cs プロジェクト: xkteng/VR2019
        protected void OnTriggerStay(Collider other)
        {
#if Debug
            //print("TriggerStay");
#endif
            if (currentStep < stepSum)
            {
                ScrewDriver screwDriver = other.GetComponentInParent <ScrewDriver>();
                if (screwDriver && screwDriver.ScrewType == this.ScrewType && screwDriver.InterObject.IsUsing())
                {
                    currentStep++;
                    transform.position = m_originalPos + transform.forward * Mathf.Lerp(0, Depth, (float)currentStep / stepSum);
                }
            }
            if (currentStep >= stepSum)
            {
                // IsFinished = true;
                IsScrewed = true;
                OnFinishSteppedObject(new SteppedObjectEventArgs());
            }
        }