Inheritance: MonoBehaviour
        public static State GetState(PlayerIndex playerIndex, DeadZone deadZone)
        {
            State.RawState state;
            uint           result = DLL.XInputGamePadGetState((uint)playerIndex, out state);

            return(new State(result == Utils.Success, state, deadZone));
        }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     _controller        = GetComponent <CharacterController>();
     _um                = GameObject.Find("Canvas").GetComponent <UIManager>();
     _deadZone          = GameObject.Find("DeadZone").GetComponent <DeadZone>();
     transform.position = _spawnPlace;
 }
Example #3
0
 private void Awake()
 {
     _scoreZone     = FindObjectOfType <ScoreZone>();
     _deadZone      = FindObjectOfType <DeadZone>();
     _babySpawner   = FindObjectOfType <BabySpawner>();
     _dialogManager = FindObjectOfType <DialogManager>();
 }
Example #4
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("InputModifier");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (DeadZone != null && __isset.DeadZone)
         {
             field.Name = "DeadZone";
             field.Type = TType.Struct;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             DeadZone.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (__isset.Scale)
         {
             field.Name = "Scale";
             field.Type = TType.Double;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteDouble(Scale);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Example #5
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("InputModifier(");
            bool          __first = true;

            if (DeadZone != null && __isset.DeadZone)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("DeadZone: ");
                __sb.Append(DeadZone == null ? "<null>" : DeadZone.ToString());
            }
            if (__isset.Scale)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Scale: ");
                __sb.Append(Scale);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
    private void Start()
    {
        _camera                  = GetComponent <Camera>();
        myposition               = transform;
        _camera.orthographic     = true;
        _camera.orthographicSize = cameraSize;

        // Checking for modules

        if (GetComponent <DeadZone>() != null)

        {
            deadZoneAvailable = true;
            deadZone          = GetComponent <DeadZone>();
        }

        if (GetComponent <CameraLimiters>() != null)

        {
            boundToLimitsAvailable = true;
            limiter = GetComponent <CameraLimiters>();
        }

        if (GetComponent <Zooming>() != null)

        {
            zoomer = GetComponent <Zooming>();
        }
    }
Example #7
0
    private void OnTriggerEnter(Collider other)
    {
        DeadZone manager = GameObject.FindGameObjectWithTag("Deadzone").GetComponent <DeadZone>();

        if (other.CompareTag("Player"))
        {
            manager.currenctCheckPoint = transform.position;
        }
    }
Example #8
0
 public static float ApplyTriggerDeadZone(byte value, DeadZone deadZoneMode)
 {
     if (deadZoneMode == DeadZone.None)
     {
         return(ApplyDeadZone(value, byte.MaxValue, 0.0f));
     }
     else
     {
         return(ApplyDeadZone(value, byte.MaxValue, TriggerDeadZone));
     }
 }
Example #9
0
    private IEnumerator setFlashback(GameObject player)
    {
        ui.UIeffect.SetActive(true);
        ui.effectrespawn();
        DeadZone dd = GameObject.FindGameObjectWithTag("Deadzone").GetComponent <DeadZone>();

        setEffect(ohteer);
        yield return(new WaitForSeconds(Countdown));

        destroyEffect();
        ui.UIeffect.SetActive(false);
        player.transform.position = dd.currenctCheckPoint;
        detect.Child();
    }
Example #10
0
        internal State(bool isConnected, RawState rawState, DeadZone deadZone)
        {
            this.isConnected = isConnected;

            if (!isConnected)
            {
                rawState.dwPacketNumber        = 0;
                rawState.Gamepad.wButtons      = 0;
                rawState.Gamepad.bLeftTrigger  = 0;
                rawState.Gamepad.bRightTrigger = 0;
                rawState.Gamepad.sThumbLX      = 0;
                rawState.Gamepad.sThumbLY      = 0;
                rawState.Gamepad.sThumbRX      = 0;
                rawState.Gamepad.sThumbRY      = 0;
            }

            packetNumber = rawState.dwPacketNumber;
            buttons      = new Buttons(
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.Start) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.Back) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.LeftThumb) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.RightThumb) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.LeftShoulder) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.RightShoulder) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.Guide) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.A) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.B) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.X) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.Y) != 0 ? ButtonState.Pressed : ButtonState.Released
                );
            dPad = new DPad(
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.DPadUp) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.DPadDown) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.DPadLeft) != 0 ? ButtonState.Pressed : ButtonState.Released,
                (rawState.Gamepad.wButtons & (uint)ButtonsConstants.DPadRight) != 0 ? ButtonState.Pressed : ButtonState.Released
                );

            thumbSticks = new ThumbSticks(
                Utils.ApplyLeftStickDeadZone(rawState.Gamepad.sThumbLX, rawState.Gamepad.sThumbLY, deadZone),
                Utils.ApplyRightStickDeadZone(rawState.Gamepad.sThumbRX, rawState.Gamepad.sThumbRY, deadZone)
                );
            triggers = new Triggers(
                Utils.ApplyTriggerDeadZone(rawState.Gamepad.bLeftTrigger, deadZone),
                Utils.ApplyTriggerDeadZone(rawState.Gamepad.bRightTrigger, deadZone)
                );
        }
Example #11
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("InputModifier");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (DeadZone != null && __isset.DeadZone)
                {
                    field.Name = "DeadZone";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await DeadZone.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (__isset.Scale)
                {
                    field.Name = "Scale";
                    field.Type = TType.Double;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteDoubleAsync(Scale, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Example #12
0
 private void Awake()
 {
     deadZone = GameObject.Find("DeadZone").GetComponent <DeadZone>();
     text     = GameObject.Find("Text").GetComponent <Text>();
 }
Example #13
0
 private void Awake()
 {
     instance = this;
 }
 public MonoGamePS4GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base()
 {
     base._init_(gamePad, leftStickDeadZone, rightStickDeadZone);
     _prevPovState = gamePad.getPov(0);
 }
Example #15
0
 public static ThumbSticks.StickValue ApplyRightStickDeadZone(short valueX, short valueY, DeadZone deadZoneMode)
 {
     return(ApplyStickDeadZone(valueX, valueY, deadZoneMode, RightStickDeadZone));
 }
Example #16
0
 private static ThumbSticks.StickValue ApplyStickDeadZone(short valueX, short valueY, DeadZone deadZoneMode, int deadZoneSize)
 {
     if (deadZoneMode == DeadZone.Circular)
     {
         // Cast to long to avoid int overflow if valueX and valueY are both 32768, which would result in a negative number and Sqrt returns NaN
         float distanceFromCenter = (float)Math.Sqrt((long)valueX * (long)valueX + (long)valueY * (long)valueY);
         float coefficient        = ApplyDeadZone(distanceFromCenter, short.MaxValue, deadZoneSize);
         coefficient = coefficient > 0.0f ? coefficient / distanceFromCenter : 0.0f;
         return(new ThumbSticks.StickValue(
                    Clamp(valueX * coefficient),
                    Clamp(valueY * coefficient)
                    ));
     }
     else if (deadZoneMode == DeadZone.IndependentAxes)
     {
         return(new ThumbSticks.StickValue(
                    ApplyDeadZone(valueX, short.MaxValue, deadZoneSize),
                    ApplyDeadZone(valueY, short.MaxValue, deadZoneSize)
                    ));
     }
     else
     {
         return(new ThumbSticks.StickValue(
                    ApplyDeadZone(valueX, short.MaxValue, 0.0f),
                    ApplyDeadZone(valueY, short.MaxValue, 0.0f)
                    ));
     }
 }
        public void Update(InputManager manager)
        {
            try
            {
                if (!IsConnected)
                {
                    return;
                }

                if (!controller.IsOK)
                {
                    if (!HasError)
                    {
                        Log.Error("RemoteInputDevice data is not ok");
                    }
                    HasError = true;
                    return;
                }

                int[] data = controller.Data;

                if (dataSets.Count >= maxDataCount)
                {
                    dataSets.RemoveAt(0);
                }
                dataSets.Add(data);

                const int aux1 = 4;
                const int aux2 = 5;

                if (CheckButtonPressed(aux1, ButtonState.High, true))
                {
                    manager.ArmDrone();
                }
                else if (CheckButtonPressed(aux1, ButtonState.Low, true))
                {
                    manager.DisarmDrone();
                }

                if (CheckButtonPressed(aux2, ButtonState.Low, true))
                {
                    manager.SendClear();
                }
                else if (CheckButtonPressed(aux2, ButtonState.High, true))
                {
                    manager.StopDrone();
                }

                float deadZone = 0.075f;
                if (!manager.DeadZone)
                {
                    deadZone = 0;
                }

                TargetData target = new TargetData();
                target.Thrust = MapValueThrust(data, 0);
                target.Roll   = DeadZone.Compute(MapValue(data, 1), deadZone);
                target.Pitch  = -DeadZone.Compute(MapValue(data, 2), deadZone);
                target.Yaw    = DeadZone.Compute(MapValue(data, 3), deadZone);

                manager.SendTargetData(target);
                HasError = false;
            }
            catch (Exception e)
            {
                HasError = true;
                Log.Error(e);
            }
        }
Example #18
0
 public MonoGameXbox360GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base(gamePad, leftStickDeadZone, rightStickDeadZone)
 {
     _prevPovState = gamePad.getPov(0);
 }
Example #19
0
 //Al colisionar un quimico de hielo con una zona de agua
 //    desactiva la DeadZone, la vuelve solida y cambia su animacion
 private void Start()
 {
     dz   = gameObject.GetComponent <DeadZone>();
     bc2D = gameObject.GetComponent <BoxCollider2D>();
     anim = GetComponent <Animator>();
 }
Example #20
0
 public MonoGamePS4GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base()
 {
     base._init_(gamePad, leftStickDeadZone, rightStickDeadZone);
 }
    public void instantiateCard(HeroData cardInfos, string cardTag, Transform parent, DeadZone deadZone)
    {
        GameObject card = Instantiate(cardPrefab) as GameObject;

        card.GetComponent <HeroCard>().data = cardInfos;
        card.GetComponent <HeroCard>().setDeadZone(deadZone);
        card.transform.SetParent(parent);
        card.transform.localScale = Vector3.one;
        card.tag = cardTag;
        if (moveToHand != null)
        {
            moveToHand(card);
        }
    }
 private void Start()
 {
     deadZone = new DeadZone(target.box.bounds, deadZoneSize);
 }
Example #23
0
 public void setDeadZone(DeadZone zone)
 {
     deadZone = zone;
 }