Ejemplo n.º 1
0
 public Pawn(Position position, PawnColor pawnColor, PawnType pawnType, IMoveStrategy moveStrategy)
 {
     Position     = position;
     PawnColor    = pawnColor;
     PawnType     = pawnType;
     MoveStrategy = moveStrategy;
 }
Ejemplo n.º 2
0
        public IList <BotViewer> GetBots(Transform parent)
        {
            IList <BotViewer> bots = new List <BotViewer>();

            IEnumerator <IBotSettings> enumerator = resourcesManager.GamePrefabs
                                                    .GetBotsSettings()
                                                    .GetEnumerator();

            int i = 1;

            while (enumerator.MoveNext())
            {
                IBotSettings botSettings = enumerator.Current;

                Transform     botObj        = Object.Instantiate(botSettings?.Transform(), parent);
                Vector2       startPosition = GetStartPosition(i);
                IMoveStrategy moveStrategy  = _pullMoveStrategy.GetMoveStrategy(botSettings.Strategy());
                IState        state         = new Move(botSettings.Trap(), botSettings.HitBoxRadius());
                BotViewer     botViewerView = new BotViewer(botObj, startPosition, state, moveStrategy);

                bots.Add(botViewerView);

                i++;
            }

            enumerator.Dispose();

            return(bots);
        }
Ejemplo n.º 3
0
 public Boletus(Texture2D spritesheet, Dictionary <string, Rectangle> map, IMoveStrategy strategy) : base(spritesheet, map, strategy)
 {
     AddAnimation("Attack", new SpriteSheetAnimationData(new int[] { 1, 2 }, frameDuration: 0.3f));
     AddAnimation("Idle", new SpriteSheetAnimationData(new int[] { 0 }));
     AddAnimation("Walk", new SpriteSheetAnimationData(new int[] { 1, 2 }, frameDuration: 0.3f));
     PlayAnimation("Idle");
 }
Ejemplo n.º 4
0
 public void SetMovementStrategy(IMoveStrategy moveStrategy)
 {
     if (moveable)
     {
         moveable.MoveStrategy = moveStrategy;
     }
 }
Ejemplo n.º 5
0
        public StrategyResult CalculateResult(IMoveStrategy opponentsStrategy)
        {
            if (opponentsStrategy is RockStrategy) return StrategyResult.Won;

            if (opponentsStrategy is ScissorsStrategy) return StrategyResult.Lost;

            return StrategyResult.Drawn;
        }
Ejemplo n.º 6
0
 public Moveable(double velocity, double maxVelocity, double rPM, double maxRPM, IShape shape, IMoveStrategy mover)
 {
     Velocity    = velocity;
     MaxVelocity = maxVelocity;
     RPM         = rPM;
     MaxRPM      = maxRPM;
     Shape       = shape;
     Mover       = mover;
 }
Ejemplo n.º 7
0
 public void ToggleHint()
 {
     _isHintActivated = !_isHintActivated;
     if (_isHintActivated)
     {
         _moveStrategy = _moveStrategy ?? new PierreDellacherieOnePiece();
         DrawHint();
     }
 }
Ejemplo n.º 8
0
        public void Move()
        {
            IMoveStrategy strategy = MoveStrategies.Where(x => x.Direction == CurrentPosition.Direction).FirstOrDefault();

            if (strategy != null)
            {
                strategy.Execute(this);
            }
        }
Ejemplo n.º 9
0
 private void UpdateStrategy()
 {
     if (_health < 20)
         _strategy = _factory.GetMoveStrategy(MoveStrategy.Crawl);
     else if (_health < 40)
         _strategy = _factory.GetMoveStrategy(MoveStrategy.Walk);
     else
         _strategy = _factory.GetMoveStrategy(MoveStrategy.Run);
 }
Ejemplo n.º 10
0
 public FrisbeeRenderer(Configs configs, FrisbeeFactory factory, Models models, IMoveStrategy move, ResourceMgr resources)
 {
     this.GameObj = GameObject.Instantiate(
         resources.frisbeePrefab,
         configs.DefaultFrisbeePos,
         Quaternion.Euler(0, 0, 0)
         );
     this.localController = this.GameObj.AddComponent <FrisbeeController>();
     this.localController.Inject(this, factory, models);
     this.Move = move;
 }
Ejemplo n.º 11
0
        public BotViewer(Transform botObj
                         , Vector2 startPosition
                         , IState state
                         , IMoveStrategy moveStrategy)
        {
            _transform     = botObj;
            _startPosition = startPosition;
            _moveStrategy  = moveStrategy;

            _state = state;
        }
Ejemplo n.º 12
0
 public GameBot(
     Guid gameId,
     Guid playerId,
     GameHttpClient gameClient,
     IMoveStrategy moveStrategy
     )
 {
     this.gameId       = gameId;
     this.playerId     = playerId;
     this.gameClient   = gameClient;
     this.moveStrategy = moveStrategy;
 }
Ejemplo n.º 13
0
        private void ResetGame()
        {
            _moveStrategy = new BruteForceHeuristicsStrategy(9);
            this.panelBoard.Controls.Clear();
            CreateTicTacToeBoard();
            _game = new TicTacToeGame();

            if (chkComputerGoFirst.Checked)
            {
                DoComputerMove(-1);
            }
        }
Ejemplo n.º 14
0
    public void Shoot(IMoveStrategy moveStrategy, Vector2 spawnPosition)
    {
        if (canShoot)
        {
            Projectile newGameObject = GameObject.Instantiate(projectilePrefab, spawnPosition, Quaternion.identity) as Projectile;

            moveStrategy.ControlledTransform = newGameObject.transform;
            newGameObject.SetMovementStrategy(moveStrategy);

            reloadTimer = 0;
            canShoot    = false;
        }
    }
Ejemplo n.º 15
0
 public override void onPickUp(Character c, float duration)
 {
     base.onPickUp(c, duration);
     if (defaultStrategy == null)
     {
         defaultStrategy = c.moveStrategy;
     }
     c.moveStrategy = new SlowMoveHalf();
     if (c is Player p)
     {
         p.addItem = this;
     }
 }
Ejemplo n.º 16
0
        public FuzzyLocationFeed(GeoCoordinate currentLocation, IMoveStrategy moveStrategy, int movementThreshold)
        {
            _observable = moveStrategy.Scan(
                Tuple.Create(currentLocation, currentLocation), (acc, cur) =>
            {
                double distance = acc.Item1.GetDistanceTo(cur);
                if (distance >= movementThreshold)
                {
                    return(Tuple.Create(cur, cur));
                }

                return(Tuple.Create(acc.Item1, cur));
            }).Where(pair => pair.Item1 == pair.Item2).Select(pair => pair.Item1);
        }
Ejemplo n.º 17
0
    public PriestRenderer(int id, Vector3 pos, Materials mats, IMoveStrategy moveStrategy, MainSceneController globalController, Configs configs)
    {
        this.gameObj = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        MeshRenderer meshRenderer = this.gameObj.GetComponent <MeshRenderer>();

        meshRenderer.material = mats.Priest;
        Transform transform = this.gameObj.GetComponent <Transform>();

        transform.position   = pos;
        transform.localScale = configs.CharScale;
        PriestController localController = this.gameObj.AddComponent <PriestController>();

        localController.Inject(id, this, globalController, configs);
        this.moveStrategy     = moveStrategy;
        this.globalController = globalController;
    }
Ejemplo n.º 18
0
    public BoatRenderer(Vector3 pos, Materials mats, IMoveStrategy moveStrategy, MainSceneController globalController, Configs configs)
    {
        this.gameObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
        MeshRenderer meshRenderer = this.gameObj.GetComponent <MeshRenderer>();

        meshRenderer.material = mats.Boat;
        Transform transform = this.gameObj.GetComponent <Transform>();

        transform.position   = pos;
        transform.localScale = configs.BoatScale;
        BoatController localController = this.gameObj.AddComponent <BoatController>();

        localController.Inject(this, globalController);
        this.moveStrategy     = moveStrategy;
        this.globalController = globalController;
    }
Ejemplo n.º 19
0
        public GenericBot(IClient client, IMoveStrategy moveStrategy, ISpecialStrategy specialStrategy)
        {
            _client = client;

            SpecialStrategy = specialStrategy;
            MoveStrategy    = moveStrategy;

            _client.RoundStarted            += _client_OnRoundStarted;
            _client.GameStarted             += client_OnGameStarted;
            _client.GameFinished            += _client_OnGameFinished;
            _client.GameOver                += _client_OnGameOver;
            _client.ContinuousEffectToggled += _client_OnContinuousEffectToggled;

            _stopEvent            = new ManualResetEvent(false);
            _handleNextPieceEvent = new ManualResetEvent(false);

            SleepTime = 75;
            Activated = false;
        }
Ejemplo n.º 20
0
 public JobService(
     IMoveStrategy moveStrategy
     , JobDbContext dbContext
     , IMapper mapper
     , ILogger <JobService> logger
     , IHttpContextAccessor httpContextAccessor
     , IServiceOrderService serviceOrderService
     , IHomeFrontEventService homeFrontEventService
     , IEventBus eventBus
     , IIntegrationEventLogService eventLogService) : base(dbContext, mapper, httpContextAccessor)
 {
     _moveStrategy          = moveStrategy ?? throw new ArgumentNullException("moveStrategy");
     _dbContext             = dbContext ?? throw new ArgumentNullException("dbContext");
     _mapper                = mapper ?? throw new ArgumentNullException("mapper");
     _logger                = logger ?? throw new ArgumentNullException("logger");
     _eventBus              = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     _serviceOrderService   = serviceOrderService ?? throw new ArgumentNullException("serviceOrderService");
     _eventLogService       = eventLogService ?? throw new ArgumentNullException("eventLogService");
     _homeFrontEventService = homeFrontEventService ?? throw new ArgumentNullException("homeFrontEventService");
 }
Ejemplo n.º 21
0
 public override void Update(GameTime gameTime)
 {
     if (!Hidden)
     {
         healthTimer?.Update(gameTime);
         //Got hurt - go into rage mode (if we are not already in rage mode)
         if (currentHealth < maxHealth)
         {
             if (currentStrategy.GetType() != typeof(RageStrategy))
             {
                 currentStrategy = new RageStrategy();
             }
         }
         if (attacking)
         {
             MoveableBodyState = MoveableBodyStates.Attacking;
         }
         //Debug.WriteLine(gameTime.TotalGameTime.ToString() + " " + MoveableBodyState);
         base.Update(gameTime);
     }
 }
Ejemplo n.º 22
0
 public MainSceneController()
 {
     this.configs    = new Configs();
     this.materials  = new Materials(configs);
     this.characters = new Characters(configs);
     new BankRenderer(this.configs.LeftBankPos, this.materials, this.configs);
     new BankRenderer(this.configs.RightBankPos, this.materials, this.configs);
     this.boatMove = new LinearMove2D(this.configs.BoatMoveSpeed);
     this.boat     = new BoatRenderer(this.configs.RightBoatPos, this.materials, this.boatMove.Clone(), this, this.configs);
     this.priests  = new PriestRenderer[this.configs.PeopleNum];
     this.evils    = new EvilRenderer[this.configs.PeopleNum];
     this.charMove = new ParabolicMove2D(this.configs.CharMoveSummit, this.configs.CharMoveSpeed);
     for (int i = 0; i < this.configs.PeopleNum; i++)
     {
         this.priests[i] = new PriestRenderer(i, this.configs.RightCharPos[i + 2], materials, this.charMove.Clone(), this, this.configs);
     }
     for (int i = 0; i < this.configs.PeopleNum; i++)
     {
         this.evils[i] = new EvilRenderer(i, this.configs.RightCharPos[i + 2 + this.configs.PeopleNum], materials, this.charMove.Clone(), this, this.configs);
     }
     this.result = new ResultRenderer(this.configs.ResultPlanePos, this.configs.ResultPlaneRotation, this.configs.ResultPlaneScale, this.materials);
 }
Ejemplo n.º 23
0
Archivo: Player.cs Proyecto: gretra/Opp
 public void setStrategy(IMoveStrategy algorithm)
 {
     this.algorithm = algorithm;
 }
 public Motorbike()
 {
     _move = new DriveStrategy();
 }
Ejemplo n.º 25
0
 public Train()
 {
     _move = new DriveStrategy();
 }
Ejemplo n.º 26
0
 public Pegas(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
Ejemplo n.º 27
0
 public void SetStrategy(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
Ejemplo n.º 28
0
        //
        //public void Awake()
        //{
        //    var a = Camera.current.GetComponent<ChangeStrategyManager>();
        //    a.Subscribe(this);
        //}

        //public void OnCompleted() => throw new NotImplementedException();
        //public void OnError(Exception error) => throw new NotImplementedException();
        //

        //public void OnNext(IMoveStrategy value)
        //{
        //    SetStrategy(value);
        //}

        public void SetStrategy(IMoveStrategy moveStrategy) => _moveStrategy = moveStrategy;
Ejemplo n.º 29
0
 public Troll(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
Ejemplo n.º 30
0
 public SequenceGenerator(Board board, IMoveStrategy moveStrategy, int pathSize)
 {
     _board = board;
     _moveStrategy = moveStrategy;
     _pathSize = pathSize;
 }
Ejemplo n.º 31
0
 public PlayGameMoveHandler(IMoveStrategy moveStrategy, int sleepDuration)
 {
     _moveStrategy = moveStrategy;
     _sleepDuration = sleepDuration;
 }
Ejemplo n.º 32
0
 public CompositeMove(IMoveStrategy strategy1, IMoveStrategy strategy2)
 {
     _moveStrategies = new[] { strategy1, strategy2 };
 }
Ejemplo n.º 33
0
 public Elf(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
Ejemplo n.º 34
0
 public Player(IMoveStrategy strategy, PlayerTypeEnum type)
 {
     this.Strategy = strategy;
     this.Type     = type;
 }