void GetPlayer(int player) { if (player == 1) { Player1 = Spawn1.GetComponent <SpawnController>().playerCharacter; } else { Player2 = Spawn2.GetComponent <SpawnController>().playerCharacter; } }
void Update() { if (player1health <= 0) { Spawn1.GetComponent <SpawnController>().Respawn(); Player1.GetComponent <PlayerDamage>().health = 100f; player1damage = 10f; createScore.score2++; } if (player2health <= 0) { Player2.GetComponent <PlayerDamage>().health = 100f; player2damage = 10f; Spawn2.GetComponent <SpawnController>().Respawn(); Debug.Log("im here"); //Player2.GetComponent<Rigidbody2D>().position = new Vector2(Spawn2.transform.position.x, Spawn2.transform.position.y); createScore.score1++; } Player1.GetComponent <BulletSpawn>().bulletDamage = player1damage; player1health = Player1.GetComponent <PlayerDamage>().health; if (Player1.GetComponent <PowerUP>().powerUp) { PlusDamage(1); } if (Input.GetKeyDown(KeyCode.E)) { player1damage = 10f; } Player2.GetComponent <BulletSpawn>().bulletDamage = player2damage; player2health = Player2.GetComponent <PlayerDamage>().health; if (Player2.GetComponent <PowerUP>().powerUp) { PlusDamage(2); } if (Input.GetKeyDown(KeyCode.RightShift)) { player2damage = 10f; } if (timerScript.currentTime <= 0f) { EndGame(); } }