Пример #1
0
        public virtual void EmitAngularVelocity()
        {
            if (Source == null)
            {
                return;
            }

            AngularVelocityEmitted?.Invoke(Source.GetAngularVelocity());
        }
Пример #2
0
        public void Trigger()
        {
            var groundPoint = GetGroundPoint();

            if (groundPoint != null)
            {
                OnInteractedUnityEvent.Invoke((Vector3)groundPoint);
            }
        }
        /// <summary>
        /// Extracts the parts of the event data.
        /// </summary>
        /// <param name="eventData">The event data to extract from.</param>
        public virtual void Extract(ObjectDistanceComparator.EventData eventData)
        {
            if (!isActiveAndEnabled)
            {
                return;
            }

            DifferenceExtracted?.Invoke(eventData.difference);
            DistanceExtracted?.Invoke(eventData.distance);
        }
        public virtual void Extract(ObjectDistanceComparator.EventData eventData)
        {
            if (eventData == null)
            {
                return;
            }

            DifferenceResult = eventData.CurrentDifference;
            DifferenceExtracted?.Invoke(DifferenceResult);
            DistanceResult = eventData.CurrentDistance;
            DistanceExtracted?.Invoke(DistanceResult);
        }
Пример #5
0
 void Update()
 {
     if (projectile != null)
     {
         var vel = projectile.GetComponent <Rigidbody>().velocity;
         if (vel == Vector3.zero)
         {
             return;
         }
         var pos = projectile.transform.position;
         position = Mechanics.FinalProjectilePosition(pos, vel, yIntersect);
         OnPredict.Invoke(position);
     }
 }
Пример #6
0
        private void Update()
        {
            // Poll Input
            // Grip
            bool leftGripIsPressed = false;

            if (_leftController.isValid)
            {
                _leftController.IsPressed(InputHelpers.Button.Grip, out leftGripIsPressed);
            }
            if (leftGripIsPressed != _leftGripPressedState)
            {
                _leftGripPressed.Invoke(leftGripIsPressed);
                _leftGripPressedState = leftGripIsPressed;
            }

            bool rightGripIsPressed = false;

            if (_rightController.isValid)
            {
                _rightController.IsPressed(InputHelpers.Button.Grip, out rightGripIsPressed);
            }
            if (rightGripIsPressed != _lastRightGripIsPressed)
            {
                _rightGripPressed.Invoke(rightGripIsPressed);
                _lastRightGripIsPressed = rightGripIsPressed;
            }

            // Polling velocity requires the node states... Unity is weird
            List <XRNodeState> nodes = new List <XRNodeState>();

            InputTracking.GetNodeStates(nodes);

            foreach (XRNodeState ns in nodes)
            {
                if (ns.nodeType == XRNode.LeftHand)
                {
                    ns.TryGetVelocity(out _leftVelocity);
                }
                if (ns.nodeType == XRNode.RightHand)
                {
                    ns.TryGetVelocity(out _rightVelocity);
                }
            }

            LeftVelocityUpdate.Invoke(_leftVelocity);
            RightVelocityUpdate.Invoke(_rightVelocity);
        }
        /// <summary>
        /// Extracts the play area dimensions.
        /// </summary>
        /// <returns>The extracted play area dimensions.</returns>
        public virtual Vector3 Extract()
        {
            if (!isActiveAndEnabled)
            {
                return(Result);
            }

            if (Boundary.TryGetDimensions(out Vector3 dimensions))
            {
                Result = dimensions;
                Extracted?.Invoke(Result);
            }
            else
            {
                Failed?.Invoke();
            }

            return(Result);
        }
Пример #8
0
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ public override void Invoke()
/*AUTO SCRIPT*/ {
/*AUTO SCRIPT*/ onInvoke.Invoke(value);
/*AUTO SCRIPT*/ }
Пример #9
0
 private void Awake()
 {
     PositionEmmit.Invoke(transform.position);
 }
Пример #10
0
        public void ManualUpdate()
        {
            GridCell selected;
            Vector3  point;

            Vector3 mousePos = Input.mousePosition;

            Ray ray = camera.ScreenPointToRay(mousePos);

            RaycastHit[] hits = Physics.RaycastAll(ray);

            bool isInCell = false;

            if (Input.GetMouseButtonDown(0))
            {
                if (CheckGridCell(hits, out selected))
                {
                    onDownCell.Invoke(selected);
#if UNITY_EDITOR
                    DrawGizmoCell(selected, gizmoDownColor, 0.75f);
#endif
                    isInCell = true;
                }

                if (CheckGridPoint(hits, out point))
                {
                    onDown.Invoke(point);

                    Color pointColor = isInCell ? gizmoDownColor : gizmoFailColor;

#if UNITY_EDITOR
                    DrawGizmoPoint(point, Color.Lerp(pointColor, Color.black, 0.35f), 0.5f);
#endif
                }
            }
            else if (Input.GetMouseButton(0))
            {
                if (CheckGridCell(hits, out selected))
                {
                    onDragCell.Invoke(selected);
#if UNITY_EDITOR
                    DrawGizmoCell(selected, gizmoDragColor);
#endif
                    isInCell = true;
                }

                if (CheckGridPoint(hits, out point))
                {
                    onDrag.Invoke(point);

                    Color pointColor = isInCell ? gizmoDragColor : gizmoFailColor;

#if UNITY_EDITOR
                    DrawGizmoPoint(point, Color.Lerp(pointColor, Color.black, 0.35f));
#endif
                }
            }
            else if (Input.GetMouseButtonUp(0))
            {
                if (CheckGridCell(hits, out selected))
                {
                    onUpCell.Invoke(selected);
#if UNITY_EDITOR
                    DrawGizmoCell(selected, gizmoUpColor, 0.75f);
#endif
                    isInCell = true;
                }

                if (CheckGridPoint(hits, out point))
                {
                    onUp.Invoke(point);

                    Color pointColor = isInCell ? gizmoUpColor : gizmoFailColor;

#if UNITY_EDITOR
                    DrawGizmoPoint(point, Color.Lerp(pointColor, Color.black, 0.35f), 0.5f);
#endif
                }
            }
            else
            {
                if (CheckGridCell(hits, out selected))
                {
                    onOverCell.Invoke(selected);
#if UNITY_EDITOR
                    DrawGizmoCell(selected, gizmoUpColor);
#endif
                    isInCell = true;
                }

                if (CheckGridPoint(hits, out point))
                {
                    onOver.Invoke(point);

                    Color pointColor = isInCell ? gizmoOverColor : gizmoFailColor;

#if UNITY_EDITOR
                    DrawGizmoPoint(point, Color.Lerp(pointColor, Color.black, 0.35f));
#endif
                }
            }
        }
Пример #11
0
 private void OnScaleChanged(Vector3 scale)
 {
     _scaleChanged.Invoke(scale);
 }
 public override void OnEventRaised(Vector3 data)
 {
     _response.Invoke(data);
 }
 protected void CallEvent()
 {
     OnJoystickMoved?.Invoke(new Vector3(Horizontal, 0f, Vertical));
 }
Пример #14
0
 public void GenerateDirectionEvent()
 {
     onDirectionGenerated.Invoke(GenerateNormalisedDirection());
 }
Пример #15
0
 public void GeneratePositionEvent()
 {
     onPositionGenerated.Invoke(GeneratePositionInVolumes());
 }
 protected override void CastedHandler(object data)
 {
     responce?.Invoke((Vector3)data);
 }
Пример #17
0
        private void RaiseUpdatedVector3(Vector3 value)
        {
//            Debug.Log("RaiseUpdatedVector3 " + value);
            _updatedVector3.Invoke(value);
        }
Пример #18
0
 public override void OnEventRaised(params object[] parameters)
 {
     Response.Invoke((Vector3)parameters[0]);
 }