Ejemplo n.º 1
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.º 3
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;
        }