private void Update() { player = GameObject.FindGameObjectWithTag("Player"); target = GameObject.FindGameObjectWithTag("Target"); if (player) { movement = player.GetComponent <movement>(); gun = player.GetComponent <Gun>(); targetController = target.GetComponent <TargetController>(); gameOverController = background.GetComponent <GameOverController>(); bullitController = bullit.GetComponent <Bullit>(); rocketController = rocket.GetComponent <RocketController>(); lightningController = lightning.GetComponent <LightningController>(); boltController = lightningBolt.GetComponent <BoltController>(); //print(movement); if (movement) { movement.externalController = externalController; } if (gun) { gun.externalController = externalController; } targetController.externalController = externalController; targetController.singlePlayer = singlePlayer; gameOverController.singlePlayer = singlePlayer; bullitController.singlePlayer = singlePlayer; rocketController.singlePlayer = singlePlayer; boltController.singlePlayer = singlePlayer; lightningController.singlePlayer = singlePlayer; //player2.SetActive(!singlePlayer); if (singlePlayer) { enemy.SetActive(singlePlayer); } } }
private void Update() { player = GameObject.FindGameObjectWithTag("Player"); target = GameObject.FindGameObjectWithTag("Target1"); if (player) { gameOverController = background.GetComponent <GameOverController>(); bullitController = bullit.GetComponent <Bullit>(); rocketController = rocket.GetComponent <RocketController>(); lightningController = lightning.GetComponent <LightningController>(); boltController = lightningBolt.GetComponent <BoltController>(); //print(movement); //if (movement) //{ // movement.externalController = externalController; //} //if (gun) //{ // gun.externalController = externalController; //} //targetController.externalController = externalController; //targetController.singlePlayer = singlePlayer; gameOverController.singlePlayer = singlePlayer; //bullitController.singlePlayer = singlePlayer; //rocketController.singlePlayer = singlePlayer; boltController.singlePlayer = singlePlayer; lightningController.singlePlayer = singlePlayer; //player2.SetActive(!singlePlayer); //if (singlePlayer) //{ // enemy.SetActive(singlePlayer); //} } }