public void OnPointerUp(PointerEventData eventData) { Vector3 vec = Camera.main.ScreenToWorldPoint(eventData.position); vec.z = 0; MouseUp2D.Invoke(vec); }
void DoAction() { action.Invoke(spawnThreshold); counter++; spawnThreshold.y += Interval; spawnThreshold.x += Interval; spawnThreshold.z += Interval; }
public static void TriggerEvent(string eventName, Vector2 param) { UnityEventVector3 thisEvent = null; if (Instance != null && Instance.eventDictionaryVector3.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(param); } }
private void OnEventRaised(Vector3 value) { if (useDebug) { //Debug.Log(name + " | OnEventRaised: " + value.ToString(), this); Debug.Log(_response.GetPersistentEventCount()); } _response?.Invoke(value); }
// Update is called once per frame void Update() { if (IsEnabled && Input.GetMouseButton(0)) { var ray = MainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out RaycastHit hit)) { OnClickHit.Invoke(hit.point); } } }
public void OnPointerClick(PointerEventData eventData) { if (dragging) { return; } Vector3 worldPoint = Camera.main.ScreenToWorldPoint(eventData.position); worldPoint.z = 0; OnTap.Invoke(worldPoint); eventData.Use(); }
private void Update() { if (variable == null) { return; } if (lastFrameValue != variable.Value) { onValueChanged.Invoke(variable.Value); } lastFrameValue = variable.Value; }
private void UpdateTravelValue(Single travelValue) { if (_travelValue == travelValue) { return; } _travelValue = travelValue; var(position, direction) = _PathsTraversal.Evaluate(travelValue); OnProgressChange?.Invoke(travelValue); OnDirectionChange?.Invoke(direction); OnPositionChange?.Invoke(position); }
public void OnDrag(PointerEventData eventData) { if (!dragging) { return; } LineRenderer.positionCount++; Vector3 pos = Camera.main.ScreenToWorldPoint(eventData.position); pos.z = 0; OnSwiping.Invoke(pos); LineRenderer.SetPosition(LineRenderer.positionCount - 1, pos); if (LineRenderer.positionCount > 1) { line[0] = LineRenderer.GetPosition(LineRenderer.positionCount - 1); line[1] = LineRenderer.GetPosition(LineRenderer.positionCount - 2); OnSwipingDistanceChange.Invoke(line); } eventData.Use(); }
protected virtual void OnGizmoMove() { onGizmoMoved.Invoke(transform.position); }
// -- Public Functions public void OnEventRaised(Vector3 value) { EventVector3Response.Invoke(value); }
void OnSignal(Vector3 v) { onSignal.Invoke(v); }
public void OnEventRaised(Vector3Int parameter) { ResponseVector3Int.Invoke(parameter); }
private void Update() { var dashTo = transform.forward; if (allowInput && !dashing) { if (target != null) { target.onPopped.RemoveListener(EndDash); } target = null; if (Input.GetAxis("Fire1") > 0) { if (requireTarget && pimpleSpawner != null) { var pimples = pimpleSpawner.Pimples; float minCos = Mathf.Cos(pimpleSpotAngle); float nearestSqrDist = -1; foreach (var pimple in pimples) { if (pimple != null && pimple.ReadyToLance) { var toPimple = pimple.transform.position - transform.position; if (toPimple.sqrMagnitude <= pimpleSpotDistance * pimpleSpotDistance) { var pimplePlanarDireciton = (toPimple - Vector3.Project(toPimple, transform.up)).normalized; var cos = Vector3.Dot(transform.forward, pimplePlanarDireciton); if (cos >= minCos) { if (nearestSqrDist < 0 || (toPimple.sqrMagnitude < nearestSqrDist)) { nearestSqrDist = toPimple.sqrMagnitude; target = pimple; target.onPopped.AddListener(EndDash); dashTo = pimplePlanarDireciton; cachedSqrDist = nearestSqrDist; } } } } } } if (!requireTarget || target != null) { dashing = true; dashRemaining = dashTime; dashTo *= dashModifier; dashStarted.Invoke(dashTo); } } } if (dashing) { bool hasTarget = target != null && !target.Popped; if (hasTarget && (target.transform.position - transform.position).sqrMagnitude > cachedSqrDist) { hasTarget = false; } if (dashRemaining > 0 || hasTarget) { dashRemaining -= Time.deltaTime; } else { EndDash(); } } }