예제 #1
0
        public void Update()
        {
            if (Image == null || Image.TrackingState != TrackingState.Tracking)
            {
                //Sphere.SetActive(false);
                return;
            }
            int sCount = spheresList.Count;
            int pCount = positionsList.Count;

            if (sCount - 3 < pCount)
            {
                text.text = "true";

                for (int i = sCount - 3; i < pCount; i++)
                {
                    /*
                     * GameObject s = (GameObject)Instantiate(Sphere, anchor.transform);
                     * s.transform.localPosition =
                     *        (positionsList[i][0] * Vector3.right) + (positionsList[i][1] * Vector3.forward) +
                     *        (positionsList[i][2] * Vector3.down);
                     * spheresList.Add(s);
                     * s.SetActive(true);
                     */
                    AudioFire s = (AudioFire)Instantiate(AudioFirePrefab, anchor.transform);
                    s.Key = keysList[i];
                    s.gameObject.transform.localPosition =
                        (positionsList[i][0] * Vector3.right) + (positionsList[i][1] * Vector3.forward) +
                        (positionsList[i][2] * Vector3.down);
                    spheresList.Add(s.gameObject);
                    s.SetActive(true);
                }
            }

            /*
             * Sphere.transform.localPosition =
             *        (1 * Vector3.left) + (1 * Vector3.forward) +
             *        (1 * Vector3.down);
             *
             * Sphere.SetActive(false);
             */

            text.text = positionsList.Count + ", " + spheresList.Count + ", " + fireList.Count;
        }
예제 #2
0
        /// <summary>
        /// The Unity Update method.
        /// </summary>

        public void Start()
        {
            anchor = Image.CreateAnchor(Image.CenterPose);
            float x = 0.2f;
            float y = 0.2f;
            float z = 0.2f;

            //Destroy(Sphere);
            for (int i = 0; i < 3; i++)
            {
                /*
                 * GameObject s = (GameObject)Instantiate(Sphere, anchor.transform);
                 * s.transform.localPosition =
                 *        (positionsList[i][0] * Vector3.right) + (positionsList[i][1] * Vector3.forward) +
                 *        (positionsList[i][2] * Vector3.down);
                 * s.SetActive(true);
                 */

                /*
                 * GameObject s2 = (GameObject)Instantiate(Sphere, anchor.transform);
                 * s2.transform.localPosition =
                 *        (x * Vector3.right) + (y * Vector3.forward) +
                 *        (z * Vector3.down);
                 * x += 0.1f;
                 * y += 0.1f;
                 * z += 0.1f;
                 * s2.SetActive(true);
                 * spheresList.Add(s2);
                 */
                AudioFire s2 = (AudioFire)Instantiate(AudioFirePrefab, anchor.transform);
                s2.gameObject.transform.localPosition =
                    (x * Vector3.right) + (y * Vector3.forward) +
                    (z * Vector3.down);
                x += 0.1f;
                y += 0.1f;
                z += 0.1f;
                s2.SetActive(true);
                spheresList.Add(s2.gameObject);
                fireList.Add(s2);
            }
        }