void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         OnTargetFound?.Invoke();
     }
 }
Esempio n. 2
0
 private void HandleTrackerOnTargetFound(MLImageTracker.Target target, MLImageTracker.Target.Result result)
 {
     OnTargetFound?.Invoke(new MLMarkerTrackerArgs
     {
         Reference = _reference,
         Result    = result,
     });
 }
Esempio n. 3
0
    private void UpdateTarget()
    {
        PlayerController player = DetectPlayer();

        Target = player;

        if (player != null)
        {
            OnTargetFound.Invoke(player);
        }
    }
Esempio n. 4
0
 public override void Execute()
 {
     targetHouse = houseManager?.GetRandomHouse();
     if (targetHouse == null)
     {
         OnTargetNotFound?.Invoke();
     }
     else
     {
         OnTargetFound?.Invoke();
     }
 }
Esempio n. 5
0
    protected override void OnTrackingFound()
    {
        if (mTrackableBehaviour && SceneController.IsMobile)
        {
            if (!_isFirstFound)
            {
                var gameControllerTransform = _gameController.transform;
                var trackableTransform      = mTrackableBehaviour.transform;

                gameControllerTransform.parent        = trackableTransform.parent;
                gameControllerTransform.localScale    = new Vector3(0.5f, 0.5f, 0.5f);
                gameControllerTransform.localPosition = Vector3.zero;
                gameControllerTransform.localRotation = Quaternion.identity;

                _gameController.enabled = true;

                _isFirstFound = true;
            }

            var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true);
            var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true);
            var canvasComponents   = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true);

            SetActivePhotonViews(_photonViews, true);

            foreach (var component in rendererComponents)
            {
                component.enabled = true;
            }

            foreach (var component in colliderComponents)
            {
                component.enabled = true;
            }

            foreach (var component in canvasComponents)
            {
                component.enabled = true;
            }
        }

        OnTargetFound?.Invoke();
    }
Esempio n. 6
0
    protected override void OnTrackingFound()
    {
        if (mTrackableBehaviour)
        {
            isOn = true;

            var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true);
            var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true);
            var canvasComponents   = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true);

            // Enable rendering:
            foreach (var component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (var component in colliderComponents)
            {
                component.enabled = true;
            }

            // Enable canvas':
            foreach (var component in canvasComponents)
            {
                component.enabled = true;
            }
        }

        if (OnTargetFound != null)
        {
            OnTargetFound.Invoke();
        }

        hasBeenUsed();
    }
Esempio n. 7
0
        /// <summary>
        /// Adds a new image target to be tracked.
        /// </summary>
        private void AddTarget()
        {
            #if PLATFORM_LUMIN
            _imageTarget = MLImageTrackerStarterKit.AddTarget(gameObject.GetInstanceID().ToString(), image, longerDimensionInSceneUnits, HandleAllTargetStatuses, isStationary);

            if (_imageTarget == null)
            {
                Debug.LogErrorFormat("MLImageTrackerBehavior.AddTarget failed to add target {0} to the image tracker.", gameObject.name);
                return;
            }

            _imageTarget.OnFound   += (MLImageTracker.Target target, MLImageTracker.Target.Result result) => { OnTargetFound?.Invoke(target, result); };
            _imageTarget.OnLost    += (MLImageTracker.Target target, MLImageTracker.Target.Result result) => { OnTargetLost?.Invoke(target, result); };
            _imageTarget.OnUpdated += (MLImageTracker.Target target, MLImageTracker.Target.Result result) => { OnTargetUpdated?.Invoke(target, result); };
            #endif
        }