示例#1
0
 private void Awake()
 {
     foreach (UIPlayer uiP in uiPlayers)
     {
         uiP.SetReady(false, Color.white);
         uiP.textSlot.gameObject.SetActive(false);
     }
     chat = FindObjectOfType <CustomChat>();
 }
示例#2
0
    /*
     * Se crean las entradas del diccionario que se usarán para saber qué material se le debe asignar al coche
     * en función del color del botón pulsado y se cogen las referencias necesarias en caso de que no existan
     */

    void GetRefs()
    {
        if (!networkManager)
        {
            networkManager = FindObjectOfType <CustomNetworkManager>();
        }
        if (!mainCamera)
        {
            mainCamera = Camera.main.GetComponent <CameraController>();
        }
        if (!chat)
        {
            chat = FindObjectOfType <CustomChat>();
        }
        if (!polePosition)
        {
            polePosition = FindObjectOfType <PolePositionManager>();
        }
        if (!uiManager)
        {
            uiManager = FindObjectOfType <UIManager>();
        }
        if (!rb)
        {
            rb = GetComponent <Rigidbody>();
        }
        if (CircuitProgress == null)
        {
            CircuitProgress = new CircuitProgress();
        }
        if (colorOptions == null)
        {
            colorOptions = new Dictionary <string, Material>();
            for (int i = 0; i < colors.Length; i++)
            {
                colorOptions.Add(ColorUtility.ToHtmlStringRGB(colors[i]), materials[i]);
            }
        }
        if (renderers == null || renderers.Length == 0)
        {
            renderers = GetComponentsInChildren <Renderer>();
        }
        if (colliders == null || colliders.Length == 0)
        {
            colliders = GetComponentsInChildren <Collider>();
        }
        if (lights == null || lights.Length == 0)
        {
            lights = GetComponentsInChildren <Light>();
        }
    }