//Main attack method //Used for melee and dash attacks private void LaunchAttack(Collider2D col) { //Find all colliders overlapping players 'melee' collider Collider2D[] cols = Physics2D.OverlapBoxAll( col.bounds.center, col.bounds.extents, 0, LayerMask.GetMask("Hitbox")); foreach (Collider2D c in cols) { if (c.transform.parent.parent == transform || enemyScript.getShieldUp() == true) { continue; } //PlayerOne hit successful //Debug.Log("Player One Wins!"); won = true; if (gameObject.tag == "Player1") { DataStore.p1Wins++; DataStore.spriteManager.UpdateScoreboardPlayerOne(scoreboard); Debug.Log("update score p1"); } else if (gameObject.tag == "Player2") { DataStore.p2Wins++; DataStore.spriteManager.UpdateScoreboardPlayerTwo(scoreboard); Debug.Log("update score p2"); } GameOver(); } }
//Main attack method //Used for melee and dash attacks private void LaunchAttack(Collider2D col) { //Find all colliders overlapping players 'melee' collider Collider2D[] cols = Physics2D.OverlapBoxAll( col.bounds.center, col.bounds.extents, 0, LayerMask.GetMask("Hitbox")); foreach (Collider2D c in cols) { if (c.transform.parent.parent == transform || enemyScript.getShieldUp() == true) { continue; } //PlayerOne hit successful //Debug.Log("Player One Wins!"); won = true; GameOver(); } }