Inheritance: MonoBehaviour, IGvrGazePointer
Exemple #1
0
 // Use this for initialization
 void Start()
 {
     center       = new Vector3(Screen.width / 2, Screen.height / 2, 0);
     gvrMain      = GameObject.Find("GvrMain");
     reticle      = gvrMain.GetComponentInChildren <GvrReticle>();
     crouchObject = GameObject.Find("Croucher");
 }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     //Check to see if the head has rotated down to the toggleAngle, but not more than straight down
     if (Body.transform.eulerAngles.x >= toggleAngle && Body.transform.eulerAngles.x < 90.0f)
     {
         //Debug.Log("Euler Angle: First Loop" + Body.transform.eulerAngles.x);
         moveforward = true;
     }
     else
     {
         //Debug.Log ("Euler Angle x" + Body.eulerAngles.x);
         //stop moving
         moveforward = false;
     }
     if (moveforward)
     {
         temPos = transform.position; //current coordinates
         Vector3 tmp = GvrReticle.returnPt();
         //Debug.Log(tmp);
         tmp.y = 2.0f;//Maybe set this diferently for the bombs???
         //tmp = tmp * Time.deltaTime * speed;
         //parentMove.transform.position = new Vector3(temPos.x - ((tmp.x / 60)), 2.0f, temPos.z - ((tmp.z / 60)));
         parentMove.transform.position = new Vector3(temPos.x + (tmp.x - temPos.x) / 60, 1.5f, temPos.z + (tmp.z - temPos.z) / 60);
         //float step = speed * Time.deltaTime;
         //transform.position = Vector3.MoveTowards(parentMove, tmp, step);
         //Debug.Log(Body.transform.position);
     }
 }
    // Use this for initialization
    void Start()
    {
        GvrReticle ParentObject = GameObject.FindObjectOfType <GvrReticle> ();

        if (ParentObject != null)
        {
            this.transform.parent = ParentObject.transform;


            if (RotationDirection == RotationDirection.clockwise)
            {
                this.transform.localScale = new Vector3(1, 1, 1);
            }
            else
            {
                this.transform.localScale = new Vector3(-1, 1, 1);
            }
            this.transform.localPosition = new Vector3(0, 0, 0);

            switch (RotationStart)
            {
            case RotationStart.top:
                this.transform.localRotation = Quaternion.identity;
                break;

            case RotationStart.left:
                this.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 90));
                break;

            case RotationStart.bottom:
                this.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 180));
                break;

            case RotationStart.right:
                this.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 270));
                break;

            default:
                break;
            }

            EventSystem      = GameObject.FindObjectOfType <EventSystem> ();
            Renderer         = this.GetComponent <MeshRenderer> ();
            Renderer.enabled = false;
            Parent           = this.transform.parent;
            Source           = Parent.gameObject.GetComponent <Renderer> ().material;
            Copy             = this.gameObject.GetComponent <Renderer> ().material;
            OriginalColor    = Source.GetColor("_Color");

            this.gameObject.AddComponent <MeshFilter> ();
            RingMesh = new Mesh();
            GetComponent <MeshFilter> ().mesh = RingMesh;
        }
        else
        {
            throw new UnityException("There is no GvrReticle in the Scene. Please add the GvrReticle prefab to the GvrMain prefab under GvrMain/Head/MainCamera.");
        }
    }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        moverScript = GetComponent <Mover> ();
        smallScale  = sphereScale;
        largeScale  = smallScale * scale;

        reticle      = reticleObj.GetComponent <GvrReticle> ();
        reticleColor = reticleMat.color;
    }