public void initManagers() { // Init managers levelCanvas = FindObjectOfType <PowerupPongCanvas>(); gameManager = FindObjectOfType <PowerupPongGameManager>(); powerupManager = FindObjectOfType <PowerupPongPowerupManager>(); }
protected override void endGame() { // UnSpawn powerups PowerupPongPowerupManager powerupManager = FindObjectOfType <PowerupPongPowerupManager>(); foreach (PowerupPongPowerup powerup in powerupManager.spawnedPowerups) { powerup.GetComponent <NetworkedObject>().UnSpawn(); Destroy(powerup.gameObject); } base.endGame(); }
// Start is called before the first frame update new void Start() { base.Start(); powerupManager = FindObjectOfType <PowerupPongPowerupManager>(); // Reset powerup images clearPowerupImage(true); clearPowerupImage(false); // Assign score colors playerScores.leftPlayerScore.color = Color.green; playerScores.rightPlayerScore.color = Color.red; }
public override void NetworkStart() { // Despawn after 8 seconds Destroy(gameObject, 8); // Find objects powerupManager = FindObjectOfType <PowerupPongPowerupManager>(); spriteRenderer = GetComponent <SpriteRenderer>(); if (IsServer) { setRandomPower(); InvokeClientRpcOnEveryone(UpdatePowerOnClient, power); } }