Example #1
0
 public void SetPoolColor(Color _col)
 {
     for (int i = 0; i < pool.Count; i++)
     {
         ParticleBehaviour p = pool.Dequeue();
         p.SetColor(_col);
         pool.Enqueue(p);
     }
 }
Example #2
0
    private IEnumerator Start()
    {
        playerName = photonView.Owner.NickName;

        orginRotationParticleSystem = pb.gameObject.transform.rotation;
        orginRotationPlayerUI       = playerCanvas.transform.localRotation;

        outlineSizeID  = Shader.PropertyToID("_Outline");
        outlineColorID = Shader.PropertyToID("_OutlineColor");

        yield return(0);

        if (photonView.IsMine)
        {
            playerColor = Color.blue; //For now self is blue, enemy are red

            outlineSize = 0.15f;      //size of the outline shader

            GameManager.SP.GetPlayerB = this;
            photonView.RPC(nameof(RPC_CreateSubMesh), RpcTarget.AllBufferedViaServer,
                           GameManager.SP.playerData.subBaseSelected,
                           GameManager.SP.playerData.subEngineSelected,
                           GameManager.SP.playerData.subCannonSelected,
                           GameManager.SP.playerData.subSpecialSelected);
        }
        else
        {
            playerColor = Color.red;
            pm.enabled  = false;
            outlineSize = 0;
        }

        yield return(0);

        while (gameMeshes == null || gameMeshes.Length == 0)
        {
            gameMeshes = subObject.gameObject.GetComponentsInChildren <Renderer>();
            yield return(0);
        }
        //Set outline Values && color
        foreach (var item in gameMeshes)
        {
            item.material.SetFloat(outlineSizeID, outlineSize);
            item.material.SetColor(outlineColorID, playerColor);
        }

        ResetMatchValues();

        //Give particle system the color
        pb.SetColor(playerColor);

        sp.CreatePool(PlayerName);
        sp.SetPoolColor(playerColor);

        SetMeshColor(Color.black, gameMeshes); //Set self to black

        isAlive = false;

        pm.GiveValues(baseSettings, engineSettings);
        ph.SetInitValues(baseSettings.health);

        subObject.SetActive(false);
        yield return(0);

        StartCoroutine(Respawn());
        isInitialized = true;
    }