Esempio n. 1
0
        public void InitializeGameState()
        {
            backGroundImage = new Entity(
                new StationaryShape(new Vec2F(0.0f, 0.0f), new Vec2F(1.0f, 1.0f)),
                new Image(Path.Combine("Assets", "Images", "SpaceBackground.png")));

            player = new Player();

            enemies      = new EntityContainer <Enemy>();
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));

            var sqr = new Squadron2();

            sqr.CreateEnemies(enemyStrides);
            enemies          = sqr.Enemies;
            movementStrategy = new ZigZagDown();

            playerShots = new EntityContainer();
            shotStride  = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(4);
        }
 public StandartTwoPlayerEngine(IRenderer renderer, IInputProvider input)
 {
     this._renderer         = renderer;
     this._input            = input;
     this._board            = new Board();
     this._movementStrategy = new NormalMovementStrategy();
 }
Esempio n. 3
0
 public FriendlyNPC(IPosition position, IStats stats, IMovementStrategy movementStrategy, string name = "Friendly McName")
 {
     this.Position         = position;
     this.Stats            = stats;
     this.MovementStrategy = movementStrategy;
     this.Name             = name;
 }
Esempio n. 4
0
 public ChessPiece(ChessPieceColor color, ChessPieceType type, Position position, IMovementStrategy movementStrategy)
 {
     Color    = color;
     Type     = type;
     Position = position;
     movement = movementStrategy;
 }
Esempio n. 5
0
 public StandartTwoPlayerEngine(IRenderer renderer, IInputProvider provider)
 {
     this.renderer         = renderer;
     this.board            = new Board.Board();
     this.input            = provider;
     this.movementStrategy = new NormalMovementStrategy();
 }
Esempio n. 6
0
 /// <summary>
 /// Create a new GamePiece
 /// </summary>
 /// <param name="sides">No of sides the game piece should have.</param>
 /// <param name="mainState">Default or alt state</param>
 /// <param name="visible">Set initial piece visibility</param>
 public GamePiece(int typeID, string typeName, IMovementStrategy movementStrategy, bool visible)
 {
     TypeID            = typeID;
     TypeName          = typeName;
     Visible           = visible;
     _movementStrategy = movementStrategy;
 }
 public TwoPlayerEngine(IRenderer render, IInputProvider inputProvider)
 {
     this.renderer         = render;
     this.input            = inputProvider;
     this.movementStrategy = new NormalMovementStrategy();
     this.board            = new TheBoard();
 }
 public StandardTwoPlayerEngine(IRenderer renderer, IInputProvider inputProvider)
 {
     this.renderer = renderer;
     this.input = inputProvider;
     movementStrategy = new NormalMovementStrategy();
     this.board = new Board();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AI"/> class.
 /// </summary>
 /// <param name="pos">the starting enemy pos</param>
 /// <param name="type">the type of enemy</param>
 /// <param name="rotation">the starting rotation of the enemy</param>
 /// <param name="walls">the collections of points that impair the enemy's sight</param>
 public AI(Point2D pos, EnemyType type, double rotation, HashSet <Point2D> walls)
 {
     this._current   = pos;
     this._strategy  = this.GetStrategy(type);
     this._rotation  = rotation;
     this.GetWallSet = walls;
 }
 protected BaseChessEngine(IRenderer renderer, IInputProvider inputProvider, IMovementStrategy movementStrategy)
 {
     this.Renderer = renderer;
     this.MovementStrategy = movementStrategy;
     this.Input = inputProvider;
     this.Board = new Board();
     this.GameState = GameState.Playing;
 }
Esempio n. 11
0
 public ChessStandardGame()
 {
     this.gameBoard = new StandardBoardGame();
     this.whitePlayer = new Player("White Player", FigureColor.White, State.OnTheMove);
     this.blackPlayer = new Player("Black Player", FigureColor.Black, State.NotOnTheMove);
     this.renderer = new Renderer();
     this.strategy = new MovementStrategy();
 }
Esempio n. 12
0
 public ChessStandardGame()
 {
     this.gameBoard   = new StandardBoardGame();
     this.whitePlayer = new Player("White Player", FigureColor.White, State.OnTheMove);
     this.blackPlayer = new Player("Black Player", FigureColor.Black, State.NotOnTheMove);
     this.renderer    = new Renderer();
     this.strategy    = new MovementStrategy();
 }
Esempio n. 13
0
 public StandardTwoPlayerEngine(IRenderer renderer, IInputProvider inputProvider, bool testing = false)
 {
     this.renderer         = renderer;
     this.input            = inputProvider;
     this.movementStrategy = new NormalMovementStrategy();
     this.board            = new Board();
     this.testing          = testing;
 }
Esempio n. 14
0
        public Invasion()
        {
            MaxEnemies = 11;
            Enemies    = new EntityContainer <Enemy>(MaxEnemies);
            timer      = new GameTimer(60, 60);

            MovementStrategy = new ZigZagDown();
        }
Esempio n. 15
0
 private void InitMovement(
     IMovementStrategy movement,
     IStatus status,
     float speed,
     IInputService input)
 {
     this.movement = movement;
     movement.Construct(status, speed, input);
 }
Esempio n. 16
0
 public StandardTwoPlayerEngine(
     IRenderer renderer, IInputProvider inputProvider)
 {
     this._renderer           = renderer;
     this._inputProvider      = inputProvider;
     this._board              = new Board.Board();
     this._movementStrategies = new NormalMovementStrategy();
     this._inPassing          = new List <IFigure>();
 }
Esempio n. 17
0
 public Boss()
 {
     Enemies       = new EntityContainer <Enemy>();
     size          = new Vec2F(0.3f, 0.3f);
     startPosition = new Vec2F(
         0.5f - size.X / 2.0f,
         1 - size.X);
     MovementStrategy = new ZigZagDown();
 }
Esempio n. 18
0
 public HostileNPC(IPosition position, IStats stats, IMovementStrategy movementStrategy, string name = "Hostile McGuy", int droppedGold = 0)
 {
     this.Position     = position;
     this.Stats        = stats;
     this.MoveStrategy = movementStrategy;
     this.Name         = name;
     this.DroppedGold  = droppedGold;
     DroppedExperience = stats.MaxHealth * stats.Damage;
 }
        public StandardTwoPlayerEngine(IRenderer renderer, IInputProvider inputProvider)
        {
            this.renderer = renderer;
            this.input    = inputProvider;

            this.movementStrategy = new NormalMovementStrategy();
            this.board            = new Board();
            this.players          = new List <IPlayer>();
            this.movedFigures     = new MovedFigures();
        }
Esempio n. 20
0
    //private static int number = 0;
    //private int index = 0;

    public override void Awake()
    {
        base.Awake();
        hashAttack = Animator.StringToHash("Attack");
        hashDeath  = Animator.StringToHash("Death");
        ownHealth  = GetComponent <Health>();
        movement   = new NavMeshMovement();
        //number++;
        //index = number;
        //Index = index;
    }
Esempio n. 21
0
 /// <summary>
 /// If the second paramter is passed null then the default movement strategy is used
 /// Use this move method if you want to change the strategy after the Rover object has been instantiated
 /// </summary>
 /// <param name="command"></param>
 /// <param name="strategy"></param>
 public void move(char command, IMovementStrategy strategy)
 {
     if (strategy != null)
     {
         strategy.move(command);
     }
     else
     {
         defaultMoveStrategy(command);
     }
 }
 public IChessEngine GetEngine(GameType gameType, IRenderer renderer, IInputProvider inputProvider, IMovementStrategy movementStrategy)
 {
     switch (gameType)
     {
         case GameType.Chess:
             return new StandartTwoPlayerEngine(renderer, inputProvider, movementStrategy);
         case GameType.KingSurvival:
             return new KingSurvivalEngine(renderer, inputProvider, movementStrategy);
         default:
             throw new ArgumentException();
     }
 }
Esempio n. 23
0
    public void Construct(
        IInputService input,
        IStatus status,
        IMovementStrategy movement,
        float moveSpeed)
    {
        MaxHealth = health;

        InitMovement(movement, status, moveSpeed, input);
        InitCasting();
        InitInputHandlers(input);
        InitStatus(status);
    }
Esempio n. 24
0
        public SquadronBox(int ratio, IMovementStrategy desiredMovement)
        {
            // Create an empty container for the enemies.
            Enemies = new EntityContainer <Enemy>(MaxEnemies);

            // Ratio for choosing enemy strides
            strongEnemyRatio = ratio;

            // The chosen movement strategy
            movementStrategy = desiredMovement;

            // Instantiate the enemies.
            CreateEnemies();
        }
Esempio n. 25
0
        public StandardTwoPlayerEngine(ContainerConsole container)
        {
            movementStrategy  = new NormalMovementStrategy();
            renderer          = new ConsoleRenderer(container);
            selectedPositions = new List <Position>();
            scoreBoard        = new ScoreBoard(container);
            board             = new Board();

            // main event that drives the game
            renderer.Console.MouseMove += MouseClickOnBoard;

            // keyboard
            keyboardHandler     = new KeyboardHandler(this);
            container.IsFocused = true;
            container.Components.Add(keyboardHandler);
        }
Esempio n. 26
0
    void Start()
    {
        Unit = GetComponent <Unit>();

        // Events that cause the strategy to change
        Unit.OnCelestialBodyArrival += cb => this.Strategy = Strategy.UnitArrivedAtCelestialBody(cb);
        Unit.OnCelestialBodyMoveTo  += cb => this.Strategy = Strategy.UnitMoveToCelestialBody(cb);

        if (Unit.IsOnCelestialBody())
        {
            Strategy = new MovementStrategyOrbitingCelestialBody(Unit, Unit.GetCurrentCelestialBody());
        }
        else
        {
            Strategy = new MovementStrategyMoveToCelestialBody(Unit, Unit.GetTargetCelestialBody());
        }
    }
Esempio n. 27
0
 public Piece BuildPiece(bool white, int xx, int yy, IMovementStrategy str)
 {
     p = new King(xx, yy);
     if (white)
     {
         p.texture.ImageSource = new BitmapImage(new Uri("images\\king_w.png", UriKind.Relative));
         p.rect.Fill           = p.texture;
         p.c   = 'K';
         p.ims = str;
     }
     else
     {
         p.texture.ImageSource = new BitmapImage(new Uri("images\\king_b.png", UriKind.Relative));
         p.rect.Fill           = p.texture;
         p.c   = 'k';
         p.ims = str;
     }
     return(p);
 }
Esempio n. 28
0
        private ISquadron GetSquadron(SquadronTypes desiredSquadron)
        {
            IMovementStrategy chosenMovement =
                GetMovement(PossibleMovements[Rand.Next(PossibleMovements.Length)]);

            switch (desiredSquadron)
            {
            case (SquadronTypes.Box):
                return(new SquadronBox(StrongEnemyRatio, chosenMovement));

            case (SquadronTypes.Line):
                return(new SquadronLine(StrongEnemyRatio, chosenMovement));

            case (SquadronTypes.Diamonds):
                return(new SquadronDiamonds(StrongEnemyRatio, chosenMovement));

            default:
                throw new ArgumentException("Type conflict setting squadron.");
            }
        }
Esempio n. 29
0
        public Game()
        {
            gameTimer  = new GameTimer(60, 60);
            win        = new Window("Galaca", 500, AspectRatio.R1X1);
            backGround = new Image(Path.Combine("Assets", "Images", "SpaceBackground.png"));
            player     = new Player();

            enemies      = new EntityContainer <Enemy>();
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));

            var sqr = new Squadron2();

            sqr.CreateEnemies(enemyStrides);
            enemies          = sqr.Enemies;
            movementStrategy = new ZigZagDown();

            playerShots = new EntityContainer();
            shotStride  = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(4);

            eventBus = new GameEventBus <object>();
            eventBus.InitializeEventBus(new List <GameEventType>()
            {
                GameEventType.InputEvent,
                GameEventType.WindowEvent,
                GameEventType.PlayerEvent
            });

            win.RegisterEventBus(eventBus);
            eventBus.Subscribe(GameEventType.InputEvent, this);
            eventBus.Subscribe(GameEventType.WindowEvent, this);
        }
Esempio n. 30
0
 public abstract ICollection <IMovement> Move(IMovementStrategy strategy);
Esempio n. 31
0
 public abstract ICollection<IMovement> Move(IMovementStrategy strategy);
 public KingSurvivalEngine(IRenderer renderer, IInputProvider inputProvider, IMovementStrategy movementStrategy)
     : base(renderer, inputProvider, movementStrategy)
 {
 }
Esempio n. 33
0
 public King(char symbol, IPosition position, IMovementStrategy movementStrategy)
     : base(symbol, position, movementStrategy)
 {
     this.MovesCount = InitialMovesCount;
 }
Esempio n. 34
0
        public override ICollection<IMovement> Move(IMovementStrategy strategy)
        {
            var movememts = strategy.GetMovements(this.GetType().Name);

            return movememts;
        }
Esempio n. 35
0
 public Pawn(char symbol, IPosition position, IMovementStrategy movementStrategy)
     : base(symbol, position, movementStrategy)
 {
 }
 public Breakthrough(IMovementStrategy movementStrategy)
 {
     _movementStrategy = movementStrategy;
     InitializeBoard();
     _currentPlayer = PlayerType.White;
 }
Esempio n. 37
0
 public ICollection<IMovement> Move(IMovementStrategy strategy)
 {
     return strategy.Moves(this.Type);
 }
 public StandartTwoPlayerEngine(IRenderer renderer, IInputProvider inputProvider, IMovementStrategy movementStrategy)
     : base(renderer, inputProvider, movementStrategy)
 {
 }
Esempio n. 39
0
 public override ICollection<IMovement> Move(IMovementStrategy strategy)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 40
0
 public void SetMovementStrategy(MovementStrategyEnum movementStrategy)
 {
     _movementStrategy = _movementStrategyInvoker.GetMovementStrategy(movementStrategy);
 }
Esempio n. 41
0
 public override ICollection <IMovement> Move(IMovementStrategy movementStrategy)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 42
0
 public CPDefault(List <Spell> spells, ICombatClass spellStrategy, IMovementStrategy movementStrategy)
 {
     Spells           = spells;
     SpellStrategy    = spellStrategy;
     MovementStrategy = movementStrategy;
 }
Esempio n. 43
0
 public override ICollection<IMovement> Move(IMovementStrategy movementStrategy)
 {
     return movementStrategy.GetMovements(this.GetType().Name);
 }
Esempio n. 44
0
 public override ICollection <IMovement> Move(IMovementStrategy strategy)
 {
     return(strategy.GetMovements(this.GetType().Name));
 }
 protected Figure(char symbol, IPosition position, IMovementStrategy movementStrategy)
 {
     this.Symbol = symbol;
     this.Position = position;
     this.MovementStrategy = movementStrategy;
 }