コード例 #1
0
ファイル: Pawn.cs プロジェクト: Polskipepek/BellyFish
 public Pawn(Position position, PawnColor pawnColor, PawnType pawnType, IMoveStrategy moveStrategy)
 {
     Position     = position;
     PawnColor    = pawnColor;
     PawnType     = pawnType;
     MoveStrategy = moveStrategy;
 }
コード例 #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);
        }
コード例 #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");
 }
コード例 #4
0
 public void SetMovementStrategy(IMoveStrategy moveStrategy)
 {
     if (moveable)
     {
         moveable.MoveStrategy = moveStrategy;
     }
 }
コード例 #5
0
        public StrategyResult CalculateResult(IMoveStrategy opponentsStrategy)
        {
            if (opponentsStrategy is RockStrategy) return StrategyResult.Won;

            if (opponentsStrategy is ScissorsStrategy) return StrategyResult.Lost;

            return StrategyResult.Drawn;
        }
コード例 #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;
 }
コード例 #7
0
ファイル: PlayerGridView.xaml.cs プロジェクト: SinaC/TetriNET
 public void ToggleHint()
 {
     _isHintActivated = !_isHintActivated;
     if (_isHintActivated)
     {
         _moveStrategy = _moveStrategy ?? new PierreDellacherieOnePiece();
         DrawHint();
     }
 }
コード例 #8
0
ファイル: Robot.cs プロジェクト: milbreyrigor/Rigor.ToyRobot
        public void Move()
        {
            IMoveStrategy strategy = MoveStrategies.Where(x => x.Direction == CurrentPosition.Direction).FirstOrDefault();

            if (strategy != null)
            {
                strategy.Execute(this);
            }
        }
コード例 #9
0
ファイル: Monster.cs プロジェクト: j4k0bk/FlyweightPattern
 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);
 }
コード例 #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;
 }
コード例 #11
0
ファイル: BotViewer.cs プロジェクト: Zerogorn/Runner
        public BotViewer(Transform botObj
                         , Vector2 startPosition
                         , IState state
                         , IMoveStrategy moveStrategy)
        {
            _transform     = botObj;
            _startPosition = startPosition;
            _moveStrategy  = moveStrategy;

            _state = state;
        }
コード例 #12
0
ファイル: GameBot.cs プロジェクト: Niklasef/mtrain
 public GameBot(
     Guid gameId,
     Guid playerId,
     GameHttpClient gameClient,
     IMoveStrategy moveStrategy
     )
 {
     this.gameId       = gameId;
     this.playerId     = playerId;
     this.gameClient   = gameClient;
     this.moveStrategy = moveStrategy;
 }
コード例 #13
0
        private void ResetGame()
        {
            _moveStrategy = new BruteForceHeuristicsStrategy(9);
            this.panelBoard.Controls.Clear();
            CreateTicTacToeBoard();
            _game = new TicTacToeGame();

            if (chkComputerGoFirst.Checked)
            {
                DoComputerMove(-1);
            }
        }
コード例 #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;
        }
    }
コード例 #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;
     }
 }
コード例 #16
0
ファイル: FuzzyLocationFeed.cs プロジェクト: naymore/jarvis
        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);
        }
コード例 #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;
    }
コード例 #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;
    }
コード例 #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;
        }
コード例 #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");
 }
コード例 #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);
     }
 }
コード例 #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);
 }
コード例 #23
0
ファイル: Player.cs プロジェクト: gretra/Opp
 public void setStrategy(IMoveStrategy algorithm)
 {
     this.algorithm = algorithm;
 }
コード例 #24
0
 public Motorbike()
 {
     _move = new DriveStrategy();
 }
コード例 #25
0
 public Train()
 {
     _move = new DriveStrategy();
 }
コード例 #26
0
 public Pegas(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
コード例 #27
0
 public void SetStrategy(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
コード例 #28
0
ファイル: MoveScript.cs プロジェクト: revoljucioner/Transfer
        //
        //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;
コード例 #29
0
ファイル: Troll.cs プロジェクト: polishchuk37a/Patterns
 public Troll(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
コード例 #30
0
 public SequenceGenerator(Board board, IMoveStrategy moveStrategy, int pathSize)
 {
     _board = board;
     _moveStrategy = moveStrategy;
     _pathSize = pathSize;
 }
コード例 #31
0
 public PlayGameMoveHandler(IMoveStrategy moveStrategy, int sleepDuration)
 {
     _moveStrategy = moveStrategy;
     _sleepDuration = sleepDuration;
 }
コード例 #32
0
 public CompositeMove(IMoveStrategy strategy1, IMoveStrategy strategy2)
 {
     _moveStrategies = new[] { strategy1, strategy2 };
 }
コード例 #33
0
 public Elf(IMoveStrategy strategyMove)
 {
     this._strategyMove = strategyMove;
 }
コード例 #34
0
 public Player(IMoveStrategy strategy, PlayerTypeEnum type)
 {
     this.Strategy = strategy;
     this.Type     = type;
 }