Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        GameObject     camera         = GameObject.Find("Main Camera");
        KinectListener kinectListener = camera.GetComponent <KinectListener>();

        if (inHand == false && kinectListener.releasedNow == false)
        {
            inHand = true;
        }

        thrown = kinectListener.releasedNow;

        float magicCoeff = 75.0f;

        //if (inHand == true && thrown == false)
        //{
        transform.position = new Vector3((float)kinectListener.handX * 20.0f,
                                         (float)kinectListener.handy * 20.0f,
                                         20.0f - (float)kinectListener.handz * 30.0f); // Magic values are fun
        //}
        if (inHand == true && thrown == true)
        {
            inHand = false;
            //throwVel = rb.velocity;
            //rb.velocity = new Vector3(magicCoeff * (float)kinectListener.releasedXVelocity,
            //                          magicCoeff * (float)kinectListener.releasedYVelocity,
            //                          magicCoeff * (float)kinectListener.releasedZVelocity);
            Transform obj;
            obj = Instantiate <Transform>(bag, transform.position, Quaternion.identity);
            obj.GetComponent <Rigidbody>().velocity = new Vector3(magicCoeff * (float)kinectListener.releasedXVelocity,
                                                                  magicCoeff * (float)kinectListener.releasedYVelocity,
                                                                  (magicCoeff + 5.0f) * (float)kinectListener.releasedZVelocity);
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        GameObject     camera         = GameObject.Find("Main Camera");
        KinectListener kinectListener = camera.GetComponent <KinectListener>();

        other.gameObject.SetActive(false);
        kinectListener.score  += 10;
        kinectListener.newBall = true;
    }
Exemplo n.º 3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
        public RenderingController(NetworkConfig aNetworkConfig, Type aRendererClass, int aByteIndex)
        {
            config = aNetworkConfig;

            rendererType = aRendererClass;

            listener = new KinectListener(aByteIndex);
            listener.Attach(this);

            renderers = new List <KinectRenderer>();
        }