示例#1
0
 public GameObject GetChaseTarget()
 {
     foreach (var go in inRange.GetViews())
     {
         if (LayerMaskUtils.IsIncluded(chaseLayer, go.layer))
         {
             return(go);
         }
     }
     return(null);
 }
示例#2
0
 public void Initialize(Player player, Rigidbody mainRigidbody, GameObject head)
 {
     this.player                 = player;
     this.rb                     = mainRigidbody;
     this.head                   = head;
     Cursor.lockState            = CursorLockMode.Locked;
     layermaskInteract           = LayerMaskUtils.CreateMask("InteractCast");
     interactTestInterval        = 1f / interactTestsPerSecond;
     interactTestTimer           = 0f;
     collisionLayerMaskForProps  = LayerMaskUtils.CreateMask("Prop");
     collisionLayerMaskForProps &= ~LayerMask.GetMask("Water");
 }
示例#3
0
 public void Initialize(Player player, Rigidbody rb, CapsuleCollider worldCollider, GameObject head, PlayerHealthNEW health)
 {
     this.player   = player;
     this.rb       = rb;
     this.col      = worldCollider;
     this.head     = head;
     this.health   = health;
     contactPoints = new List <ContactPoint>();
     SetColliderHeight(normalHeight);                //TODO load from playerprefs later (if i do a half life style campaign)
     jumpSpeed = Mathf.Sqrt(2f * normalGravity * moveJumpHeight);
     collisionLayerMaskForRaycasting  = LayerMaskUtils.CreateMask(this.rb.gameObject.layer);
     collisionLayerMaskForRaycasting &= ~LayerMask.GetMask("Water");
     debugInfo = "";
 }
        /// <summary>
        ///     Draws a LayerMask field with the given style.
        /// </summary>
        /// <param name="position">Position.</param>
        /// <param name="label">Label.</param>
        /// <param name="prop">Property.</param>
        /// <param name="style">Style.</param>
        public static void LayerMaskField(Rect position, GUIContent label, SerializedProperty prop, GUIStyle style)
        {
            label = EditorGUI.BeginProperty(position, label, prop);

            EditorGUI.BeginChangeCheck();

            LayerMaskUtils.GetMaskFieldNames(ref s_LayerNames);
            int mappedMask = LayerMaskUtils.MapToMaskField(prop.intValue);

            mappedMask = EditorGUI.MaskField(position, label, mappedMask, s_LayerNames, style);

            if (EditorGUI.EndChangeCheck())
            {
                LayerMask newMask = LayerMaskUtils.MapFromMaskField(mappedMask);
                prop.SetMask(newMask);
            }

            EditorGUI.EndProperty();
        }