public void SendTrappingMushroomRPC(int pid, int mushId) { PlayerTrap playerTrap = new PlayerTrap { MushroomId = mushId, PlayerId = pid }; SynchronizationController.AddMushroomWithTrap(playerTrap); Debug.Log("Dodałem grzyb do listy grzybów z pułapkami mId " + mushId + " pId " + pid); }
void Update() { if (delayed <= 0 && isTrap && isOn) { isOn = false; timer.SetActive(false); slider.value = 0; player = GameObject.FindGameObjectWithTag("Player"); player.GetComponent <Trap>().DecrementTraps(); player.GetComponent <PlayerController>().PlayTrapSound(); GetComponentInChildren <Light>().enabled = true; playerController = player.gameObject.GetComponent <PlayerController>(); //playerController.SetGatherButtonActive(false); playerController.canFollow = true; UIController.isGathering = false; } if (delayed <= 0 && !isTrap && isOn) { isOn = false; CheckNotification(); player = GameObject.FindGameObjectWithTag("Player"); playerController = player.gameObject.GetComponent <PlayerController>(); playerController.SetGatherButtonActive(false); playerController.canFollow = true; UIController.isGathering = false; Basket basket = player.gameObject.GetComponent <Basket>(); if (basket != null) { basket.AddMushroomToBasket(this.gameObject); basket.AddMushroomData(new Mushroom(mushroomId, mushroomPoints, mushroomName, this.gameObject, mushroomVolume)); } GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().SendMessage(id); //Destroy(this.gameObject); Destroy(timer); if (SynchronizationController.IsTrapOnMushroom(mushroomId)) { // Stun(); GameObject.FindGameObjectWithTag("Player").GetComponent <Trap>().Stun(); } if (stunTimer <= 0) { stunTimer = 5; Debug.Log("Stun stopped"); } } }
public void ObserveSynchronizationIsEnabled_ShouldReturnCorrectValue( [Frozen]TestScheduler scheduler, SynchronizationController sut) { //arrange //act var actual = scheduler.Start(() => sut.ObserveSynchronizationIsEnabled()); //assert actual.Values().Should().BeEquivalentTo(new[] { false }); }
public void ObserveSynchronizationIsEnabled_WhenCallingEnable_ShouldReturnCorrectValue( [Frozen]TestScheduler scheduler, SynchronizationController sut) { //arrange scheduler.Schedule(TimeSpan.FromTicks(300), () => sut.Enable()); //act var actual = scheduler.Start(() => sut.ObserveSynchronizationIsEnabled()); //assert actual.Values().Should().BeEquivalentTo(new[] { false, true }); }
public EditModel(IStorage storage) { _trips = new TripController(storage); _photos = new PhotoController(storage); _files = new FileController(storage); _categories = new CategoryController(storage); _sync = new SynchronizationController(storage); Trip = null; }
public void ObserveSynchronizationIsEnabled_AfterCallingEnable_ShouldReturnCorrectValue( [Frozen]TestScheduler scheduler, SynchronizationController sut) { //arrange sut.Enable(); scheduler.AdvanceTo(500); //act var actual = scheduler.Start(() => sut.ObserveSynchronizationIsEnabled()); //assert actual.Values().Should().BeEquivalentTo(new[] { true }); }
void OnTriggerEnter(Collider coll) { if (coll.gameObject.CompareTag("Mushroom") && GetComponent <PlayerController>().IsMine()) { Debug.Log("Trap enter"); MushroomController mushroomController = coll.gameObject.GetComponentInChildren <MushroomController>(); if (currentTrapCount > 0) { if (!SynchronizationController.IsOwnTrapOnMushroom(GetComponent <PlayerController>().id, mushroomController.mushroomId)) { trapButton.SetActive(true); } } } }
void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Mushroom" && this.gameObject.GetComponent <Basket>().canGather&& IsMine()) { MushroomController mushroomController = collider.gameObject.GetComponent <MushroomController>(); mushroomControllerId = mushroomController; if (SynchronizationController.CanGatherMushroom(mushroomController.mushroomId) && !SynchronizationController.IsOwnTrapOnMushroom(this.id, mushroomController.mushroomId)) { int currentCountOfMushrooms = GetComponent <Basket>().currentCountOfMushrooms; int maxCountOfMushrooms = GetComponent <Basket>().maxCountOfMushrooms; int mushroomsVolume = collider.gameObject.GetComponentInChildren <MushroomController>().mushroomVolume; int pointsOfMushroom = collider.gameObject.GetComponentInChildren <MushroomController>().mushroomPoints; int sum = currentCountOfMushrooms + mushroomsVolume; if (sum > maxCountOfMushrooms) { gatherMushroomButton.SetActive(true); cantAddToBasketPanel.SetActive(true); Debug.Log("Nie możesz zebrać więcej grzybów " + sum + " / " + maxCountOfMushrooms); } else { cantAddToBasketPanel.SetActive(false); focusMushroom = collider.gameObject; gatherMushroomButton.SetActive(true); } pointsTextInfo.text = "Points: " + pointsOfMushroom; volumeTextInfo.text = "Volume: " + mushroomsVolume; } else { //powiadomienie o niemożności zebrania grzyba, zbierany jest przez kogoś innego } } if (collider.gameObject.CompareTag("Car")) { CarController carController = collider.gameObject.GetComponent <CarController>(); if (carController != null) { this.carController = carController; } } }
public void ObserveSynchronizationIsEnabled_ShouldNotBeSubject( SynchronizationController sut) { //act and assert sut.ObserveSynchronizationIsEnabled().As<ISubject<bool>>().Should().BeNull(); }
public void Disable_WhenCallingStart_ShouldCallDispose( [Frozen]TestScheduler scheduler, [Frozen]Mock<IStartSynchronizing> startSynchronizing, SynchronizationController sut, Mock<IDisposable> disposable) { startSynchronizing.Setup(s => s.Start()).Returns(disposable.Object); scheduler.Schedule(300.Ticks(), () => sut.Enable()); //act scheduler.Schedule(301.Ticks(), () => sut.Disable()); scheduler.Start(); //assert disposable.Verify(d => d.Dispose()); }
public void Enable_ShouldCallStart( [Frozen]Mock<IStartSynchronizing> startSynchronizing, SynchronizationController sut) { //act sut.Enable(); //assert startSynchronizing.Verify(s => s.Start()); }
void Update() { try { if ((motor.agent.velocity.x != 0 || motor.agent.velocity.z != 0) && !audioSource.isPlaying) { audioSource.clip = movementSFX; audioSource.loop = true; audioSource.PlayOneShot(movementSFX); } //Debug.Log(motor.agent.velocity.ToString()); Touch touch = Input.touches[0]; if ((Input.GetMouseButtonDown(0) || Input.GetTouch(0).phase.Equals(TouchPhase.Began) || (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)) && canFollow && photonView.isMine && GameObject.FindGameObjectWithTag("GameManager").GetComponent <MainGameController>().isGameStarting) //if ((Input.GetMouseButtonDown(0) || Input.GetTouch(0).phase.Equals(TouchPhase.Began)) && canFollow && photonView.isMine && GameObject.FindGameObjectWithTag("GameManager").GetComponent<MainGameController>().isGameStarting) //left { motor.agent.isStopped = false; Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100, movementMask)) { Debug.Log("Klik " + hit.collider.name + " " + motor.agent.isStopped + " " + canFollow); motor.MoveToPoint(hit.point); RemoveFocus(); } } else if (!canFollow) { if (!motor.agent.isStopped) { motor.agent.Stop(); motor.agent.isStopped = true; } } } catch (Exception ex) { } try { if (!UIController.isGathering) { if (carController.canMove && gatherMushroomButton.GetActive() == false && this.canFollow == false && focusMushroom == null) //leci null bo carcontroller { this.canFollow = true; this.motor.agent.isStopped = false; } if (carController.canMove && gatherMushroomButton.GetActive() == true && focusMushroom != null) { this.canFollow = true; this.motor.agent.isStopped = false; } if (carController.canMove && cantAddToBasketPanel.GetActive() == true) { this.canFollow = true; this.motor.agent.isStopped = false; } } else ///changes { this.canFollow = false; this.motor.agent.isStopped = true; } } catch (Exception ex) { } try { if (basket.canGather == false && fullBasketBlinking.GetComponent <BlinkingFullBasket>().isBlinking == false) { fullBasketBlinking.SetActive(true); fullBasketBlinking.GetComponent <BlinkingFullBasket>().isBlinking = true; fullBasketBlinking.GetComponent <BlinkingFullBasket>().blink = true; } else if (basket.canGather == true && fullBasketBlinking.GetComponent <BlinkingFullBasket>().isBlinking == true) { fullBasketBlinking.SetActive(false); fullBasketBlinking.GetComponent <BlinkingFullBasket>().isBlinking = false; fullBasketBlinking.GetComponent <BlinkingFullBasket>().blink = false; } if (mushroomControllerId != null) { if (!SynchronizationController.CanGatherMushroom(mushroomControllerId.mushroomId)) { gatherMushroomButton.SetActive(false); } } } catch (Exception e) { } }
public void SendCollectingMushroomRPC(int id) { SynchronizationController.AddCollectingMushroom(id); Debug.Log("Dodałem grzyb do listy aktualnie zbieranych grzybów"); }