private float timeDrawListener = 3f; //Tutulmadan ne kadar süre sonra minigame oynansın. private IEnumerator _Draw(StuffController stuffController) { print("Start Draw Listener Event"); _stuffController = stuffController; _initialStuffPosition = stuffController.transform.position; //it's work draw count down yield return(new WaitForSeconds(timeDrawListener)); //if Stuff position don't change enough Vector3 initPosition = _initialStuffPosition.With(y: 0); //Bana sadece x ve z'ler gerekli oldugu için y'leri olaydan çıkardım. Vector3 currentPosition = stuffController.transform.position.With(y: 0); if (Vector3.Distance(initPosition, currentPosition) <= neededDistance) { StartMiniGame(); drawListener = null; } else { print("Yeteri kadar sabit kalmadı."); //Belki bir an çok hareket etti lakin sonra durdurdular ? Bunun için tekrar dinleme aktif edilir. StartDrawListener(stuffController); } }
void OnTriggerEnter2D(Collider2D col) { GameObject other = col.gameObject; Debug.Log("Collision with " + other.tag); if (other.tag == "Stuff") { StuffController temp = other.GetComponent <StuffController>(); points = points + temp.Points < 0 ? 0 : points + temp.Points; this.TakeDamage(temp.Damage); if (temp.Type == StuffController.StuffType.Bonus) { BonusStuff stuf = (BonusStuff)temp; Effect tempEff = new BonusEffect(stuf.bonusType, stuf.EffectTime); SetEffect(tempEff); effects.Add(tempEff); StartCoroutine(DeleteEffect(stuf.EffectTime, tempEff)); } Destroy(other); } else if (other.tag == "Fish") { Debug.Log("Fish collide"); FishController Fc = other.GetComponent <FishController>(); points = points + Fc.GetPoints() < 0 ? 0 : points + Fc.GetPoints(); Effect tempEff = new FishEffect(Fc.Type, Fc.GetSeconds(), Fc.GetValue()); SetEffect(tempEff); effects.Add(tempEff); StartCoroutine(DeleteEffect(Fc.GetSeconds(), tempEff)); Destroy(other); } }
public void Remove(StuffController newSC) { if (area == Area.Neutral) { return; } throw new NotImplementedException(); }
public void StartDrawListener(StuffController stuffController) { if (drawListener == null) { drawListener = StartCoroutine(_Draw(stuffController)); } else { print(" Draw sayacı - Zaten aktif o yuzden tekrar baslatmadım."); } }
public async Task StuffController_DeleteStuff_ShouldReturnNoContent() { // Arrange var mockStuffRepo = Mock.Of <IStuffRepo>(); var controller = new StuffController(mockStuffRepo); string badId = "2"; // Act IActionResult actionResult = await controller.Delete(badId); // Assert Assert.IsType <NoContentResult>(actionResult); }
public async Task StuffController_Create_ShouldReturnCreated() { // Arrange var mockStuffRepo = Mock.Of <IStuffRepo>(x => x.CreateAsync(TestDatum) == Task.FromResult(TestDatum)); var controller = new StuffController(mockStuffRepo); // Act IActionResult actionResult = await controller.Create(TestDatum); // Assert var okResult = Assert.IsType <CreatedAtActionResult>(actionResult); var contentResult = Assert.IsType <DatumModel>(okResult.Value); Assert.Equal(TestDatum.Id, contentResult.Id); }
public async Task StuffController_UpdateStuff_ShouldReturn_Ok() { // Arrange var mockStuffRepo = Mock.Of <IStuffRepo>(x => x.UpdateAsync("1", TestDatum) == Task.FromResult(TestDatum)); var controller = new StuffController(mockStuffRepo); string existingId = "1"; // Act IActionResult actionResult = await controller.Update(existingId, TestDatum); // Assert var okResult = Assert.IsType <OkObjectResult>(actionResult); var contentResult = Assert.IsType <DatumModel>(okResult.Value); Assert.Equal(TestDatum.Id, contentResult.Id); }
public async Task StuffController_SearchStuffList_ShouldReturn_Ok() { // Arrange var mockStuffRepo = Mock.Of <IStuffRepo>(x => x.SearchListAsync("foo") == Task.FromResult(TestStuff)); var controller = new StuffController(mockStuffRepo); // Act IActionResult actionResult = await controller.GetList(0, "foo"); // Assert var okResult = Assert.IsType <OkObjectResult>(actionResult); var contentResult = Assert.IsType <StuffModel>(okResult.Value); var expected = TestDatum.Id; var actual = contentResult.DatumList.ToArray()[0].Id; Assert.Equal(expected, actual); }
public async Task StuffController_Read_ShouldReturn_Null() { // Arrange var mockUserRepo = Mock.Of <IStuffRepo>(); var controller = new StuffController(mockUserRepo); // Act IActionResult actionResult = await controller.Read("1"); // Assert var okResult = Assert.IsType <OkObjectResult>(actionResult); var contentResult = okResult.Value; StuffModel expected = null; var actual = contentResult; Assert.Equal(expected, actual); }
public async Task StuffController_Read_ShouldReturn_Ok() { // Arrange var mockStuffRepo = Mock.Of <IStuffRepo>(x => x.ReadAsync("1") == Task.FromResult(TestDatum)); var controller = new StuffController(mockStuffRepo); // Act IActionResult actionResult = await controller.Read("1"); // Assert var okResult = Assert.IsType <OkObjectResult>(actionResult); var contentResult = Assert.IsType <DatumModel>(okResult.Value); var expected = TestDatum.Id; var actual = contentResult.Id; Assert.Equal(expected, actual); }
public void Add(StuffController stuff) { if (area == Area.Neutral) { return; } if (!_listStuff.Contains(stuff)) { _listStuff.Add(stuff); stuff.BreakAllPlayers(); Collider[] cols = stuff.GetComponents <Collider>(); foreach (Collider col in cols) { Destroy(col); } Destroy(stuff.GetComponent <Rigidbody>()); if (stuff.GetComponent <AudioSource>() != null) { StartCoroutine(_SoundOut(stuff.GetComponent <AudioSource>())); } //is gold değişkeni kapanmaması için stuff.StopAllCoroutines(); TF.Move(stuff.transform, moveToHere, moveDelay, moveTime, moveCurve); TF.Scale(stuff.transform, moveToHere, moveDelay, moveTime, moveCurve); TF.Rotate(stuff.transform, moveToHere, moveDelay, moveTime, moveCurve); } _scoreController.UpdateScore(area, CountStuffs()); }
void Start() { args = GetComponent <ArgsController> (); stuff = GetComponent <StuffController> (); originPosition = transform.position; }
private void Init() { this.stuffController = new StuffController(); departments = new List <Department>(); DisableButtons(); dataGridView1.ReadOnly = true; //GetDepartments(); if (departments == null) { MessageBox.Show("Критическая ошибка: невозможно загрузить список подразделений или он пуст", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Hide(); } //FillGrid(Employee.getEmployees); this.Shown += (o, e) => { GetDepartments(); FillGrid(Employee.getEmployees); BuildTree(); }; //this.FormClosed += (o, e) => { this.Dispose(); }; showAllButton.Click += (o, e) => { FillGrid(Employee.getEmployees); showAll = true; }; dataGridView1.CellClick += (o, e) => { string idStr = "0"; try { idStr = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); int.TryParse(dataGridView1.CurrentRow.Cells[0].Value.ToString(), out rowID); } catch (Exception ex) { } if (rowID > 0) { deleteButton.Enabled = true; saveButton.Enabled = true; addButton.Enabled = false; deptComboBox.Enabled = true; GetEmployee(); } else { deleteButton.Enabled = false; saveButton.Enabled = false; addButton.Enabled = true; deptComboBox.Enabled = true; ClearEdits(); deptComboBox.SelectedValue = currentID; } }; refreshButton.Click += (o, e) => { GetDepartments(); UpdateGrid(); ClearEdits(); BuildTree(); DisableButtons(); showAll = false; }; addButton.Click += (o, e) => { InsertItem(); }; saveButton.Click += (o, e) => { UpdateItem(); }; deleteButton.Click += (o, e) => { DeleteItem(); }; buttonHide.Click += (o, e) => { if (splitContainer1.Panel2Collapsed) { buttonHide.Text = ">"; } else { buttonHide.Text = "<"; } splitContainer1.Panel2Collapsed = !splitContainer1.Panel2Collapsed; }; treeView1.NodeMouseClick += (o, e) => { showAll = false; try { //Guid.TryParse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), out currentID); //c NET4.5 currentID = new Guid(e.Node.Name); } catch (Exception ex) { statusLabel.Text = "Ошибка, такого отдела нет"; } string name = e.Node.Name + " " + e.Node.Text; Console.WriteLine(name); UpdateGrid(); DisableButtons(); }; }