Beispiel #1
0
    /// <summary>
    /// set un nouveau collider dans l'array
    /// </summary>
    private void SetNewCollider(Vector3 otherNormal)
    {
        otherNormal = otherNormal.normalized;

        if (ListExt.IsInArray(colliderNormalArray, otherNormal))
        {
            return;
        }

        //avant de commencer, vérifie encore si il y a une normal identique
        for (int i = 0; i < colliderNormalArray.Length; i++)
        {
            if (UtilityFunctions.IsClose(colliderNormalArray[i].x, otherNormal.x, debugCloseValueNormal) &&
                UtilityFunctions.IsClose(colliderNormalArray[i].y, otherNormal.y, debugCloseValueNormal))
            {
                //Debug.Log("trop proche d'une autre !");
                return;
            }
        }

        for (int i = 0; i < colliderNormalArray.Length; i++)
        {
            if (colliderNormalArray[i] == Vector3.zero)
            {
                colliderNormalArray[i] = otherNormal;
                return;
            }
        }
    }
Beispiel #2
0
 /// <summary>
 /// set un nouveau gameObject dans l'array
 /// </summary>
 /// <param name="other"></param>
 private void SetNewObjectCollision(GameObject other)
 {
     //ne rien faire si l'objet est déja dans la list
     if (ListExt.IsInArray(objectInCollision, other))
     {
         return;
     }
     //charcher un emplacement vide
     for (int i = 0; i < colliderNormalArray.Length; i++)
     {
         if (objectInCollision[i] == null)
         {
             objectInCollision[i] = other;
             return;
         }
     }
 }