예제 #1
0
        public PhysicsSubsystem(IActorPhysicsFactory physicsFactory, IResourceDictionary resources, IBus bus)
        {
            _world = new World(Vector2.Zero);
            _actorMap = new Dictionary<Actor, IActorPhysics>();
            _actorBodies = new Dictionary<Actor, Body>();
            _dynamicActors = new List<Actor>();
            _queuedActions = new List<Func<Boolean>>();
            _physicsFactory = physicsFactory;
            _resources = resources;
            _bus = bus;
            _currentContacts = new List<Contact>();

            _world.ContactManager.BeginContact += OnBeginContact;
            //_world.ContactManager.EndContact += OnEndContact;
        }
예제 #2
0
파일: Game1.cs 프로젝트: HaKDMoDz/Zazumo
        protected override void RegisterPhysics(IActorPhysicsFactory physicsFactory, IResourceDictionary resourceDictionary)
        {
            base.RegisterPhysics(physicsFactory, resourceDictionary);

            physicsFactory.RegisterPhysicsFactory<ZazumoActor>(x => new ZazumoPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<TriangleEnemy>(x => new CharacterPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<EnemyActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<FrogActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<PowerUpActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<ProjectileActor>(x => new ProjectilePhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<WormholeActor>(x => new StarGatePhysics(x, resourceDictionary));
        }