public void UpdateDisplayedBomb(string bombId, bool isPlayerDefuser) { var bomb = _allBombs.GetByBombId(bombId); bombImage.sprite = bomb.GetSprite(isPlayerDefuser); if (isActiveAndEnabled) { defuseButton.interactable = false; StartCoroutine(nameof(EnableDefuseButtonAfterTimer)); } }
public void GetByBombId_ReturnBombCorrespondingToId() { // Given var expectedBomb = _bombs[1]; var idExpectedBomb = expectedBomb.Id; _allBombs = new AllBombs(_random, _bombs, _deviceInfo); // When var bomb = _allBombs.GetByBombId(idExpectedBomb); // Then Assert.That(bomb, Is.EqualTo(expectedBomb)); }
public void UpdateDisplayedBomb_ShouldDisplayBombCorrespondingToId() { // Given const string bombId = "bombId"; const bool isDefuser = true; var aBomb = Substitute.For <IBomb>(); var aSprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), Vector2.up); aBomb.GetSprite(isDefuser).Returns(aSprite); _allBombs.GetByBombId(bombId).Returns(aBomb); _defusingLayer.gameObject.SetActive(false); // When _defusingLayer.UpdateDisplayedBomb(bombId, isDefuser); // Then Assert.That(_defusingLayer.bombImage.sprite, Is.EqualTo(aSprite)); }