Exemple #1
0
        public void DeleteAll()
        {
            sh.Clear();

            foreach (RoomLayer rl in roomLayers)
            {
                if (rl is ObjectLayer)
                {
                    ObjectLayer ol = rl as ObjectLayer;
                    ol.Objects.Clear();
                }
            }
        }
        public void Clear()
        {
            var spatialHash = new SpatialHash <int>(16);

            var rectA          = new Rectangle(-2, -2, 2, 2);
            var rectATransform = new Transform2D(new Vector2(-8, -8));

            var rectB          = new Rectangle(-2, -2, 2, 2);
            var rectBTransform = new Transform2D(new Vector2(8, 8));

            spatialHash.Insert(0, rectA, rectATransform);
            spatialHash.Insert(1, rectB, rectBTransform);

            spatialHash.Clear();

            spatialHash.Retrieve(0, rectA, rectATransform).Should().HaveCount(0);
        }
    private void Update()
    {
        if (clearing)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Clear();
        }

        ComputeDensityPressure();
        ComputeForces();
        Integrate();
        ComputeColliders();
        ApplyPosition();
        hash.Clear();
    }
Exemple #4
0
 /// <summary>
 /// removes all colliders from the SpatialHash
 /// </summary>
 public static void Clear()
 {
     _spatialHash.Clear();
 }