예제 #1
0
    public void SetContact(GameObject go, Vector2 newContact)
    {
        CollisionUnit collision = null;

        foreach (CollisionUnit col in currentCollisions)
        {
            if (col.GetGoName() == go.gameObject.name)
            {
                collision = col;
            }
        }

        if (collision != null)
        {
            collision.SetContact(newContact);
        }
    }
예제 #2
0
    public void TryAddCollision(CollisionUnit currentGo)
    {
        bool colExist = false;

        foreach (CollisionUnit col in currentCollisions)
        {
            if (col.GetGoName() == currentGo.GetGoName())
            {
                colExist = true;
                break;
            }
        }

        if (colExist == false)
        {
            currentCollisions.Add(currentGo);
        }
    }
예제 #3
0
    public void Remove(GameObject go)
    {
        CollisionUnit toRemuve = null;

        foreach (CollisionUnit col in currentCollisions)
        {
            if (col.GetGoName() == go.name)
            {
                toRemuve = col;
                break;
            }
        }

        if (toRemuve != null)
        {
            currentCollisions.Remove(toRemuve);
        }
    }