Esempio n. 1
0
 private void Update(ref PlayerRaycastTargetTemplate template)
 {
     if (template.Graph.CurrentTag == GraphNodeTags.Action)
     {
         template.Target.Set(PlayerInputSystem.GetMouseRaycastPosition(template.Raycast.Range));
     }
 }
Esempio n. 2
0
 public override void Evaluate(ActionUsingNode node)
 {
     if (_isWaiting)
     {
         if (TimeManager.Time >= node.ActionEvent.TimeStart + WaitTime)
         {
             node.AdvanceEvent();
         }
         return;
     }
     if (!PlayerInputSystem.GetButton(ChargeInput) || _vitalStat.Current < Cost)
     {
         node.AdvanceEvent();
     }
 }
Esempio n. 3
0
        void Update()
        {
            if (ControlRotation)
            {
                HandleRotationMovement();
            }
            var scroll = PlayerInputSystem.GetAxis("Scroll");

            if (Mathf.Abs(scroll) < 0.05f)
            {
                return;
            }
            CamDistance += (scroll * ZoomSmoothing);
            CamDistance  = Mathf.Clamp(CamDistance, CamMinDistance, CamMaxDistance);
            _cam.transform.localPosition = new Vector3(0, 0, -CamDistance);
        }
Esempio n. 4
0
        private void HandleRotationMovement()
        {
            if (Time.timeScale < float.Epsilon)
            {
                return;
            }
            SetRootRotation(PlayerInputSystem.GetAxis(PlayerControls.MoveX));
            float y = PlayerInputSystem.GetAxis(PlayerControls.LookY);

            _tiltAngle     -= y * TurnSpeed;
            _tiltAngle      = Mathf.Clamp(_tiltAngle, -TiltMin, TiltMax);
            _pivotTargetRot = Quaternion.Euler(_tiltAngle, _pivotEulers.y, _pivotEulers.z);
            if (TurnSmoothing > 0)
            {
                _pivot.localRotation = Quaternion.Slerp(_pivot.localRotation, _pivotTargetRot,
                                                        TurnSmoothing * TimeManager.DeltaTime);
            }
            else
            {
                _pivot.localRotation = _pivotTargetRot;
            }
        }
        public void Trigger(ActionEvent ae, string eventName)
        {
            var     origin = ae.Origin;
            Vector3 originPos;
            Vector3 target;

            if (origin.Tags.Contain(EntityTags.Player))
            {
                originPos = PlayerInputSystem.GetLookTargetRay.origin;
                target    = PlayerInputSystem.GetMouseRaycastPosition(ae.Action.Config.Range);
            }
            else
            {
                originPos = ae.Position;
                target    = ae.Origin.Target.GetPosition;
            }
            var actionEntity = ae.Action.Entity;
            var ray          = new Ray(originPos, (target - originPos).normalized);

            if (CollisionCheckSystem.Raycast(actionEntity, ray, RayDistance, LimitToEnemy) == null && RaySize > 0.01f)
            {
                CollisionCheckSystem.SphereCast(actionEntity, ray, RayDistance, RaySize, LimitToEnemy);
            }
        }
Esempio n. 6
0
 public override bool TryComplete(float dt)
 {
     if (base.TryComplete(dt))
     {
         return(true);
     }
     if (_owner == null)
     {
         return(true);
     }
     if (_isWaiting)
     {
         if (TimeManager.Time >= TimeEntered + _originalNode.WaitTime)
         {
             return(true);
         }
         return(false);
     }
     if (!PlayerInputSystem.GetButton(_config.ChargeInput) || _vitalStat.Current < _config.Cost)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 7
0
        public override void OnInspectorGUI()
        {
            var script = (InputDebugger)target;

            if (!Game.GameActive || !Application.isPlaying)
            {
                EditorGUILayout.LabelField("Game Not Active");
                return;
            }
            EditorGUILayout.LabelField(string.Format("Time: {0}", TimeManager.Time.ToString("F4")));
            EditorGUILayout.LabelField(string.Format("Look: {0}", PlayerInputSystem.LookInput));
            EditorGUILayout.LabelField(string.Format("Move: {0}", PlayerInputSystem.MoveInput));
            EditorGUILayout.LabelField(string.Format("IsCursorOverUI: {0}", PlayerInputSystem.IsCursorOverUI));
            if (script.CheckButtons != null)
            {
                for (int i = 0; i < script.CheckButtons.Length; i++)
                {
                    var button = script.CheckButtons[i];
                    if (string.IsNullOrEmpty(button))
                    {
                        continue;
                    }
                    EditorGUILayout.LabelField(string.Format("{0} is down: {1}", button, PlayerInputSystem.GetButton(button)));
                }
            }
            //if (GUILayout.Button("Test")) {}
            base.OnInspectorGUI();
        }