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

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

            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();
        }
예제 #2
0
        // Use this for initialization
        public void Init()
        {
            ChecksumExtractor.Init(this);

            Settings.ContinuousPhysics = SpeculativeContacts;

            world = new SyncFrame.Physics2D.World(new TSVector2(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, TSCollision2D> >();

            instance = this;
            AddRigidBodies();
        }
예제 #3
0
 internal string GetChecksum(bool plain)
 {
     return(ChecksumExtractor.GetEncodedChecksum());
 }