Beispiel #1
0
 public GameProperties(Action <GameProperties> update, Action <GameProperties> rayCast, bool?grabbable,
                       InitialCollisionDetectedEventHandler <EntityCollidable> collisionHandler,
                       CollisionEndedEventHandler <EntityCollidable> collisionEndingHandler,
                       Action <GameModel> onTextureRipped  = null,
                       Action <GameModel> onTextureApplied = null)
 {
     this.update              = update;
     this.collisionHandler    = collisionHandler;
     this.endCollisionHandler = collisionEndingHandler;
     this.UpdateStateObject   = null;
     this.spaceUpdate         = null;
     this.grabbable           = grabbable;
     this.rayCastHit          = rayCast;
     this.onTextureRipped     = onTextureRipped;
     this.onTextureApplied    = onTextureApplied;
 }
Beispiel #2
0
        public override void EnableCollisionListening()
        {
            // If listener isn't already enabled
            if (this.listener != null)
            {
                return;
            }

            this.newCollisions   = new List <Int64>();
            this.endedCollisions = new List <Int64>();

            this.listener    = new InitialCollisionDetectedEventHandler <EntityCollidable>(CollisionHandler);
            this.endListener = new CollisionEndedEventHandler <EntityCollidable>(CollisionEndHandler);
            this.body.PhysicsEntity.CollisionInformation.Events.InitialCollisionDetected += this.listener;
            this.body.PhysicsEntity.CollisionInformation.Events.CollisionEnded           += this.endListener;
        }