コード例 #1
0
    void Start()
    {
        buttonController = GetComponent <DashButton>();
        Renderer renderer = GetComponent <Renderer>();

        defaultMaterial = renderer.material;
        originalColor   = defaultMaterial.GetColor("_EmissionColor");
        fullEmission    = (originalColor.r + originalColor.g + originalColor.b) / 3f;
        lowEmission     = fullEmission / 5f;

        GameManager.Instance.currentNavUnit
        .Subscribe(HandleNavUnit);
    }
コード例 #2
0
    void CheckHits()
    {
        RaycastHit hit;
        Ray        ray = cockpitCamera.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 12))
        {
            GameObject buttonObj  = hit.collider.transform.gameObject;
            DashButton buttonData = buttonObj.GetComponent <DashButton>();
            lastButtonType   = buttonData.type;
            helperLabel.text = buttonData.helperText;
        }
        else if (lastButtonType != "")
        {
            helperLabel.text = "";
            lastButtonType   = "";
        }
    }