Exemple #1
0
        private void Update()
        {
            if (m_ActionState.ActionState != ActionCode.Idle)
            {
                return;
            }

            if (Input.GetButtonDown("AutoAttack"))
            {
                var mousePoint = InputExtension.GetMouseHitGroundPoint();
                if (mousePoint == null)
                {
                    return;
                }
                var forwardVec = mousePoint.Value - transform.position;
                forwardVec = forwardVec.normalized;
                RequestAutoAttack(forwardVec);
            }

            if (PerformContinueAAs && m_ContinueAutoAttack)
            {
                if (!TargetInRange())
                {
                    m_ContinueAutoAttack = false;
                    return;
                }

                var forwardVec = GameData.Target.transform.position - transform.position;
                forwardVec = forwardVec.normalized;
                RequestAutoAttack(forwardVec);
            }
        }
    /* protected & private - Field declaration         */


    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/


    // ========================================================================== //

    /* protected - Override & Unity API         */

    private void Update()
    {
        float fChangedDelta = InputExtension.GetZoomInOut_ChangedDelta();

        if (fChangedDelta != 0f)
        {
            Debug.Log(fChangedDelta);
            Camera.main.fieldOfView += fChangedDelta * fZoomSpeed;
            Camera.main.fieldOfView  = Mathf.Clamp(Camera.main.fieldOfView, FOV_Min, FOV_Max);
        }
    }
        public SdlInput(string controllerMappingFilepath)
        {
            ControllerMappingFilepath = controllerMappingFilepath;

            Timestamp = 0;
            Buttons   = new InputButtons();
            Analog    = new InputAnalogue();
            Extension = new InputExtension();

            // Set "controller byte"
            Extension.Unknown1 = 1;
        }
Exemple #4
0
        public DxInput(string controllerMappingFilepath)
        {
            ControllerMappingFilepath = controllerMappingFilepath;

            Timestamp = 0;
            Buttons   = new InputButtons();
            Analog    = new InputAnalogue();
            Extension = new InputExtension();

            // Set "controller byte"
            Extension.Unknown1 = 1;

            // Initialize DirectInput
            _directInput = new DirectInput();
        }
        /// <summary>
        /// Send controller input frame
        /// </summary>
        /// <param name="createdTime">Creation timestamp of input data.</param>
        /// <param name="buttons">Input button data.</param>
        /// <param name="analogue">Input analog axis data.</param>
        /// <param name="extension">Input extension data.</param>
        /// <returns></returns>
        public async Task SendInputFrame(DateTime createdTime, InputButtons buttons,
                                         InputAnalogue analogue, InputExtension extension)
        {
            // Convert DateTime to relative timestamp
            // e.g. microSeconds since reference timestamp
            ulong      createdTimestampMicroS = DateTimeHelper.ToTimestampMicroseconds(createdTime, ReferenceTimestamp);
            InputFrame frame = new InputFrame(NextFrameId, Timestamp, createdTimestampMicroS,
                                              buttons, analogue, extension);

            /*
             * await WaitForMessageAsync<InputFrameAck>(
             *  TimeSpan.FromMilliseconds(10),
             *  async () => await SendAsync(frame)
             * );
             */
            await SendAsync(frame);
        }
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        for (int i = 0; i < _axisStrings.Length; i++)
        {
            _axes.Add(_axisStrings[i], new AxisDownTracking { axisName = _axisStrings[i] });
        }
    }
Exemple #7
0
 // Update is called once per frame
 void Update()
 {
     if (m_ReadInput)
     {
         KeyCode keypress = KeyCode.None;
         if (Input.anyKeyDown)
         {
             keypress = InputExtension.GetKeyDown();
             m_Keys.Add(keypress);
         }
         if (m_Keys.Count > 0 && Input.GetKeyUp(m_Keys[m_Keys.Count - 1]))
         {
             bool?result = m_Callback?.Invoke(m_Keys);
             m_ReadInput = !result.HasValue || !result.Value;
             if (!m_ReadInput)
             {
                 InputUI.Instance.UpdateText(m_Keys);
             }
         }
     }
 }
Exemple #8
0
    public void Update()
    {
        if (checkingAxis)
        {
            float value = InputExtension.GetAxis(axisName);

            raise = value > previousValue ? true : false;
            Rotate(value, targetAngle);

            if (raise)
            {
                int div = (int)(value / 0.33f);
                if (div != brakePhase)
                {
                    brakePhase = div;

                    if (audioSource != null && handbrakeUp != null)
                    {
                        audioSource.clip = handbrakeUp;
                        audioSource.Play();
                    }
                }
            }
            else if (!raise && value < 0.33f && brakePhase != 0)
            {
                brakePhase = 0;
                if (audioSource != null && handbrakeDown != null)
                {
                    audioSource.clip = handbrakeDown;
                    if (!audioSource.isPlaying)
                    {
                        audioSource.Play();
                    }
                }
            }

            previousValue = value;
        }
    }
    private void SkillCalled(ActionCode skill)
    {
        // TODO: Refactor with strategy pattern.

        //No target skills
        switch (skill)
        {
        case ActionCode.Dash:
            RequestOperations.DashRequest();
            break;

        case ActionCode.HammerBash:
            var hbAction = new Action(() => CastSkill(skill, Vector3.back, 1f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, hbAction);
            RequestOperations.HammerBashRequest();
            break;
        }

        //Character target skills
        switch (skill)
        {
        case ActionCode.DistractingShot:
            var mousePoint = InputExtension.GetMouseHitGroundPoint();
            if (mousePoint == null)
            {
                return;
            }

            var forwardVec = mousePoint.Value - m_Player.transform.position;
            forwardVec = forwardVec.normalized;
            var dsAction = new Action(() => CastSkill(skill, mousePoint.Value, 0.5f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, dsAction);
            RequestOperations.DistractingShotRequest(forwardVec);
            break;

        case ActionCode.OrisonOfHealing:
            if (GameData.Target != null || m_TargetSelector.SetTarget())
            {
                var oohAction = new Action(() => CastSkill(skill, GameData.Target.transform.position, 1f));
                ResponseOperations.AddActionToResponseWaitinglist(skill, oohAction);
                RequestOperations.OrisonOfHealingRequest(GameData.Target.name);
                //CastSkill(skill, GameData.Target.transform.position, 1f);
            }
            break;
        }

        //Mouse position as target skills
        switch (skill)
        {
        case ActionCode.FireStorm:
            var mousePoint = InputExtension.GetMouseHitGroundPoint();
            if (mousePoint == null)
            {
                return;
            }

            var action = new Action(() => CastSkill(skill, mousePoint.Value, 2f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, action);
            RequestOperations.FireStormRequest(mousePoint.Value);
            break;
        }
    }
Exemple #10
0
 protected void Start()
 {
     inputManager = gameObject.AddComponent <InputExtension>();
     inputManager.horizontalAxis = CursorEditor.ControlScheme.HorizontalAxis;
 }
Exemple #11
0
    void PressPedal(string inputAxis, Rotator rotator)
    {
        float value = InputExtension.GetAxis(inputAxis);

        rotator.Rotate(value, rotator.targetAngle);
    }