コード例 #1
0
 private void PlayFootstep(MovementType movementType, SurfaceType surfaceType, Transform footPosition = null)
 {
     foreach (FootstepImport import in footstepImports)
     {
         if (import.key == shoeOrFeetType.ToString() + "_" + surfaceType.ToString() + "_" + movementType.ToString())
         {
             if (import.audioObject != null)
             {
                 import.audioObject.TriggerDirectly(TriggeringAction.StartSound, footPosition);
             }
         }
     }
 }
コード例 #2
0
        private string GetMostSurface(int[] surfaceCounter)
        {
            int mostSurfaceIndex = 0;
            int mostSurfaceValue = 0;

            for (int i = 0; i < surfaceCounter.Length; i++)
            {
                if (surfaceCounter[i] > mostSurfaceValue)
                {
                    mostSurfaceIndex = i;
                    mostSurfaceValue = surfaceCounter[i];
                }
            }

            SurfaceType surface = (SurfaceType)mostSurfaceIndex;
            return surface.ToString();
        }
コード例 #3
0
        /// <summary>
        /// Detects the type of surface the cursor is at.
        /// </summary>
        private void OnRaycastResult(MLRaycast.ResultState state, MLRaycastBehavior.Mode mode, Ray ray, RaycastHit hit, float confidence)
        {
            if (_firstPlacement == true)
            {
                return;
            }

            else
            {
                _isValid = true;
                float dot = Vector3.Dot(-Cursor.transform.forward, Vector3.up);

                //are we oriented like a table/floor or a wall?
                if (dot > .5f || dot < -.5f)
                {
                    if (dot < 0)
                    {
                        _type = SurfaceType.Floor;
                    }
                    else if (dot > 0)
                    {
                        _type = SurfaceType.Ceiling;
                    }
                }
                else
                {
                    _type = SurfaceType.Wall;
                }
            }

            if (StatusLabel != null)
            {
                StatusLabel.text  = "Valid Plane " + _type.ToString();
                StatusLabel.color = Color.green;
            }
            if (StatusLabel != null)
            {
                StatusLabel.text  = "Invalid Location";
                StatusLabel.color = Color.red;
            }

            UpdatePad();
            UpdateObject();
        }