Пример #1
0
        // Use this for initialization
        public void Init()
        {
            ChecksumExtractor.Init(this);

            gameObjectMap = new Dictionary <IBody, GameObject>();
            collisionInfo = new Dictionary <RigidBody, Dictionary <RigidBody, FPCollision> >();

            CollisionSystemPersistentSAP collisionSystem = new CollisionSystemPersistentSAP();

            collisionSystem.EnableSpeculativeContacts = SpeculativeContacts;

            world = new World(collisionSystem);
            collisionSystem.world = world;

            world.physicsManager = this;
            world.Gravity        = Gravity;

            world.Events.BodiesBeginCollide += CollisionEnter;
            world.Events.BodiesStayCollide  += CollisionStay;
            world.Events.BodiesEndCollide   += CollisionExit;

            world.Events.TriggerBeginCollide += TriggerEnter;
            world.Events.TriggerStayCollide  += TriggerStay;
            world.Events.TriggerEndCollide   += TriggerExit;

            world.Events.RemovedRigidBody += OnRemovedRigidBody;

            instance = this;

            AddRigidBodies();
        }
        // Use this for initialization
        public void Init()
        {
            ChecksumExtractor.Init(this);

            Settings.ContinuousPhysics = SpeculativeContacts;

            world = new Spax.Physics2D.World(new FPVector2(Gravity.x, Gravity.y));
            ContactManager.physicsManager = this;

            world.BodyRemoved += OnRemovedRigidBody;
            world.ContactManager.BeginContact += CollisionEnter;
            world.ContactManager.StayContact  += CollisionStay;
            world.ContactManager.EndContact   += CollisionExit;

            gameObjectMap = new Dictionary <IBody, GameObject>();
            collisionInfo = new Dictionary <Physics2D.Body, Dictionary <Physics2D.Body, FPCollision2D> >();

            instance = this;
            AddRigidBodies();
        }
 internal string GetChecksum(bool plain)
 {
     return(ChecksumExtractor.GetEncodedChecksum());
 }