void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { OnTargetFound?.Invoke(); } }
private void HandleTrackerOnTargetFound(MLImageTracker.Target target, MLImageTracker.Target.Result result) { OnTargetFound?.Invoke(new MLMarkerTrackerArgs { Reference = _reference, Result = result, }); }
private void UpdateTarget() { PlayerController player = DetectPlayer(); Target = player; if (player != null) { OnTargetFound.Invoke(player); } }
public override void Execute() { targetHouse = houseManager?.GetRandomHouse(); if (targetHouse == null) { OnTargetNotFound?.Invoke(); } else { OnTargetFound?.Invoke(); } }
public void SearchWithRaycast(float searchDistance, OnTargetFound onTargetFound) { RaycastHit hit; Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * searchDistance, Color.red); if (Physics.Raycast(transform.position, transform.forward, out hit, searchDistance)) { if (hit.transform.gameObject.tag == "Player") { onTargetFound(hit); } } }
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(); }
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(); }
/// <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 }
public void RegisterTargetSeeker(OnTargetFound seeker) { seekPath += seeker; }