Example #1
0
        public void RemoveCrate(Crate crate)
        {
            if (crate.IsStuck)
            {
                World.RemoveJoint(crate.MagnetJoint);
            }

            World.RemoveBody(crate.Body);
            _allGameOjbects.Remove(crate);
        }
Example #2
0
        private void AddCrates()
        {
            // Define a path that gives the placements of the crates
            var cratesPath = new Path();

            cratesPath.Add(new Vector2(160, 1000));
            cratesPath.Add(new Vector2(3500, 1000));

            // Split the path into 30 positions - this is where the crates go
            var positions = cratesPath
                            .SubdivideEvenly(30)
                            .Select(v3 => new Vector2(v3.X, v3.Y));

            foreach (var position in positions)
            {
                var crate = new Crate(this)
                {
                    Position = position
                };
                _crates.Add(crate);
                _allGameOjbects.Add(crate);
            }
        }
Example #3
0
        private void AddCrates()
        {
            // Define a path that gives the placements of the crates
            var cratesPath = new Path();
            cratesPath.Add(new Vector2(160, 1000));
            cratesPath.Add(new Vector2(3500, 1000));

            // Split the path into 30 positions - this is where the crates go
            var positions = cratesPath
                .SubdivideEvenly(30)
                .Select(v3 => new Vector2(v3.X, v3.Y));

            foreach (var position in positions)
            {
                var crate = new Crate(this) { Position = position };
                _crates.Add(crate);
                _allGameOjbects.Add(crate);
            }
        }
Example #4
0
        public void RemoveCrate(Crate crate)
        {
            if (crate.IsStuck)
            {
                World.RemoveJoint(crate.MagnetJoint);
            }

            World.RemoveBody(crate.Body);
            _allGameOjbects.Remove(crate);
        }