Ejemplo n.º 1
0
        private void HandleDown()
        {
            // If the game isn't playing don't do anything.
            if (!m_ShootingGalleryController.IsPlaying)
            {
                return;
            }

            if (m_EyeRaycaster.CurrentInteractible != null)
            {
                if (m_EyeRaycaster.CurrentInteractible.GetComponent <CubeObject>())
                {
                    return;
                }
            }
            //W przeciwnym razie, jeśli jest niepodatny obecnie sprawdzany, spróbuj znaleźć w jego skłądzie komponent: Shooting target | Otherwise, if there is an interactible currently being looked at, try to find it's ShootingTarget component.
            ShootingTarget shootingTarget = m_EyeRaycaster.CurrentInteractible ? m_EyeRaycaster.CurrentInteractible.GetComponent <ShootingTarget> () : null; // dodać ShooterTarget2

            /*ShootingTarget2  shootingTarget2 = m_EyeRaycaster.CurrentInteractible ? m_EyeRaycaster.CurrentInteractible.GetComponent<ShootingTarget2> () : null;*/

            // If there is a ShootingTarget component get it's transform as the target for shooting at.
            Transform target = shootingTarget ? shootingTarget.transform : null;

            // Start shooting at the target.
            StartCoroutine(Fire(target));
        }
Ejemplo n.º 2
0
        private void HandleTargetRemoved(ShootingTarget target)
        {
            // Now that the event has been hit, unsubscribe from it.
            target.OnRemove -= HandleTargetRemoved;

            // Return the target to it's object pool.
            m_TargetObjectPool.ReturnGameObjectToPool(target.gameObject);
        }
        private void HandleTargetRemoved(ShootingTarget target)
        {
            // Now that the event has been hit, unsubscribe from it.
            target.OnRemove -= HandleTargetRemoved;

            // Return the target to it's object pool.
            m_TargetObjectPool.ReturnGameObjectToPool(target.gameObject);

            // Increase the likelihood of a spawn next time because there are fewer targets now.
            m_SpawnProbability += m_ProbabilityDelta;
        }
    public void RpcAddScoreBoard()
    {
        GameObject t = GameObject.FindGameObjectWithTag("Ready");

        if (t != null)
        {
            VRStandardAssets.ShootingGallery.ShootingTarget shootingTarget = t.GetComponent <VRStandardAssets.ShootingGallery.ShootingTarget>();
            if (shootingTarget != null)
            {
                shootingTarget.ImReady();
            }
        }
    }
    public void TargetReady(NetworkConnection target)
    {
        GameObject t = GameObject.FindGameObjectWithTag("Ready");

        Debug.Log("Connection is ready " + target.address);
        if (t != null)
        {
            VRStandardAssets.ShootingGallery.ShootingTarget shootingTarget = GetComponent <VRStandardAssets.ShootingGallery.ShootingTarget>();
            if (shootingTarget != null)
            {
                shootingTarget.ImReady();
            }
        }
    }
Ejemplo n.º 6
0
        private void HandleDown()
        {
            // If the game isn't playing don't do anything.
            //if (!m_ShootingGalleryController.IsPlaying)
            //   return;

            // Otherwise, if there is an interactible currently being looked at, try to find it's ShootingTarget component.
            ShootingTarget shootingTarget = m_EyeRaycaster.CurrentInteractible ? m_EyeRaycaster.CurrentInteractible.GetComponent <ShootingTarget>() : null;

            // If there is a ShootingTarget component get it's transform as the target for shooting at.
            Transform target = shootingTarget ? shootingTarget.transform : null;

            // Start shooting at the target.
            StartCoroutine(Fire(target));
        }
Ejemplo n.º 7
0
        private void Spawn(float timeRemaining)                          //mod by ESA,
        {
            // Get a reference to a target instance from the object pool.
            GameObject target = m_TargetObjectPool.GetGameObjectFromPool();

            //make the field collider the parent of the target
            target.transform.parent = m_FieldCollider.transform;

            Vector3 randomPosition = balloonPositions[getRandomIndex()];

            // Set the target's position to a random position. localPosition ensures relative positioning
            target.transform.localPosition = randomPosition;

            //scale the balloon box collider according to the grid size
            target.GetComponent <BoxCollider>().size = new Vector3(gridScale, gridScale, 0.1f);     //gridScale is determined inside makeGrids

            // Find a reference to the ShootingTarget script on the target gameobject and call it's Restart function.
            ShootingTarget shootingTarget = target.GetComponent <ShootingTarget>();

            shootingTarget.Restart(timeRemaining);

            //assign originalradialposition to the center of the target's collider, where the radial will be placed
            // shootingTarget.originalradialposition = originalradialposition;



            //Radial stuff//
            //assign radialposition to the same place as target
            // shootingTarget.radialposition = randomPosition;

            //supply the target with a reference to the selection radial being used
            target.GetComponent <ShootingTarget>().m_SelectionRadial = m_SelectionRadial;

            //restart the fill on the selection radial
            target.GetComponent <ShootingTarget>().m_SelectionRadial.Unfill();


            //Eye tracking stuff//
            //supply the target with a reference to the SelectionGaze script being used
            target.GetComponent <ShootingTarget>().m_SelectionGaze = m_SelectionGaze;

            //reset the gazeselecting processs
            target.GetComponent <ShootingTarget>().m_SelectionGaze.resetGaze();
            //End//

            // Subscribe to the OnRemove event.
            shootingTarget.OnRemove += HandleTargetRemoved;
        }
        private void Spawn(float timeRemaining)
        {
            // Get a reference to a target instance from the object pool.
            GameObject target = m_TargetObjectPool.GetGameObjectFromPool();

            // Set the target's position to a random position.
            target.transform.position = SpawnPosition();

            // Find a reference to the ShootingTarget script on the target gameobject and call it's Restart function.
            ShootingTarget shootingTarget = target.GetComponent <ShootingTarget>();

            shootingTarget.Restart(timeRemaining);

            // Subscribe to the OnRemove event.
            shootingTarget.OnRemove += HandleTargetRemoved;
        }
Ejemplo n.º 9
0
        private void Spawn(float timeRemaining)
        {
            // Get a reference to a target instance from the object pool.
            GameObject target = m_TargetObjectPool.GetGameObjectFromPool();

            // Set the target's position to a random position.
            target.transform.position = SpawnPosition();

            // Znajdź odwołanie do skryptu ShootingTarget na 'cel' typu gameobject i ?nazywaj? to funkcją Restart. | Find a reference to the ShootingTarget script on the target gameobject and call it's Restart function.
            ShootingTarget shootingTarget = target.GetComponent <ShootingTarget>();

            shootingTarget.Restart(timeRemaining);

            /*ShootingTarget2 shootingTarget2 = target.GetComponent<ShootingTarget2>();
             * shootingTarget.Restart(timeRemaining);*/

            // Subscribe to the OnRemove event.
            shootingTarget.OnRemove += HandleTargetRemoved;
        }
Ejemplo n.º 10
0
        private void HandleTargetRemoved(ShootingTarget target)
        {
            // Now that the event has been hit, unsubscribe from it.
            target.OnRemove -= HandleTargetRemoved;

            // Return the target to it's object pool.
            m_TargetObjectPool.ReturnGameObjectToPool (target.gameObject);

            // Increase the likelihood of a spawn next time because there are fewer targets now.
            m_SpawnProbability += m_ProbabilityDelta;
        }