Exemple #1
0
        public void Move(MovementDirectionEnum movementDirection)
        {   //BAT
            //Define Behavior
            System.Windows.Point    batLocation             = _imageManager.GetImageLocation(EnemyImage);
            BehaviorPropertiesModel behaviorPropertiesModel = new BehaviorPropertiesModel()
            {
                EnemyName         = EnemyName,
                MovementDirection = movementDirection,
                Target            = _playerLocationPoint,
                Chaser            = batLocation,
            };

            var behavioralDirection = _selectedBehavior.ApplyBehavior(behaviorPropertiesModel);
            //Confirm Castle Wall Boundaries reached
            var _imageObjectShapeModel        = _castle.GetCanvasLocationAndDimensionsOuterLimits();
            var castleSideWallBoundaryReached = _imageManager.ImageIsBeyondBoundaries_Adaptor(_imageObjectShapeModel, EnemyImage);

            var selectedMovementDirection = (castleSideWallBoundaryReached == MovementDirectionEnum.MovementClear_NoBoundariesReached)
                                            ? behavioralDirection
                                            :_movementDirectionManager.GetOppositeDirection(castleSideWallBoundaryReached);

            //Set Movement
            MovementDirection = selectedMovementDirection;
            //Process Movement
            System.Drawing.Point newLocationPoint      = _movementStrategy.GetMovement(MovementDirection);
            System.Drawing.Point newSpeedLocationPoint = _imageManager.ModifyLocationPointValues(newLocationPoint, _speedMovement);
            _imageManager.SetNewLocationImage(EnemyImage, newSpeedLocationPoint);
        }