public void initManagers()
 {
     // Init managers
     levelCanvas    = FindObjectOfType <PowerupPongCanvas>();
     gameManager    = FindObjectOfType <PowerupPongGameManager>();
     powerupManager = FindObjectOfType <PowerupPongPowerupManager>();
 }
Example #2
0
    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();
    }
Example #3
0
    // 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;
    }
Example #4
0
    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);
        }
    }