Exemplo n.º 1
0
        private void Rotate(bool anticlockwise = false)
        {
            IRotateStrategy strategy = RotateStrategies.Where(x => x.Direction == CurrentPosition.Direction).FirstOrDefault();

            if (strategy != null)
            {
                strategy.Execute(this, anticlockwise);
            }
        }
        //Set proper Rotation algorithm based on the chosen configuration
        private void SetRotation()
        {
            switch (boardConfig.rotationType)
            {
            case RotateType.Matrix:
                rotateStrategy = new MatrixRotate();
                break;

            case RotateType.Nintendo:
                rotateStrategy = new NESRotate();
                break;

            default:
                rotateStrategy = new MatrixRotate();
                break;
            }
        }
Exemplo n.º 3
0
        public static IRotateStrategy CreateRotateStrategy(Direction direction)
        {
            IRotateStrategy strategy = GetRotateStrategies().FirstOrDefault(x => x.Direction.Equals(direction));

            return(strategy);
        }