示例#1
0
        private bool Run(List <BoardCellLocation> shipLocations)
        {
            try
            {
                IStateTracker stateTracker = stateTrackerFactory.Create();

                LogGameStatus(stateTracker);

                Log($"Building board");
                stateTracker.BuildBoard();
                LogGameStatus(stateTracker);

                //var logText = shipLocations.Select(x => x.ToString()).ToList<string>();
                Log($"Adding ship to : {string.Join(",", shipLocations.Select(x => x.ToString()).ToList<string>())}");
                stateTracker.AddShip(shipLocations);
                LogGameStatus(stateTracker);

                shipLocations.ForEach
                    (x =>
                {
                    Log($"Attacking : ({x.ToString()})");
                    stateTracker.Attack(x);
                    LogGameStatus(stateTracker);
                });
                return(true);
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
示例#2
0
 public MeerkatAppViewModel(IStateTracker stateTracker, ITodoTracker todoTracker, DispatcherTimer dispatcherTimer)
 {
     this.stateTracker          = stateTracker;
     this.todoTracker           = todoTracker;
     this.dispatcherTimer       = dispatcherTimer;
     this.dispatcherTimer.Tick += new System.EventHandler(TimeChanged);
 }
示例#3
0
 public StartGameAdminCommand(int size, IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository)
 {
     _size             = size;
     _physics          = physics;
     _stateTracker     = stateTracker;
     _playerRepository = playerRepository;
 }
示例#4
0
 public StartGameAdminCommand(int size, IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository)
 {
     _size = size;
     _physics = physics;
     _stateTracker = stateTracker;
     _playerRepository = playerRepository;
 }
示例#5
0
        public VirusBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
            : base(game, physics, stateTracker, position, game.Settings.VirusMinMass)
        {
            _physics = physics;

            _fed = 0;

            MakeDynamic();
        }
        public VisualizationConnection(IAdminCommandFactory adminCommandFactory, IStateTracker stateTracker, IGame game)
        {
            _adminCommandFactory = adminCommandFactory;
            _stateTracker        = stateTracker;
            _game = game;

            _dataToSend = new BufferBlock <string>();

            _pushDataState = PushDataState.None;
        }
示例#7
0
        public AdminConnection(IAdminCommandFactory adminCommandFactory, IStateTracker stateTracker, IGame game)
        {
            _adminCommandFactory = adminCommandFactory;
            _stateTracker = stateTracker;
            _game = game;

            _dataToSend = new BufferBlock<string>();

            _pushDataState = PushDataState.None;
        }
示例#8
0
        public PlayerBlob(Player owner, IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, bool controlledByPlayer)
            : base(game, physics, stateTracker, position, game.Settings.MinPlayerBlobMass)
        {
            _physics           = physics;
            Owner              = owner;
            RecombineTicks     = game.TickCount;
            ControlledByPlayer = controlledByPlayer;

            Mass = Game.Settings.MinPlayerBlobMass;

            MakeDynamic();
        }
示例#9
0
        public ClassicGameMode(IGame game, IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository)
        {
            _playerRepository = playerRepository;

            _entitiesSpawners = new List <EntitiesSpawner>
            {
                new FoodSpawner(game, physics, stateTracker),
                new VirusSpawner(game, physics, stateTracker)
            };

            _playerStats = new List <PlayerStat>();
        }
示例#10
0
        public PlayerBlob(Player owner, IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, bool controlledByPlayer)
            : base(game, physics, stateTracker, position, game.Settings.MinPlayerBlobMass)
        {
            _physics = physics;
            Owner = owner;
            RecombineTicks = game.TickCount;
            ControlledByPlayer = controlledByPlayer;

            Mass = Game.Settings.MinPlayerBlobMass;

            MakeDynamic();
        }
示例#11
0
 public ConnectionFactory(
     IAdminCommandFactory adminCommandFactory,
     IPlayerCommandFactory playerCommandFactory,
     IPlayerRepository playerRepository,
     IStateTracker stateTracker,
     IGame game)
 {
     _adminCommandFactory  = adminCommandFactory;
     _playerCommandFactory = playerCommandFactory;
     _playerRepository     = playerRepository;
     _stateTracker         = stateTracker;
     _game = game;
 }
示例#12
0
文件: Game.cs 项目: kfazi/AgarIo
        public Game(IRandom random, IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository, IClock clock)
        {
            _physics = physics;
            _stateTracker = stateTracker;
            _playerRepository = playerRepository;
            _clock = clock;
            Random = random;

            _blobs = new List<Blob>();
            Settings = new WorldSettings();
            GameMode = new ClassicGameMode(this, physics, stateTracker, playerRepository);

            Stop();
        }
示例#13
0
        public Game(IRandom random, IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository, IClock clock)
        {
            _physics          = physics;
            _stateTracker     = stateTracker;
            _playerRepository = playerRepository;
            _clock            = clock;
            Random            = random;

            _blobs   = new List <Blob>();
            Settings = new WorldSettings();
            GameMode = new ClassicGameMode(this, physics, stateTracker, playerRepository);

            Stop();
        }
示例#14
0
文件: Blob.cs 项目: tarnas14/AgarIo
        protected Blob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, float mass)
        {
            _physics = physics;

            Game         = game;
            StateTracker = stateTracker;
            Position     = position;
            Mass         = mass;

            IsStatic   = false;
            _isCreated = false;

            Id = BlobIdProvider.GetId();
        }
示例#15
0
文件: Blob.cs 项目: kfazi/AgarIo
        protected Blob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, float mass)
        {
            _physics = physics;

            Game = game;
            StateTracker = stateTracker;
            Position = position;
            Mass = mass;

            IsStatic = false;
            _isCreated = false;

            Id = BlobIdProvider.GetId();
        }
示例#16
0
    // Start is called before the first frame update
    void Start()
    {
        if (follower == null)
        {
            follower = transform.parent.gameObject;
        }
        if (parentHasStateMachine)
        {
            stateMachine = transform.parent.gameObject.GetComponent <IStateTracker>();
        }

        timer = gameObject.AddComponent <Timer>();
        timer.SetTimer(followDuration, Timer.Status.IDLE);
        Tween.Spline(splineToFollow, follower.transform, startPosition, endPosition, false, followDuration, followDelay, Tween.EaseInOut);
        timer.StartTimer();

        finishedFollowing = false;
    }
示例#17
0
 public EjectedMassBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position)
 {
     MakeDynamic();
 }
示例#18
0
 private void LogGameStatus(IStateTracker stateTracker)
 {
     Log($"Game Status : {stateTracker.GetGameStatus()}");
 }
示例#19
0
 public FoodSpawner(IGame game, IPhysics physics, IStateTracker stateTracker)
     : base(game, physics)
 {
     _stateTracker = stateTracker;
 }
示例#20
0
文件: FoodBlob.cs 项目: kfazi/AgarIo
 public FoodBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position, game.Settings.FoodMass)
 {
     MakeStatic();
 }
示例#21
0
 public AdminCommandFactory(IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository)
 {
     _physics = physics;
     _stateTracker = stateTracker;
     _playerRepository = playerRepository;
 }
示例#22
0
 public EjectedMassBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position)
 {
     MakeDynamic();
 }
示例#23
0
 public FoodBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position, game.Settings.FoodMass)
 {
     MakeStatic();
 }
示例#24
0
 public AdminCommandFactory(IPhysics physics, IStateTracker stateTracker, IPlayerRepository playerRepository)
 {
     _physics          = physics;
     _stateTracker     = stateTracker;
     _playerRepository = playerRepository;
 }
示例#25
0
 public VirusSpawner(IGame game, IPhysics physics, IStateTracker stateTracker) : base(game, physics)
 {
     _stateTracker = stateTracker;
 }