void CheckIfYes() { if (timer.IsTimerRunning()) { if (previous.ArePatternsEqual(current)) { combo.AddCombo(); score.Correct(10 * combo.GetCombo()); } else { combo.RemoveCombo(); score.Mistake(5); } ShowNextPattern(); } }
void CheckIfYes() { if (timer.IsTimerRunning()) { if (answer == true) { combo.AddCombo(); score.Correct(10 * combo.GetCombo()); } else { combo.RemoveCombo(); score.Mistake(10); timer.TakeAwayTime(); timer.TakeAwayTime(); } DisplayNext(); } }
public void killEnemy(GameObject enemy) { timeFromLastKill = 0; enemy.GetComponent <Killable>().Hit(); rage = GameObject.FindGameObjectWithTag("RageBar").GetComponent <Rage_Bar>(); rage.AddRage(enemy.GetComponent <Killable>().rageVal); combo = GameObject.FindGameObjectWithTag("Combo").GetComponent <Combo>(); combo.AddCombo(1); combo.resetTimer(); score = GameObject.FindGameObjectWithTag("Score").GetComponent <Score>(); score.AddKills(1); }
// Update is called once per frame void Update() { if (updateOn) { if (timer.IsTimerRunning()) { if (Input.GetMouseButtonDown(0) || (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Began)) { Vector3 touchPosWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 touchPosWorld2D = new Vector2(touchPosWorld.x, touchPosWorld.y); RaycastHit2D hit = Physics2D.Raycast(touchPosWorld2D, Vector2.zero, 0f); if (hit) { if (hit.collider.CompareTag("Correct")) { StartCoroutine("SpawnNext"); CorrectPattern(hit, correctPtrn); combo.AddCombo(); if (firstTry) { score.Correct(10 * combo.GetCombo()); } else { score.Correct(5); } firstTry = true; } else if (hit.collider.CompareTag("Incorrect")) { combo.RemoveCombo(); timer.TakeAwayTime(); timer.TakeAwayTime(); score.Mistake(5); firstTry = false; } } } } else if (timer.IsGameOver()) // jeigu zaidimas pasibaige { updateOn = false; panel.SetActive(true); dataController.SaveLogicGameScore(score); } } }
void CheckIfLeft() { if ((patternsOnTheLeft.Count == 0 && patternsOnTheRight.Count == 0) || (patternsOnTheLeft.Count == 0 && !patternsOnTheRight.Contains(current.GetName()))) // jei abu tusti { patternsOnTheLeft.Add(current.GetName()); GameObject temp = current.GetPatternGameObject(); temp.transform.localScale = new Vector3(0.7f, 0.7f, 1f); foreach (Transform childObj in temp.transform) { GameObject.DestroyImmediate(childObj.gameObject); } Instantiate(temp, leftV, temp.transform.rotation); combo.AddCombo(); score.Correct(combo.GetCombo()); current.SetNextVector(leftVector); ShowNextPattern(); } else if (patternsOnTheLeft.Contains(current.GetName())) { combo.AddCombo(); score.Correct(combo.GetCombo()); current.SetNextVector(leftVector); ShowNextPattern(); } else if (patternsOnTheRight.Count != 0 && patternsOnTheLeft.Count != 2 && !patternsOnTheRight.Contains(current.GetName())) // jeigu desinej nera ir kairys jo neturi { patternsOnTheLeft.Add(current.GetName()); GameObject temp = current.GetPatternGameObject(); temp.transform.localScale = new Vector3(0.7f, 0.7f, 1f); foreach (Transform childObj in temp.transform) { GameObject.DestroyImmediate(childObj.gameObject); } Instantiate(temp, leftV2, temp.transform.rotation); combo.AddCombo(); score.Correct(combo.GetCombo()); current.SetNextVector(leftVector); ShowNextPattern(); } else { combo.RemoveCombo(); score.Mistake(5); timer.TakeAwayTime(); } }
void Update() { if (Time.timeScale == 0.0f) { return; } nowTime += Time.deltaTime; pangList = PangCreator.I.pangList; //if(comboTime < nowTime) // comboCount = 0; for (int index = 0; index < PangInfo.PANG_MAX; index++) { checkedCount = 1; ClearArray(pangChecked, 0, pangChecked.Length); if (pangList[index].isActive == true && pangList[index].type == checkType) { pangChecked[index] = 1; CheckAround(index); } if (checkedCount >= 3) { /*if(comboTime >= nowTime) { * comboCount += 1; * comboTime = nowTime + 1.0f; * combo.SetCombo(comboCount); * } * if(comboTime < nowTime) { * comboCount = 1; * comboTime = nowTime + 1.0f; * combo.SetCombo(comboCount); * }*/ comboCount = combo.AddCombo(); if (bombTime >= nowTime) { ItemCreator.I.CreateItem(); bombTime = nowTime + 0.5f; } if (bombTime < nowTime) { bombTime = nowTime + 0.5f; } for (int checkedIndex = 0; checkedIndex < PangInfo.PANG_MAX; checkedIndex++) { if (pangChecked[checkedIndex] == 1) { PangCreator.I.Destroy(checkedIndex); } } GameMNG.I.AddScore(checkedCount + comboCount); break; } } checkType = (checkType + 1) % PangInfo.TYPE_MAX; //Debug.Log(Distance(pangList[0].position, pangList[1].position)); }