コード例 #1
0
 public ProcessCollisionMechanicState(
     IRectangleCollisionMechanic rectangleCollisionMechanic,
     ImageToRectangleTransformationService imageToRectangleService)
 {
     CollisionMechanic       = rectangleCollisionMechanic ?? throw new ArgumentNullException(nameof(rectangleCollisionMechanic));
     ImageToRectangleService = imageToRectangleService ?? throw new ArgumentNullException(nameof(imageToRectangleService));
 }
コード例 #2
0
 public CreateOrUpdateIdentifiableCircularLocationState(
     RectangularFrameGeneratorService frameGeneratorService,
     ImageToRectangleTransformationService imageToRectangleTransformationService,
     string dialogLocationRelationLayerName)
 {
     FrameGeneratorService = frameGeneratorService ?? throw new ArgumentNullException(nameof(frameGeneratorService));
     ImageToRectangleTransformationService = imageToRectangleTransformationService ?? throw new ArgumentNullException(nameof(imageToRectangleTransformationService));
     DialogLocationRelationLayerName       = dialogLocationRelationLayerName;
 }
コード例 #3
0
        public ImageDataCollisionWrapper(
            TCharacter characterEntity,
            Action <TCharacter> onCollisionCallback,
            ImageToRectangleTransformationService imageToRectangleTransformationService
            )
        {
            if (characterEntity == null)
            {
                throw new ArgumentNullException(nameof(characterEntity));
            }
            CharacterEntity = characterEntity;

            if (onCollisionCallback == null)
            {
                throw new ArgumentNullException(nameof(onCollisionCallback));
            }
            OnCollisionCallback = onCollisionCallback;

            if (imageToRectangleTransformationService == null)
            {
                throw new ArgumentNullException(nameof(imageToRectangleTransformationService));
            }
            ImageToRectangle = imageToRectangleTransformationService;
        }
        public EnemyFollowPlayerAtCertainDistanceMechanic(
            AttractionMechanic attractionMechanics,
            FacePointMechanic facePointMechanics,
            ImageToRectangleTransformationService imageToRectangleTransformationService
            )
        {
            if (attractionMechanics == null)
            {
                throw new ArgumentNullException(nameof(attractionMechanics));
            }
            AttractionMechanics = attractionMechanics;

            if (facePointMechanics == null)
            {
                throw new ArgumentNullException(nameof(facePointMechanics));
            }
            FacePointMechanics = facePointMechanics;

            if (imageToRectangleTransformationService == null)
            {
                throw new ArgumentNullException(nameof(imageToRectangleTransformationService));
            }
            ImageToRectangle = imageToRectangleTransformationService;
        }
 public PlayerSpaceshipUpdateGameStateFactory(ISerializationAdapter serializationAdapter,
                                              ImageToRectangleTransformationService imageToRectangleTransformationService)
 {
     SerializationAdapter = serializationAdapter ?? throw new ArgumentNullException(nameof(serializationAdapter));
     ImageToRectangleTransformationService = imageToRectangleTransformationService ?? throw new ArgumentNullException(nameof(imageToRectangleTransformationService));
 }
コード例 #6
0
        private IEnumerable <DialogNode> GetDialogNodesWithBuildingLocations(IStateMachine <string, IGameSectorLayerService> machine)
        {
            /* 1. Get all extra layers with type circular location.
             * 2. Get the circular locations as rectangles
             *    that intersect with the images of "FramesWithCircularLocation"
             * 3.
             */
            var circularLocationsOfBuildings = machine.SharedContext
                                               .DataLayer
                                               .Layers
                                               .SelectMany(circularLocationList => circularLocationList.DataAsEnumerable <IdentifiableCircularLocation>())
                                               .Where(circularLocation => machine.SharedContext
                                                      .DataLayer
                                                      .ImageData
                                                      .Any(buildingImage => FramesWithCircularLocation().Any(
                                                               frameWithCircularLocationKeyValuePair => frameWithCircularLocationKeyValuePair.Key == buildingImage.SelectedFrame &&
                                                               frameWithCircularLocationKeyValuePair.Value.Intersects(ImageToRectangleTransformationService.TransformInRespectToCenter(buildingImage))
                                                               )));

            var dialogsWithSameIdAsCircularLocations = machine.SharedContext
                                                       .DataLayer
                                                       .Layers
                                                       .Where(l => l as IDialogService != null)
                                                       .Cast <IDialogService>()
                                                       .SelectMany(dialogService => circularLocationsOfBuildings.Select(circularLocation => dialogService.GetDialogNode(circularLocation.Id)));

            return(dialogsWithSameIdAsCircularLocations);
        }