示例#1
0
 public Car(Model model, string playerId, string playerName, ICollisionStrategy collisionStrategy, GameStateManager gameStateManager, Color color, float x = 0, float y = 0)
     : base(model, true)
 {
     _collisionStrategy = collisionStrategy;
     _gameStateManager  = gameStateManager;
     Color       = color;
     Model       = model;
     Width       = GameConstants.PlayerWidth;
     ModelRotate = 180;
     X           = x;
     Y           = y;
     MaxVY       = GameConstants.PlayerMaxSpeed;
     Id          = playerId;
     Type        = GameObjectType.Player;
     PlayerName  = playerName;
     MaxX        = 6f;
 }
示例#2
0
        public CarAgent(Model model, float modelRotate, float width, float height, bool opposite,
                        GameObjectType type, IControlStrategy drivingStrategy, ICollisionStrategy collisionStrategy)
            : base(model, true)
        {
            Width             = width;
            HardCodedHeight   = height;
            ModelRotate       = modelRotate;
            OppositeDirection = opposite;
            if (drivingStrategy != null)
            {
                _strategy            = drivingStrategy;
                _strategy.GameObject = this;
            }

            _collisionStrategy = collisionStrategy;

            Type = type;
            Id   = Guid.NewGuid().ToString();
        }
 public PlayerCollisionStrategy(ICollisionStrategy basicCollisionStrategy, ICollisionStrategy borderCollisionStrategy)
 {
     _borderCollisionStrategy = borderCollisionStrategy ?? throw new ArgumentNullException(nameof(borderCollisionStrategy));
     _basicCollisionStrategy  = basicCollisionStrategy ?? throw new ArgumentNullException(nameof(basicCollisionStrategy));
 }