public void SetupBehaviours(TileSet mobiles, TileSet statics, List<Func<Message, Message>> gameMessageReactor) { var player = mobiles.WithName(GameConstants.PLAYER); var chaseBehaviour = MonsterAi.ChasePlayer(player); //Setup player behaviour player.OnCollision.Add(collision => EatenByMonster(player, collision)); player.OnCollision.Add(collision => CrushedByBoulder(player, collision)); player.OnCollision.Add(collision => FellInHole(player, collision)); //Setup strong monster behaviour mobiles.WithType(GameConstants.STRONG_MONSTER).AddUpdateBehaviour(chaseBehaviour); mobiles.WithType(GameConstants.STRONG_MONSTER).AddCollisionRules( strongMonster => collision => CrushedByBoulder(strongMonster, collision)); mobiles.WithType(GameConstants.STRONG_MONSTER).AddCollisionRules( strongMonster => collision => FellInHole(strongMonster, collision)); //Setup weak monster behaviour mobiles.WithType(GameConstants.WEAK_MONSTER).AddUpdateBehaviour(chaseBehaviour); mobiles.WithType(GameConstants.WEAK_MONSTER).AddCollisionRules( weakMonster => collision => CrushedByBoulder(weakMonster, collision)); mobiles.WithType(GameConstants.WEAK_MONSTER).AddCollisionRules( weakMonster => collision => FellInHole(weakMonster, collision)); mobiles.WithType(GameConstants.WEAK_MONSTER).AddCollisionRules( weakMonster => collision => EatenByMonster(weakMonster, collision)); gameMessageReactor.Add(message => (Deaded(message, GameConstants.WEAK_MONSTER) || Deaded(message, GameConstants.PLAYER) || Deaded(message, GameConstants.STRONG_MONSTER)) ? statics[mobiles.WithName(message.Name).Location].BuildSplatMessage() : null); gameMessageReactor.Add(message => Deaded(message, GameConstants.HOLE) ? statics[mobiles.WithName(message.Name).Location].BuildCrashMessage() : null); //Setup boulder behaviour mobiles.WithType(GameConstants.BOULDER).AddCollisionRules(boulder => collision => Pushed(boulder,collision)); mobiles.WithType(GameConstants.BOULDER).AddCollisionRules(boulder => collision => FellInHole(boulder,collision)); //Setup hole behaviour mobiles.WithType(GameConstants.HOLE).AddCollisionRules(boulder => collision => CrushedByBoulder(boulder,collision)); }