Esempio n. 1
0
 void Awake()
 {
     Instance = this;
     _actions = ControllerActions.CreateWithDefaultBindings();
     InputManager.OnActiveDeviceChanged += OnDeviceChanged;
     InputManager.OnDeviceDetached      += OnDeviceChanged;
 }
Esempio n. 2
0
    public static string GetKeyBoardType(EControllerBtns e)
    {
        var actions = ControllerPc.GetActions();
        var btn     = actions.Get(e);

        for (int i = 0; i < btn.Bindings.Count; i++)
        {
            var a = btn.Bindings[i];
            if (a.BindingSourceType == BindingSourceType.KeyBindingSource)
            {
                var text = ((KeyBindingSource)a).Control.ToString();
                text = text.ToUpper();
                if (text.Contains("NUM "))
                {
                    text = text.Replace("NUM ", "");
                }
                if (text.Contains("APE"))
                {
                    text = text.Replace("APE", "");
                }
                return(text);
            }
        }
        return("");
    }
Esempio n. 3
0
    public static Mouse GetMouseType(EControllerBtns e)
    {
        var actions = ControllerPc.GetActions();
        var btn     = actions.Get(e);

        for (int i = 0; i < btn.Bindings.Count; i++)
        {
            var a = btn.Bindings[i];
            if (a.BindingSourceType == BindingSourceType.MouseBindingSource)
            {
                return(((MouseBindingSource)a).Control);
            }
        }
        return(Mouse.None);
    }
Esempio n. 4
0
    public static InputControlType GetControlType(EControllerBtns e)
    {
        var actions = ControllerPc.GetActions();
        var btn     = actions.Get(e);

        for (int i = 0; i < btn.Bindings.Count; i++)
        {
            var a = btn.Bindings[i];
            if (a.BindingSourceType == BindingSourceType.DeviceBindingSource)
            {
                return(((DeviceBindingSource)a).Control);
            }
        }
        Debug.LogError("GetControlType Is None:" + e);
        return(InputControlType.None);
    }
Esempio n. 5
0
    public void Init(SpriteRenderer renderer, SlowPoint point, PlayerDeploy deploy)
    {
        transform.SetLayer(Layers.Player);

        Deploy         = deploy;
        SpriteRenderer = renderer;
        // Material = renderer.material;

        RedPoint  = point;
        Actions   = ControllerPc.GetActions();
        _aniStyle = PlayerMoveStyle.Idle;

        transform.localScale = Vector3.one * deploy.scale;
        InitRigid();

        SupportMgr = new PlayerSupportMgr();
        SupportMgr.Init(this);

        Instance = this;
    }