Пример #1
0
    //-------------------------------------------------------------------------
    protected void UpdateSimilarCollidersAndGroupToTarget(AlphaMeshCollider target)
    {
        string colliderMeshPath = target.FullColliderMeshPath();

        object[] alphaMeshColliders = GameObject.FindSceneObjectsOfType(typeof(AlphaMeshCollider));

        ColliderGroup colliderGroup = FindColliderGroup(colliderMeshPath);

        if (colliderGroup == null)
        {
            // add new group.
            colliderGroup = new ColliderGroup();
            colliderGroup.mFullColliderMeshPath = colliderMeshPath;
            mColliderGroups.Add(colliderGroup);
        }

        AssignValuesFromInstanceToGroup(target, colliderGroup);

        colliderGroup.mAlphaMeshColliderObjects = new List <WeakReference>();
        foreach (AlphaMeshCollider collider in alphaMeshColliders)
        {
            if (collider.FullColliderMeshPath().Equals(colliderMeshPath))
            {
                colliderGroup.mAlphaMeshColliderObjects.Add(new WeakReference(collider));

                // reassign previously calculated values.
                AssignValuesFromColliderGroup(collider, colliderGroup);
            }
        }
    }
Пример #2
0
    //-------------------------------------------------------------------------
    public void ReloadOrRecalculateSingleCollider(AlphaMeshCollider target)
    {
        if (!target.CanReloadCollider)
        {
            return;
        }

        string        colliderMeshPath = target.FullColliderMeshPath();
        ColliderGroup colliderGroup    = FindColliderGroup(colliderMeshPath);

        if (colliderGroup == null || !IsColliderGroupValid(colliderGroup))
        {
            if (!target.CanRecalculateCollider)
            {
                return;
            }

            target.RecalculateCollider();
            UpdateSimilarCollidersAndGroupToTarget(target);
        }
        else
        {
            AssignValuesFromColliderGroup(target, colliderGroup);
        }
    }
Пример #3
0
	//-------------------------------------------------------------------------
	protected void UpdateSimilarCollidersAndGroupToTarget(AlphaMeshCollider target) {
		
		string colliderMeshPath = target.FullColliderMeshPath();
#if UNITY_4_AND_LATER
		object[] alphaMeshColliders = GameObject.FindObjectsOfType(typeof(AlphaMeshCollider));
#else
		object[] alphaMeshColliders = GameObject.FindSceneObjectsOfType(typeof(AlphaMeshCollider));
#endif

		ColliderGroup colliderGroup = FindColliderGroup(colliderMeshPath);
		if (colliderGroup == null) {
			// add new group.
			colliderGroup = new ColliderGroup();
			colliderGroup.mFullColliderMeshPath = colliderMeshPath;
			mColliderGroups.Add(colliderGroup);
		}
		
		AssignValuesFromInstanceToGroup(target, colliderGroup);
		
		colliderGroup.mAlphaMeshColliderObjects = new List<WeakReference>();
		foreach (AlphaMeshCollider collider in alphaMeshColliders)
		{
			if (collider.FullColliderMeshPath().Equals(colliderMeshPath)) {
				
				colliderGroup.mAlphaMeshColliderObjects.Add(new WeakReference(collider));
				
				// reassign previously calculated values.
				AssignValuesFromColliderGroup(collider, colliderGroup);
			}
		}
	}
Пример #4
0
	//-------------------------------------------------------------------------
	public void ReloadOrRecalculateSingleCollider(AlphaMeshCollider target) {
		if (!target.CanReloadCollider)
			return;
		
		string colliderMeshPath = target.FullColliderMeshPath();
		ColliderGroup colliderGroup = FindColliderGroup(colliderMeshPath);
		if (colliderGroup == null || !IsColliderGroupValid(colliderGroup)) {
			if (!target.CanRecalculateCollider)
				return;
			
			target.RecalculateCollider();
			UpdateSimilarCollidersAndGroupToTarget(target);
		}
		else {
			AssignValuesFromColliderGroup(target, colliderGroup);
		}
	}