public void Change() { var cal = new Logic(); var result = cal.Pay(326, 2000); //1674 var expected = new CountMoney { countThousand = 1, countFiveHundred = 1, countHundred = 1, countFifty = 1, countTwenty = 1, countTenCoin = 0, countFiveCoin = 0, countOneCoin = 4, }; Assert.Equal(expected.countThousand, result.countThousand); Assert.Equal(expected.countFiveHundred, result.countFiveHundred); Assert.Equal(expected.countHundred, result.countHundred); Assert.Equal(expected.countFifty, result.countFifty); Assert.Equal(expected.countTwenty, result.countTwenty); Assert.Equal(expected.countTenCoin, result.countTenCoin); Assert.Equal(expected.countFiveCoin, result.countFiveCoin); Assert.Equal(expected.countOneCoin, result.countOneCoin); }
private void OnTriggerStay2D(Collider2D collision) { if (collision != null) { money = collision.GetComponent <CountMoney>(); inCollider = true; canvasAux.SetActive(true); } }
void Update() { _deltaTime = Time.deltaTime; if (IsGameOver) { //saveData if (!_isSave) { if (GameOverEvent == null) { GameOverEvent = new UnityEngine.Events.UnityEvent(); } GameOverEvent.Invoke(); // Do animation sit of animal _player.GetComponent <Animator>().SetBool("StopToSit", true); // Set off music GameObject.Find("Main Camera").GetComponent <AudioSource>().enabled = false; if (_temporaryDataPlayer.Score < _score) { _temporaryDataPlayer.Score = _score; } _temporaryDataPlayer.Coins += CountMoney; if (!EqualsTwoDataPlayer()) { SaveNewData(); } _isSave = true; // Show gameover window StartCoroutine(Wait(2f, () => { GameObject.Find("Canvas").transform.Find("GameOverWindow").Find("Score"). Find("TextGetScore").GetComponent <Text>().text = _score.ToString(); GameObject.Find("Canvas").transform.Find("GameOverWindow").Find("Coin"). Find("TextGetCoin").GetComponent <Text>().text = CountMoney.ToString(); GameObject.Find("Canvas").transform.Find("GameOverWindow").gameObject.SetActive(true); } )); } } else { // Set text on block _textScoreBlockBlack.text = _score.ToString(); // Moving pieces -----------before1 for (int i = 0; i != piecesAreas.Count; i++) { piecesAreas[i].transform.Translate(Vector3.down * _speed * _deltaTime); piecesMaterials[i].transform.Translate(Vector3.down * _speed * _deltaTime); } // Destroying and deleting pieces, add new pieces for (int i = 0; i != piecesAreas.Count; i++) { _pos = piecesAreas[i].transform.position; if (_pos.y <= -7f) { // Delete line and add line for (int r = 0; r != 5; r++) { //Delete first piece of area in list Destroy(piecesAreas[0]); piecesAreas.RemoveAt(0); // Delete first piece of material in list Destroy(piecesMaterials[0]); piecesMaterials.RemoveAt(0); // Add new pieces in line if (!_pieceColumn[0]) { AddAreaInLine(_pos.y + 6f + 7f, _location); AddMaterialInLine(_pos.y + 6f + 7f, _location, ref _posClear); _pieceColumn[0] = true; // Add score _score++; // Increse speed if (_score % 50 == 0 && _speed < 6) { _speed += 0.3f; } } else if (_pieceColumn[0] && !_pieceColumn[1]) { _pieceColumn[1] = true; } else if (_pieceColumn[1] && !_pieceColumn[2]) { _pieceColumn[2] = true; } else if (_pieceColumn[2] && !_pieceColumn[3]) { _pieceColumn[3] = true; } else if (_pieceColumn[3] && !_pieceColumn[4]) { for (int j = 0; j != 5; j++) { _pieceColumn[j] = false; } } } } } // Change location if (_countLoc != _location && _score >= _location * 150) { _location++; // Set new speed for location _speed = (float)(3 + 0.5 * (_location - 1)) < 4 ? (float)(3 + 0.5 * (_location - 1)) : 4; // Change background color of camera4 Camera.main.GetComponent <Camera>().backgroundColor = new Color( _colorLocation[_location * 4 - 4] / 255, _colorLocation[_location * 4 - 3] / 255, _colorLocation[_location * 4 - 2] / 255, _colorLocation[_location * 4 - 1] / 255); } } // Check if player input escape menu or home (on android) if ((Input.GetKey(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Menu) || Input.GetKeyDown(KeyCode.Home)) && !IsGameOver) { GameObject.Find("Canvas").transform.Find("PauseWindow").gameObject.SetActive(true); isPause = true; Time.timeScale = 0; } }
public static void Money(ChangeMoney money) { countMoney = new CountMoney(money); countMoney.Paid(); Console.WriteLine(); }