public void should_return_correct_values() { var creationInfo = new CreationInfo(); creationInfo.Parent = TestTools.GetIDataObjectMock(Guid.NewGuid()).Object; var viewModel = new SelectProjectTemplatePageViewModel(creationInfo, _dataObjectServiceMock.Object); var expected = "Шаг 1 из 4. Выберите элемент для использования в качестве шаблона"; var actual = viewModel.GetTitle(); Assert.AreEqual(expected, actual); expected = ""; actual = viewModel.GetTemplateName(); Assert.AreEqual(expected, actual); actual = viewModel.NextButtonCaption(); Assert.IsNull(actual); actual = viewModel.NextButtonCaption(); Assert.IsNull(actual); Assert.IsFalse(viewModel.CanGoBack()); Assert.IsFalse(viewModel.CanGoNext()); }
public async Task <Game> AddCreationInfoAsync(CreationInfo creationInfo) { if (creationInfo.CreatorId == null) { throw new ArgumentNullException($"{nameof(creationInfo)} creator not found"); } var creation = new Game { CreatorId = (int)creationInfo.CreatorId }; creation = await CreationRepository.CreateAsync(creation).ConfigureAwait(false); IEnumerable <CreationDescription> creationDescriptions = creationInfo.Descriptions.Select(cd => new CreationDescription { CreationId = creation.GameId, LanguageId = cd.LangId, Title = cd.Title, Description = cd.Description }); await CreationDescriptionRepository.Create(creationDescriptions.ToArray()).ConfigureAwait(false); return(creation); }
public void should_not_can_go_next_when_selected_project() { //Given var creationInfo = new CreationInfo(); var viewModel = new SelectProjectTemplatePageViewModel(creationInfo, _dataObjectServiceMock.Object); var type = TestTools.GetITypeMock(); //Элемент не монтируется на диск type.Setup(t => t.IsMountable).Returns(false); var idataObjectMock = TestTools.GetIDataObjectMock(type); creationInfo.Parent = TestTools.GetIDataObjectMock(idataObjectMock.Object.ParentId).Object; //when var node = TestTools.GetNodeViewModel(idataObjectMock, _dataObjectServiceMock); viewModel.ObjectsTreeViewModel.SelectedItem = node; //Then Assert.IsFalse(viewModel.CanGoNext()); //Снимем селек в дереве viewModel.ObjectsTreeViewModel.SelectedItem = null; //Then Assert.IsFalse(viewModel.CanGoNext()); }
/// <summary> /// This is to get full information about certain game /// </summary> /// <param name="gameId"></param> /// <returns></returns> public async Task <GameObject> GetGameObjectAsync(int gameId) { // find game in database Game gameBox = await creationRepository.FindById(gameId).ConfigureAwait(false); if (gameBox == null) { return(null); } // find the creator of the game CreationInfo creationInfo = creationService.GetCreationInfo(gameBox.GameId); // load level infos IEnumerable <LevelInfo> levelInfos = gameLevelService.GetLevels(gameBox); var game = new GameObject { GameId = gameBox.GameId, Creator = creationInfo .CreatorNickname, //TODO: V3080 https://www.viva64.com/en/w/v3080/ Possible null dereference. Consider inspecting 'creationInfo'. LevelInfos = levelInfos.ToList() }; return(game); }
public CreationInfo GetCreationInfo(int id) { // find game information Game game = CreationRepository .GetWithInclude(n => n.Creator) .SingleOrDefault(c => c.GameId.Equals(id)); if (game == null) { return(null); } // select game description from descriptions repository List <CreationDescription> descriptionList = CreationDescriptionRepository.GetWhere(cd => cd.CreationId == game.GameId).ToList(); // form descriptions infos List <DescriptionInfo> descriptions = GetDescriptionInfos(descriptionList); var creationInfo = new CreationInfo { CreatorId = game.CreatorId, CreatorNickname = game.Creator.NickName, Descriptions = descriptions }; return(creationInfo); }
private void ClearNextBlock(ref CreationInfo block) { block.block_type = Block.TYPE.FLOOR; block.max_count = 15; block.heigth = 0; if (0 <= map_creator.timer && map_creator.timer < 15) { block.heigth = 0; } if (15 <= map_creator.timer && map_creator.timer < 30) { block.heigth = Random.Range(-1, 2); } if (30 <= map_creator.timer && map_creator.timer < 60) { block.heigth = Random.Range(-2, 3); } if (60 <= map_creator.timer && map_creator.timer < 75) { block.heigth = Random.Range(-1, 2); } else if (map_creator.timer == 75) { map_creator.timer = 0; } block.current_count = 0; }
public Egypt(string name, string path) { _time = new CreationInfo(DateTime.Now); Name = name; FileSystemManager.CheckPathValidity(path); JsonReadFromFile(path); }
public void update(float passage_time) { if (this.current_block.current_count >= this.current_block.max_sequnce_count) { this.previous_block = this.current_block; this.current_block = this.next_block; this.clear_next_block(ref this.next_block); // 다음에 만들 블록의 내용을 초기화. this.update_level(passage_time); // 다음에 만들 블록을 설정. } if (this.current_item.current_count >= current_item.max_sequnce_count) { previous_item = current_item; current_item = next_item; clear_item_info(ref next_item); } if (this.current_monster.current_count >= 1) { current_monster.monster_type = MonsterType.None; } this.block_count++; // 블록의 총 수를 증가. }
public int level = 0; // 난이도. private void clear_next_block(ref CreationInfo block) { block.block_type = Block.TYPE.FLOOR; block.max_count = 15; block.height = 0; block.current_count = 0; }
public void should_can_go_next_when_selected_project() { //Given var creationInfo = new CreationInfo(); var type = TestTools.GetITypeMock(); var parentType = TestTools.GetITypeMock(); parentType.Setup(t => t.Children).Returns(new ReadOnlyCollection <int>(new List <int>() { type.Object.Id })); var parent = TestTools.GetIDataObjectMock(parentType); creationInfo.Parent = parent.Object; var viewModel = new SelectProjectTemplatePageViewModel(creationInfo, _dataObjectServiceMock.Object); //Проект монтируется на диск type.Setup(t => t.IsMountable).Returns(true); var idataObjectMock = TestTools.GetIDataObjectMock(type); //when var node = TestTools.GetNodeViewModel(idataObjectMock, _dataObjectServiceMock); viewModel.ObjectsTreeViewModel.SelectedItem = node; //Then Assert.IsTrue(viewModel.CanGoNext()); }
/// <summary> /// 실행 시간에 따른 레벨 데이터 삽입 /// </summary> /// <param name="enemy"></param> /// <param name="passage_time"></param> public void update_level(ref CreationInfo enemy, float passage_time) { //float local_time = Mathf.Repeat(0, this.level_datas[this.level_datas.Count - 1].end_time); //float local_time = Mathf.Clamp(passage_time, 0, this.level_datas[this.level_datas.Count - 1].end_time); float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); // 현재 레벨을 구한다. int i; for (i = 0; i < this.level_datas.Count - 1; i++) { if (local_time <= this.level_datas[i].end_time) { break; } } this.level = i;// 현재 레벨 LevelData level_data; level_data = this.level_datas[this.level]; // 현재 레벨에 해당하는 값들을 enemy 인스턴스에 대입 enemy.spawnTime.min = level_data.spawnTime.min; enemy.spawnTime.max = level_data.spawnTime.max; }
// LevelControl.cs private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { //switch (previous.block_type) //{ // case Block.TYPE.FLOOR: // 이번 블록이 바닥일 경우. // current.block_type = Block.TYPE.HOLE; // 다음 번은 구멍을 만든다. // current.max_count = 5; // 구멍은 5개 만든다. // current.height = previous.height; // 높이를 이전과 같게 한다. // break; // case Block.TYPE.HOLE: // 이번 블록이 구멍일 경우. // current.block_type = Block.TYPE.FLOOR; // 다음은 바닥 만든다. // current.max_count = 10; // 바닥은 10개 만든다. // break; //} // 새 인수 passage_time으로 플레이 경과 시간을 받는다. // 레벨 1~레벨 5를 반복한다. float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); // 현재 레벨을 구한다. int i; for (i = 0; i < this.level_datas.Count - 1; i++) { if (local_time <= this.level_datas[i].end_time) { break; } } this.level = i; current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if (this.block_count >= 10) { // 현재 레벨용 레벨 데이터를 가져온다. LevelData level_data; level_data = this.level_datas[this.level]; switch (previous.block_type) { case Block.TYPE.FLOOR: // 이전 블록이 바닥인 경우. current.block_type = Block.TYPE.HOLE; // 이번엔 구멍을 만든다. // 구멍 크기의 최솟값~최댓값 사이의 임의의 값. current.max_count = Random.Range(level_data.hole_count.min, level_data.hole_count.max); current.height = previous.height; // 높이를 이전과 같이 한다. break; case Block.TYPE.HOLE: // 이전 블록이 구멍인 경우. current.block_type = Block.TYPE.FLOOR; // 이번엔 바닥을 만든다. // 바닥 길이의 최솟값~최댓값 사이의 임의의 값. current.max_count = Random.Range(level_data.floor_count.min, level_data.floor_count.max); // 바닥 높이의 최솟값과 최댓값을 구한다. int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); // 최솟값과 최대값 사이의 값을 강제로 넣기 위해 사용 height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); // 바닥 높이의 최솟값~최댓값 사이의 임의의 값. current.height = Random.Range(height_min, height_max); break; } } }
private void clear_next_block(ref CreationInfo block) { // 受け取ったブロック(block)の中身を初期化. block.block_type = Block.TYPE.FLOOR; block.max_count = 15; block.height = 0; block.current_count = 0; }
public ProcessPageViewModel(CreationInfo creationInfo, IObjectModifier modifier, IObjectsRepository repository, IFileProvider fileProvider) { _creationInfo = creationInfo; _modifier = modifier; _repository = repository; _fileProvider = fileProvider; _currentPersonId = repository.GetCurrentPerson().Id; }
private void clear_next_block(ref CreationInfo block) { // 전달받은 블록(block)을 초기화. block.block_type = Block.TYPE.FLOOR; block.max_count = 15; block.height = 0; block.current_count = 0; }
public CreationInfo EtDTOCreationInfoMapper(CreationInfo db) { return(new CreationInfo { CreatedBy = db.CreatedBy, CreatedDateTime = db.CreatedDateTime, ModifyBy = db.ModifyBy, ModifyDateTime = db.ModifyDateTime }); }
public Egypt(string name, params T[] list) { _time = new CreationInfo(DateTime.Now); Name = name; foreach (var person in list) { Add(person); } Metadata = new Reflector.ReflectionMetadata(typeof(Egypt <T>)); }
private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) // 新設の引数passage_timeで、プレイの経過時間を受け取る { // 「レベル1~レベル5」の繰り返しに float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); // 現在のレベルを求める int i; for (i = 0; i < this.level_datas.Count - 1; i++) { if (local_time <= this.level_datas[i].end_time) { break; } } this.level = i; current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if (this.block_count >= 10) { // 現在のレベル用のレベルデータを取得 LevelData level_data; level_data = this.level_datas[this.level]; switch (previous.block_type) { case Block.TYPE.FLOOR: // 前回のブロックが床の場合 current.block_type = Block.TYPE.HOLE; // 今回は穴を作る // 穴の長さの最小値~最大値の間の、ランダムな値 current.max_count = Random.Range(level_data.hole_count.min, level_data.hole_count.max); current.height = previous.height; // 高さを前回と同じにする break; case Block.TYPE.HOLE: // 前回のブロックが穴の場合 current.block_type = Block.TYPE.FLOOR; // 今回は床を作る // 床の長さの最小値~最大値の間の、ランダムな値 current.max_count = Random.Range(level_data.floor_count.min, level_data.floor_count.max); // 床の高さの最小値と最大値を求める int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); // 床の高さの最小値~最大値の間の、ランダムな値 current.height = Random.Range(height_min, height_max); break; } } }
private void clear_next_block(ref CreationInfo block) { // 전달받은 블록(block)을 초기화. block.block_type = Block.TYPE.FLOOR; block.max_sequnce_count = 15; block.height = 0; block.current_count = 0; current_monster.monster_type = MonsterType.None; current_monster.current_count = 0; }
public void should_load_tree() { //given var creationInfo = new CreationInfo(); var viewModel = new SelectProjectTemplatePageViewModel(creationInfo, _dataObjectServiceMock.Object); //when viewModel.Load(); //then _dataObjectServiceMock.Verify(d => d.Load(SystemObjectIds.RootObjectId, It.IsAny <Action>(), false), Times.Once); }
public SelectProjectTemplatePageViewModel(CreationInfo creationInfo, IDataObjectService dataObjectService) { _creationInfo = creationInfo; _objectsTreeViewModel = new ObjectsTreeViewModel(dataObjectService, false); _objectsTreeViewModel.SelectedItemChanged += OnSelectedItemChanged; _objectsTreeViewModel.ToolbarItemsSource.Add(new ToolbarButtonItem("CollapseAll") { Header = "Свернуть все", Icon = Icons.Instance.CollapseAllIcon, Command = _objectsTreeViewModel.CollapseAllCommand }); }
public void UpdateStatus() { current_block.current_count++; if (current_block.current_count >= current_block.max_count) { previous_block = current_block; current_block = next_block; ClearNextBlock(ref next_block); UpdateLevel(ref next_block, current_block); } }
public void update(float passage_time) { this.current_block.current_count++; if (this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; this.clear_next_block(ref this.next_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; }
private void update_level(ref CreationInfo current, CreationInfo previous) { switch(previous.block_type) { case Block.TYPE.FLOOR: // 이번 블록이 바닥일 경우. current.block_type = Block.TYPE.HOLE; // 다음은 구멍을 만든다. current.max_count = 5; // 구멍은 5개 만든다. current.height = previous.height; // 높이를 이전과 같게 한다. break; case Block.TYPE.HOLE: // 이번 블록이 구멍일 경우. current.block_type = Block.TYPE.FLOOR; // 다음은 바닥을 만든다. current.max_count = 10; // 바닥은 10개 만든다. break; } }
public void should_set_object_nodes_to_result() { var creationInfo = new CreationInfo { Template = TestTools.GetNodeViewModel(Guid.NewGuid()) }; var viewModel = new ProjectCompositionPageViewModel(creationInfo, _dataObjectServiceFactoryMock.Object); viewModel.Load(); Assert.NotNull(creationInfo.ObjectsNodes); Assert.AreSame(creationInfo.ObjectsNodes, viewModel.ObjectsTreeViewModel.Nodes); }
private void update_level(ref CreationInfo current, CreationInfo previous) { switch(previous.block_type) { case Block.TYPE.FLOOR: // 今回のブロックが床の場合. current.block_type = Block.TYPE.HOLE; // 次回は穴を作る. current.max_count = 5; // 穴は5個作る. current.height = previous.height; // 高さを前回と同じにする. break; case Block.TYPE.HOLE: // 今回のブロックが穴の場合. current.block_type = Block.TYPE.FLOOR; // 次回は床を作る. current.max_count = 10; // 床は10個作る. break; } }
// public void update() public void Update(float passage_time) { // *Update()가 아님. create_floor_block() 메서드에서 호출 this.current_block.current_count++; // 이번에 만든 블록 개수를 증가. // 이번에 만든 블록 개수가 max_count 이상이면. if (this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; this.clear_next_block(ref this.next_block); // 다음에 만들 블록의 내용을 초기화. // this.update_level(ref this.next_block, this.current_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; // 블록의 총 수를 증가. }
public void update() { // 이번에 만든 블록 수를 증가. this.current_block.current_count++; // 이번에 만든 블록 수가 max_count이상이면. if(this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; // 다음에 만들 블록의 내용을 초기화. this.clear_next_block(ref this.next_block); // 다음에 만들 블록을 설정. this.update_level(ref this.next_block, this.current_block); } this.block_count++; // 블록의 총 수를 증가. }
public void update() { // 「今回作ったブロックの個数」をインクリメント. this.current_block.current_count++; // 「今回作ったブロックの個数」が予定数(max_count)以上なら. if(this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; // 次に作るべきブロックの内容を初期化. this.clear_next_block(ref this.next_block); // 次に作るべきブロックを設定. this.update_level(ref this.next_block, this.current_block); } this.block_count++; // 「ブロックの総数」をインクリメント. }
private void update_level(ref CreationInfo current, CreationInfo previous) { switch (previous.block_type) { case Block.Type.floor: current.block_type = Block.Type.hole; current.max_count = 5; current.height = previous.height; break; case Block.Type.hole: current.block_type = Block.Type.floor; current.max_count = 10; break; } }
private void update_level(ref CreationInfo current, CreationInfo previous) { switch (previous.block_type) { case Block.TYPE.FLOOR: // 이번 블록이 바닥일 경우. current.block_type = Block.TYPE.HOLE; // 다음은 구멍을 만든다. current.max_count = 5; // 구멍은 5개 만든다. current.height = previous.height; // 높이를 이전과 같게 한다. break; case Block.TYPE.HOLE: // 이번 블록이 구멍일 경우. current.block_type = Block.TYPE.FLOOR; // 다음은 바닥을 만든다. current.max_count = 10; // 바닥은 10개 만든다. break; } }
private void update_level(ref CreationInfo current, CreationInfo previous) { switch (previous.block_type) { case Block.TYPE.FLOOR: current.block_type = Block.TYPE.HOLE; current.max_count = 5; current.height = previous.height; break; case Block.TYPE.HOLE: current.block_type = Block.TYPE.FLOOR; current.max_count = 10; break; } }
public void update(float passage_time) { // 이번에 만든 블록 수를 증가. this.current_block.current_count++; // 이번에 만든 블록 수가 max_count이상이면. if (this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; // 다음에 만들 블록의 내용을 초기화. this.clear_next_block(ref this.next_block); // 다음에 만들 블록을 설정. this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; // 블록의 총 수를 증가. }
// 매 프레임 갱신 처리. public void update(float passage_time) { this.current_block.current_count++; // 같은 블록을 일정 개수 이상 만들면 블록의 타입을 갱신. // if (this.current_block.current_count >= this.current_block.max_count) { this.current_block = this.next_block; this.clear_next_block(ref this.next_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; }
public void should_return_correct_values() { var creationInfo = new CreationInfo { Template = TestTools.GetNodeViewModel() }; var viewModel = new ProjectCompositionPageViewModel(creationInfo, _dataObjectServiceFactoryMock.Object); var expected = "Шаг 2 из 4. Выберите необходимые элементы состава"; var actual = viewModel.GetTitle(); Assert.AreEqual(expected, actual); actual = viewModel.GetTemplateName(); Assert.IsNull(actual); }
public void CreationInfoUpdate(CreationInfo db, CreationInfo dto, ClaimsPrincipal user) { string userName = user.FindFirst(ClaimTypes.NameIdentifier)?.Value; dto = dto ?? new CreationInfo(); if (string.IsNullOrEmpty(db.CreatedBy)) { db.CreatedBy = userName; db.CreatedDateTime = DateTime.Now; } else { db.ModifyBy = userName; db.ModifyDateTime = DateTime.Now; } }
// 매 프레임 갱신 처리. public void update(float passage_time) { this.current_block.current_count++; // 같은 블록을 일정 개수 이상 만들면 블록의 타입을 갱신. // if(this.current_block.current_count >= this.current_block.max_count) { this.current_block = this.next_block; this.clear_next_block(ref this.next_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; }
// -------------------------------------------------------------------- // private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { // ---------------------------------------------------------------- // // 현재 시간이 포함되는 곳까지 레벨을 진행한다. // '마지막 데이터의 종료 시간'으로 반복하도록. float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); int i; for(i = 0;i < this.level_datas.Count - 1;i++) { if(local_time <= this.level_datas[i].end_time) { break; } } this.current_level = i; // ---------------------------------------------------------------- // current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if(this.block_count >= 10) { LevelData level_data; level_data = this.level_datas[this.current_level]; switch(previous.block_type) { case Block.TYPE.FLOOR: { // 블록 hole_size 개분의 폭을 가진 구멍을 만든다. current.block_type = Block.TYPE.HOLE; current.max_count = Random.Range(level_data.hole_count.min, level_data.hole_count.max + 1); current.height = previous.height; } break; case Block.TYPE.HOLE: { // 블록 10개분의 바닥을 만든다. current.block_type = Block.TYPE.FLOOR; current.max_count = Random.Range(level_data.floor_count.min, level_data.floor_count.max); int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); current.height = Random.Range(height_min, height_max + 1); //Debug.Log(height_min.ToString() + " " + height_max + " " + current.height.ToString()); } break; } } }
// 신설 인수 passage_time으로 플레이 경과 시간을 받는다. /* private void update_level(ref CreationInfo current, CreationInfo previous) { switch(previous.block_type) { case Block.TYPE.FLOOR: // 이전 블록이 바닥이면. current.block_type = Block.TYPE.HOLE; // 이번엔 구멍을 만든다. current.max_count = 5; // 구멍은 5개 만든다. current.height = previous.height; // 높이를 이전과 같게 한다. break; case Block.TYPE.HOLE: // 이전 블록이 구멍이면. current.block_type = Block.TYPE.FLOOR; // 다음은 바닥을 만든다. current.max_count = 10; // 바닥은 10개 만든다. break; } } */ private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { // 레벨1~레벨5의 반복. float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); // 현재 레벨을 구한다. int i; for(i = 0; i < this.level_datas.Count - 1; i++) { if(local_time <= this.level_datas[i].end_time) { break; } } this.level = i; current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if(this.block_count >= 10) { // 현재 레벨용 레벨 데이터를 가져옴. LevelData level_data; level_data = this.level_datas[this.level]; switch(previous.block_type) { case Block.TYPE.FLOOR: // 이전 블록이 바닥인 경우. current.block_type = Block.TYPE.HOLE; // 이번엔 구멍을 만든다. // 구멍 길이의 최솟값~최댓값 사이의 임의의 수. current.max_count = Random.Range( level_data.hole_count.min, level_data.hole_count.max); current.height = previous.height; // 높이를 이전과 같이 한다. break; case Block.TYPE.HOLE: // 이전 블록이 구멍인 경우. current.block_type = Block.TYPE.FLOOR; // 이번엔 바닥을 만든다. // 바닥 길이의 최솟값~최댓값 사이의 임의의 값. current.max_count = Random.Range( level_data.floor_count.min, level_data.floor_count.max); // 바닥 높이의 최솟값과 최댓값을 구한다. int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); // 바닥 높이의 최솟값~최댓값 사이의 임의의 값. current.height = Random.Range(height_min, height_max); break; } } }
private AggregateException(CreationInfo creationInfo) : base(creationInfo.String, creationInfo.Exception) { _innerExceptions = creationInfo.InnerExceptions; }
private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { //レベル1-5の繰り返し //pasage_time は 経過時間 float local_time = Mathf.Repeat(passage_time,this.level_datas[this.level_datas.Count - 1].end_time); //現在のレベルを求める int i; for(i = 0;i<this.level_datas.Count;i++) { if(local_time <= this.level_datas[i].end_time) { break; } } this.level = i; current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if(this.block_count >= 10) { //現在のレベル用のデータを取得 LevelData level_data; level_data = this.level_datas[this.level]; switch(previous.block_type) { case Block.TYPE.FLOOR: current.block_type = Block.TYPE.HOLE; current.max_count = Random.Range(level_data.hole_count.min,level_data.hole_count.max); current.height = previous.height; break; case Block.TYPE.HOLE: current.block_type = Block.TYPE.FLOOR; current.max_count = Random.Range(level_data.floor_count.min,level_data.floor_count.max); //床の高さの最小値と最大値を求める int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min,HEIGHT_MIN,HEIGHT_MAX); height_max = Mathf.Clamp(height_max,HEIGHT_MIN,HEIGHT_MAX); //床の高さ current.height = Random.Range(height_min,height_max); break; } } }
//何回も呼び出される public void update(float passage_time) { //今回作ったブロックを増やす this.current_block.current_count++; //今回作ったブロックの数が予定数以上なら if(this.current_block.current_count >= this.current_block.max_count) { this.previout_block = this.current_block; this.current_block = this.next_block; //次に作るブロックを初期化 this.clear_next_block(ref this.next_block); //次に作るべきブロックを設定 this.update_level(ref this.next_block,this.current_block,passage_time); } this.block_count++; }
private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { // passage_timeでプレイ時間を受け取る // レベル1から5の繰り返しに float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); // 現在のレベルを求める int i; for(i=0; i<this.level_datas.Count-1; i++) { if(local_time <= this.level_datas[i].end_time) { break; } } this.level = i; current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if(this.block_count >= 10) { // 現在のレベル用のレベルデータを取得 LevelData level_data; level_data = this.level_datas[this.level]; switch (previous.block_type) { case Block.TYPE.FLOOR: // 前回のブロックが床の場合 current.block_type = Block.TYPE.HOLE; // 今回は穴を作る // 穴の長さの最小・最大値の間のランダムな値 current.max_count = Random.Range(level_data.hole_count.min, level_data.hole_count.max); current.height = previous.height; // 前回と同じ高さに break; case Block.TYPE.HOLE: // 前回のブロックが穴の場合 current.block_type= Block.TYPE.FLOOR; // 今回は床を作る // 床の長さの最小・最大値の間のランダムな値 current.max_count = Random.Range(level_data.floor_count.min, level_data.floor_count.max); // 床の高さの最小・最大値を求める int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); // 床の高さの最小・最大値の間のランダムな値 current.height = Random.Range(height_min, height_max); break; } } }
public void update(float passage_time) { // 今回作ったブロックの個数をインクリメント this.current_block.current_count++; // 今回作ったブロックの個数が予定数(max_count)以上なら if(this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; // 次に作るべきブロックの内容を初期化 this.clear_next_block(ref this.next_block); // 次に作るべきブロックを設定 //this.update_level(ref this.next_block, this.current_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; // ブロックの総数をインクリメント }
// 毎フレームの更新処理. public void update(float passage_time) { this.current_block.current_count++; // 同じブロックを一定個数以上作ったら、ブロックのタイプを更新. // if(this.current_block.current_count >= this.current_block.max_count) { this.current_block = this.next_block; this.clear_next_block(ref this.next_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; }
// -------------------------------------------------------------------- // private void update_level(ref CreationInfo current, CreationInfo previous, float passage_time) { // ---------------------------------------------------------------- // // 現在の時間が含まれるところまでレベルを進める. // 『最後のデーターの終了時間』で繰り返すように. float local_time = Mathf.Repeat(passage_time, this.level_datas[this.level_datas.Count - 1].end_time); int i; for(i = 0;i < this.level_datas.Count - 1;i++) { if(local_time <= this.level_datas[i].end_time) { break; } } this.current_level = i; // ---------------------------------------------------------------- // current.block_type = Block.TYPE.FLOOR; current.max_count = 1; if(this.block_count >= 10) { LevelData level_data; level_data = this.level_datas[this.current_level]; switch(previous.block_type) { case Block.TYPE.FLOOR: { // ブロック hole_size 個分のはばの穴を作る. current.block_type = Block.TYPE.HOLE; current.max_count = Random.Range(level_data.hole_count.min, level_data.hole_count.max + 1); current.height = previous.height; } break; case Block.TYPE.HOLE: { // ブロック10個幅分の床を作る. current.block_type = Block.TYPE.FLOOR; current.max_count = Random.Range(level_data.floor_count.min, level_data.floor_count.max); int height_min = previous.height + level_data.height_diff.min; int height_max = previous.height + level_data.height_diff.max; height_min = Mathf.Clamp(height_min, HEIGHT_MIN, HEIGHT_MAX); height_max = Mathf.Clamp(height_max, HEIGHT_MIN, HEIGHT_MAX); current.height = Random.Range(height_min, height_max + 1); //Debug.Log(height_min.ToString() + " " + height_max + " " + current.height.ToString()); } break; } } }
// public void update() public void update(float passage_time) { // 이번에 만든 블록의 개수를 증가. this.current_block.current_count++; // 이번에 만든 블록의 개수가 예정수(max_count)이상이면. if(this.current_block.current_count >= this.current_block.max_count) { this.previous_block = this.current_block; this.current_block = this.next_block; // 다음에 만들어야 할 블록 내용을 초기화. this.clear_next_block(ref this.next_block); // 다음에 만들 블록을 설정. // this.update_level(ref this.next_block, this.current_block); this.update_level(ref this.next_block, this.current_block, passage_time); } this.block_count++; // 블록의 총수를 증가. }