private void BombFinished(object sender, EventArgs e) { dragText.gameObject.SetActive(false); trackMouse = false; currentBomb.bombExploded -= BombFinished; trackbomb = false; Destroy(currentBomb.gameObject); currentBomb = null; if (CheckEnd()) { int player1Score = player2.GetScore(); int player2Score = player1.GetScore(); if (player1.IsDead()) { player2Score += 100; } else if (player2.IsDead()) { player1Score += 100; } GameFlow.Instance.LevelComplete(new List <int>() { player1Score, player2Score }); } else { SetUpPlayer(true); } }
private void OnMouseDown() { if (!trackMouse) { return; } dragVector = Vector3.zero; originalMousePosition = Input.mousePosition; GameObject newBomb = GameObject.Instantiate(bombObject); currentBomb = newBomb.GetComponent <BR_Bomb>(); currentBomb.transform.position = GetPlayerPositions(); currentBomb.ArmBomb(); currentBomb.bombExploded += BombFinished; dragText.gameObject.SetActive(true); }