Beispiel #1
0
 public void ShowHight(bool state)
 {
     if (state)
     {
         ho.ConstantOnImmediate(color);
     }
     else
     {
         ho.ConstantOffImmediate();
     }
 }
    void SetTarget(GameObject go)
    {
        // remove old highlight
        if (_target != null)
        {
            HighlightableObject highlight = _target.GetComponent <HighlightableObject> ();
            if (highlight != null)
            {
                highlight.ConstantOffImmediate();
            }
        }

        if (go == null)
        {
            goX.SetActive(false);
            goY.SetActive(false);
            goZ.SetActive(false);

            _target = null;
        }
        else
        {
            _target = go;
            goX.SetActive(true);
            goY.SetActive(true);
            goZ.SetActive(true);

            transform.position = go.transform.position;

            //goX.transform.SetParent (go.transform);
            goX.transform.up = go.transform.right;

            //goY.transform.SetParent (go.transform);
            goY.transform.up = go.transform.up;

            //goZ.transform.SetParent (go.transform);
            goZ.transform.up = go.transform.forward;

            // add new highlight
            HighlightableObject highlight = go.transform.GetComponent <HighlightableObject>();
            if (highlight == null)
            {
                highlight = go.AddComponent <HighlightableObject> ();
            }
            highlight.ConstantOn(new Color32(255, 100, 0, 255));
        }
    }
Beispiel #3
0
    void AfterUpdate()
    {
        int val = (int)counter;
        //Color col = new Color(GetColorValue(1020, val), GetColorValue(0, val), GetColorValue(510, val), 1f);
        Color col = new Color(0f, 1f, 0f, 1f);

        if (Input.GetMouseButtonDown(0) && Start01.part == ho.gameObject)
        {
            ho.ConstantOnImmediate(col);
        }
        else if (Input.GetMouseButtonUp(0) && Start01.part == ho.gameObject)
        {
            ho.ConstantOffImmediate();
            Start01.part = null;
        }


        counter += Time.deltaTime * speed;
        counter %= period;
    }