Ejemplo n.º 1
0
    protected virtual void Awake()
    {
        TrackedObject obj = GetComponent <TrackedObject>();

        if (obj != null)
        {
            controller = obj.source;
        }
        if (controller == ControllerType.None)
        {
            m_Input = ControllerInputManager.GetInput(name);
        }
        else
        {
            m_Input = ControllerInputManager.GetInput(controller);
        }
        //
        if (m_Input != null)
        {
            for (int i = 0, imax = axes.Length; i < imax; ++i)
            {
                axes[i].Awake(m_Input);
            }
            for (int i = 0, imax = buttons.Length; i < imax; ++i)
            {
                buttons[i].Awake(m_Input);
            }
        }
    }
Ejemplo n.º 2
0
    void Turn()
    {
        if (InputManager.inputType == InputType.Controller)
        {
            Vector3 NextDir = new Vector3(ControllerInputManager.GetRightStickHorizontal(), 0, ControllerInputManager.GetRightStickVertical());
            if (NextDir != Vector3.zero)
            {
                Quaternion newRotation = Quaternion.LookRotation(NextDir);
                transform.rotation = Quaternion.RotateTowards(transform.rotation, newRotation, 1400f * Time.deltaTime);
            }
        }

        if (InputManager.inputType == InputType.KeyboardMouse)
        {
            // Treffer vom Raycast
            RaycastHit hit;
            //Ray von der Mausposition
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 100, floorMask))
            {
                // Erstellung des Vektor, der von der Spieler Position bis zu dem Punkt zeigt, den die Maus auf der Maske getroffen hat
                Vector3 playerToMouse = hit.point - transform.position;

                // Sicherstellen, dass der Vektor parallel zum Boden ist.
                playerToMouse.y = 0f;

                // Rotation erstellen
                Quaternion newRotation = Quaternion.LookRotation(playerToMouse);

                // neue Roataion übergeben
                transform.rotation = Quaternion.RotateTowards(transform.rotation, newRotation, 1200f * Time.deltaTime);
            }
        }
    }
Ejemplo n.º 3
0
        protected override void ComputeVelocity()
        {
#if USING_INPUT_OLD
            Vector2 move = Vector2.zero;
            move.x = ControllerInputManager.GetRawHorizontal();
#endif
            float moveX = move.x;

            OnCharacterState();

            if (moveX > 0 && InputRight(inputDirection))
            {
                this.facingState = Right();
            }
            else if (moveX < 0 && InputLeft(inputDirection))
            {
                this.facingState = Left();
            }

            OnFacingState();

            animator.SetBool(GROUNDED, IsGrounded(state));
            animator.SetFloat(VELOCITY_X, Mathf.Abs(velocity.x) / maxSpeed);

            targetVelocity = move * maxSpeed;
        }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        ControllerInputManager = new ControllerInputManager();

        CurrentInputType = InputType.Keyboard;

        for (int i = 0; i < (int)InputAction._NumberOfInputActions; i++)
        {
            string inputActionName = ((InputAction)i).ToString();

            KeyCode         keyboardKeyCode = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString(inputActionName + InputType.Keyboard.ToString(), Services.Constants.DefaultKeyMouseBinds[i].ToString()));
            ControllerInput controllerInput = (ControllerInput)System.Enum.Parse(typeof(ControllerInput), PlayerPrefs.GetString(inputActionName + InputType.Controller.ToString(), Services.Constants.DefaultControllerBinds[i].ToString()));

            m_InputBinds[(InputAction)i] = new InputActionBind(new KeyboardBind(keyboardKeyCode), new ControllerBind(controllerInput));
        }

        int c = 0;

        foreach (ControllerInput input in System.Enum.GetValues(typeof(ControllerInput)))
        {
            m_ControllerIcons[input] = ControllerIconTextures[c];

            c++;
        }

        CreateAxisBind(InputAxis.MoveFrontward, m_InputBinds[InputAction.MoveForward], m_InputBinds[InputAction.MoveBackward]);
        CreateAxisBind(InputAxis.MoveHorizontal, m_InputBinds[InputAction.MoveRight], m_InputBinds[InputAction.MoveLeft]);
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (m_BindAssignStarted)
        {
            if (m_NextTypeToAssign == InputType.Controller)
            {
                ControllerInput input = ControllerInputManager.GetAnyButtonPress();

                if (input != ControllerInput.None)
                {
                    if (IsControllerInputInUse(input))
                    {
                        // Bind failed
                        BindFailedEvent.Invoke(m_NextActionToAssign, InputType.Controller);
                        m_BindAssignStarted = false;
                    }
                    else
                    {
                        // Bind succeeded
                        m_InputBinds[m_NextActionToAssign].ControllerBind.ControllerInput = input;
                        ControllerBindEvent.Invoke(m_NextActionToAssign, input);
                        m_BindAssignStarted = false;
                    }
                }
            }
        }
    }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void Update()
        {
            if (canRecenter)
            {
                // PC : Push the keyboard for debug.
                if (Input.GetKeyDown(KeyCode.R))
                {
                    Recenter(true);
                }
                // Mobile VR : Hold the Home button for a while.
                if (ControllerInputManager.GetButtonUp(ControllerType.Controller, (uint)XimmerseButton.Home))
                {
                    m_LastHomeButtonPressedTime = -1.0f;
                }
                else if (m_LastHomeButtonPressedTime > 0.0f && (Time.time - m_LastHomeButtonPressedTime) >= 1.0f)
                {
                    m_LastHomeButtonPressedTime = -1.0f;
                    Recenter(true);
                }
                else if (ControllerInputManager.GetButtonDown(ControllerType.Controller, (uint)XimmerseButton.Home))
                {
                    m_LastHomeButtonPressedTime = Time.time;
                }
            }

            //setHMDRotation();
        }
Ejemplo n.º 7
0
 internal XDeviceControllerProvider()
 {
     m_ControllerInputs = new ControllerInput[2] {
         ControllerInputManager.GetInput(ControllerType.LeftController),
         ControllerInputManager.GetInput(ControllerType.RightController),
     };
 }
    // Use this for initialization
    private void Awake()
    {
        //If there's already a static instance of a Controller Input Manager, we destroy this component
        if (globalReference != null)
        {
            Destroy(this);
            return;
        }

        //If there isn't already a static instance of a Controller Input Manager, this becomes the static instance
        globalReference = GetComponent <ControllerInputManager>();

        //Creates new Controller Inputs for each player controller
        P1Controller = new ControllerInput();
        P1Controller.SetPlayerID(Players.P1);

        P2Controller = new ControllerInput();
        P2Controller.SetPlayerID(Players.P2);

        P3Controller = new ControllerInput();
        P3Controller.SetPlayerID(Players.P3);

        P4Controller = new ControllerInput();
        P4Controller.SetPlayerID(Players.P4);
    }
        public void StartControllerManagerService()
        {
            statusBarForm = new StatusBarForm();
            statusBarForm.Show();

            controllerInputManager = new ControllerInputManager();
            controllerInputManager.Init();
        }
    private void Start()
    {
        _transform       = transform;
        _controllerInput = ControllerInputManager.Instance;
        _controllerInput.RegisterButtonDownCallback(OnButtonDown);

        Cursor.visible = false;
    }
        public void StopControllerManagerService()
        {
            controllerInputManager.CleanUp();
            controllerInputManager = null;

            statusBarForm.Close();
            statusBarForm.Dispose();
            statusBarForm = null;
        }
Ejemplo n.º 12
0
        private void Awake()
        {
            this.pcInputActions = new PCInputActions();
            this.spriteRenderer = GetComponent <SpriteRenderer>();
            this.animator       = GetComponent <Animator>();

            ControllerInputManager.InitControllers();
            InitInput();
        }
Ejemplo n.º 13
0
    // Update is called once per frame
    void Update()
    {
        if (!inputField.isFocused)
        {
            inputField.ActivateInputField();
        }
        if (ControllerInputManager.GetLeftStickVertical() != 0)
        {
            if (m_isAxisInUse == false)
            {
                if (ControllerInputManager.GetLeftStickVertical() > 0)
                {
                    currentIndex  = add(currentIndex, alphabet.Length);
                    switcher.text = "" + alphabet [currentIndex] + "";
                    next.text     = "" + alphabet [add(currentIndex, alphabet.Length)] + "";
                    prev.text     = "" + alphabet [sub(currentIndex, alphabet.Length)] + "";
                }
                if (ControllerInputManager.GetLeftStickVertical() < 0)
                {
                    currentIndex  = sub(currentIndex, alphabet.Length);
                    switcher.text = "" + alphabet [currentIndex] + "";
                    next.text     = "" + alphabet [add(currentIndex, alphabet.Length)] + "";
                    prev.text     = "" + alphabet [sub(currentIndex, alphabet.Length)] + "";
                }
                m_isAxisInUse = true;
            }
        }
        if (ControllerInputManager.GetLeftStickVertical() == 0)
        {
            m_isAxisInUse = false;
        }

        if (ControllerInputManager.GetAButton())
        {
            if (inputField.text.Length < 10)
            {
                inputField.text += "" + alphabet [currentIndex] + "";
            }
        }
        if (ControllerInputManager.GetBButton())
        {
            if (inputField.text.Length > 0)
            {
                inputField.text = inputField.text.Substring(0, inputField.text.Length - 1);
            }
        }
        if (InputManager.GetSubmitName())
        {
            if (inputField.text.Length > 0)
            {
                HighscoreEntry entry = new HighscoreEntry(inputField.text, GameManager.score);
                HSManager.addHighscore(entry);
                userInterface.showHighscores();
            }
        }
    }
Ejemplo n.º 14
0
    /****************************************************************************************
    *																						*
    *																						*
    *									Additional_methods									*
    *																						*
    *																						*
    ****************************************************************************************/

    void findControls()
    {
        ControllerInputManager.VerticalControl(useController);
        ControllerInputManager.HorizontalControl(useController);
        ControllerInputManager.JumpControl(useController);
        ControllerInputManager.GrabControl(useController);
        ControllerInputManager.FireControl(useController);
        ControllerInputManager.PauseControl(useController);
        ControllerInputManager.WeaponsControl(useController);
    }
Ejemplo n.º 15
0
    public static ControllerInputManager GetInstance()
    {
        if (m_instance == null)
        {
            GameObject g = new GameObject("ControllerInputManager");
            m_instance = g.AddComponent <ControllerInputManager>();
        }

        return(m_instance);
    }
Ejemplo n.º 16
0
    /// <summary>
    /// Returns true if anything (keyboard or controller) is pressed.
    /// </summary>
    public bool IsAnythingPressed()
    {
        ControllerInput input = ControllerInputManager.GetAnyButtonPress();

        if (input != ControllerInput.None)
        {
            return(true);
        }

        return(Input.anyKeyDown);
    }
Ejemplo n.º 17
0
    void Start()
    {
        ControllerInputManager.GetInstance().OnStartDown += PressNext;

        pressStart.SetActive(false);

        for (int i = 0; i < waves.Count; i++)
        {
            waves[i].WaveDelay = waveDelayList[i >= waveDelayList.Length?waveDelayList.Length - 1:i];
        }
        NextWave();
    }
 private void InitializeController()
 {
     // Controller Input Manager
     if (controllerInputManager == null)
     {
         controllerInputManager = GetComponent <ControllerInputManager> ();
     }
     // Controller
     if (controller == null && controllerInputManager != null)
     {
         controller = controllerInputManager.device;
     }
 }
Ejemplo n.º 19
0
    void OnTriggerStay(Collider coll)
    {
        if (coll.gameObject.tag == "GazeRadius")
        {
            gazeRadius = coll.gameObject;                       //get the sphere collider around the player

            if (GameMaster.Biofeedback())
            {
                boxAnimator.SetBool("hasGaze", _gazeAware.HasGazeFocus);                    //makes it so the box's eye will open up when has gaze
                if (_gazeAware.HasGazeFocus)
                {
                    if (player == null)
                    {
                        FindPlayer();                                           //only find the player if it's null
                    }

                    gazePoint = TobiiAPI.GetGazePoint();

                    if (Input.GetAxis(ControllerInputManager.Grab()) > 0 && player != null)
                    {
                        float radius = gazeRadius.GetComponent <SphereCollider>().radius;

                        //sets the cube's pos to gaze pos; converts screen space to world space
                        transform.position = Camera.main.ScreenToWorldPoint(gazePoint.Screen);

                        Vector3 centerPt = player.GetComponentInChildren <SphereCollider>().transform.position;

                        float distance = Vector3.Distance(Camera.main.ScreenToWorldPoint(gazePoint.Screen), centerPt);

                        if (distance > radius)                                                                                      //if distance becomes greater than radius
                        {
                            Vector3 newPos = transform.position - centerPt;                                                         //create vector of difference of cube pos and center pos
                            newPos            *= radius / distance;                                                                 //calc position in circle around center pos
                            transform.position = centerPt + newPos;                                                                 //sets cubes pos to the max distance away from center pos
                            box.velocity       = (transform.position - box.transform.position) * 10;                                //uses box's physics to move along with cube's movements
                            transform.position = box.transform.position;                                                            //this prevents the box from moving into the ground
                        }
                        else
                        {
                            box.velocity       = (transform.position - box.transform.position) * 10;
                            transform.position = box.transform.position;                                                                //anchors 3D collider to the box so they always stay together
                            //Debug.Log ("transform: " + transform.position);
                        }
                    }
                }
            }
            else
            {
            }
        }
    }
Ejemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 protected virtual void Update()
 {
     if (canRecenter)
     {
         if (ControllerInputManager.GetButtonDown(ControllerType.Controller, (uint)XimmerseButton.Home))
         {
             m_HomeIsDownLastTime = Time.time;
         }
         if (Input.GetKeyDown(KeyCode.R) || (ControllerInputManager.GetButton(ControllerType.Controller, (uint)XimmerseButton.Home) && Time.time - m_HomeIsDownLastTime > 1.0f))
         {
             Recenter(true);
         }
     }
 }
Ejemplo n.º 21
0
    /************************
    * Menu related methods *
    ************************/

    protected void MenuChecking()
    {
        if (GameMaster.IsPaused())
        {
            if (Input.GetButtonDown(ControllerInputManager.Pause()) /*|| Input.GetButtonDown(ControllerInputManager.Weapons())*/)
            {
                unpause();
            }
        }
        else if (!GameMaster.IsPaused() && !GameMaster.PlayerTransitionState())
        {
            pause();
        }
    }
Ejemplo n.º 22
0
 public static float GetAim()
 {
     if (inputType == InputType.Controller)
     {
         return(ControllerInputManager.GetLeftTrigger());
     }
     else if (inputType == InputType.KeyboardMouse)
     {
         return(Input.GetMouseButton(1) ? 1 : 0);
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 23
0
 public static bool GetStart()
 {
     if (inputType == InputType.Controller)
     {
         return(ControllerInputManager.GetStartButton());
     }
     else if (inputType == InputType.KeyboardMouse)
     {
         return(Input.GetKeyDown(KeyCode.Return));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 24
0
 public static float GetVertical()
 {
     if (inputType == InputType.Controller)
     {
         return(ControllerInputManager.GetLeftStickVertical());
     }
     else if (inputType == InputType.KeyboardMouse)
     {
         return(Input.GetAxis("Vertical"));
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 25
0
 //--------------------------------------------------------------
 /// Called automatically at Object Initialization.
 //--------------------------------------------------------------
 void Start()
 {
     // Store and initialize all of the managers and handlers.
     gameStateManager = this.GetComponent <GameStateManager>();
     objectManager    = this.GetComponent <ObjectManager>();
     audioManager     = this.GetComponent <AudioManager>();
     networkManager   = this.GetComponent <NetworkManager>();
     inputHandler     = this.GetComponent <ControllerInputManager>();
     menuManager      = this.GetComponent <MenuManager>();
     timerManager     = this.GetComponent <TimerManager>();
     guiManager       = this.GetComponent <GUIManager>();
     MyChracter       = GameObject.Find("My Character");
     mainCamera       = GameObject.Find("Main Camera");
     maze             = GameObject.Find("Maze").GetComponent <Maze>();
 }
Ejemplo n.º 26
0
    void Start()
    {
        m_controllerInstance             = ControllerInputManager.GetInstance();
        m_controllerInstance.OnADown    += onADown;
        m_controllerInstance.OnXDown    += onXDown;
        m_controllerInstance.OnYDown    += onYDown;
        m_controllerInstance.OnBDown    += onBDown;
        m_controllerInstance.OnLSChange += Move;

        m_controllerInstance.OnRBDown += BoostOn;
        m_controllerInstance.OnRBUp   += BoostOff;

        rb            = GetComponent <Rigidbody2D>();
        m_curInteract = null;
        heldResource  = null;
    }
Ejemplo n.º 27
0
    private void OnTriggerStay2D(Collider2D coll)
    {
        if (!GameMaster.Biofeedback())
        {
            if (coll.gameObject.tag == "GazeRadius")
            {
                gazeRadius = coll.gameObject.GetComponent <CircleCollider2D>();
            }

            if (coll.gameObject.tag == "gaze_pt")
            {
                if (player == null)
                {
                    FindPlayer();                                       //only find the player if it's null
                }

                if (Input.GetAxis(ControllerInputManager.Grab()) > 0 && player != null)
                {
                    boxAnimator.SetBool("hasGaze", true);
                    float radius = gazeRadius.radius;
                    transform.position = player.pointer.transform.position;
                    Vector3 centerPt = player.GetComponentInChildren <CircleCollider2D>().transform.position;

                    float distance = Vector3.Distance(player.pointer.transform.position, centerPt);

                    if (distance > radius)                                                                                  //if distance becomes greater than radius
                    {
                        Vector3 newPos = transform.position - centerPt;                                                     //create vector of difference of cube pos and center pos
                        newPos            *= radius / distance;                                                             //calc position in circle around center pos
                        transform.position = centerPt + newPos;                                                             //sets cubes pos to the max distance away from center pos
                        box.velocity       = (transform.position - box.transform.position) * 10;
                        transform.position = box.transform.position;
                    }
                    else
                    {
                        box.velocity       = (transform.position - box.transform.position) * 10;
                        transform.position = box.transform.position;
                    }
                }
                else
                {
                    boxAnimator.SetBool("hasGaze", false);
                }
            }
        }
    }
Ejemplo n.º 28
0
    void Start()
    {
        if (m_instance != null && m_instance != this)
        {
            Destroy(this);
        }
        else
        {
            m_instance = this;
        }

        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
        {
            platform = "Windows";
        }
        else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
        {
            platform = "OSX";
        }
    }
Ejemplo n.º 29
0
 /*
  * Pauses the game
  */
 private void pause()
 {
     if (Input.GetButtonDown(ControllerInputManager.Pause()))
     {
         mainPause = true;
         createMenu(pauseMenuBG);
         GameMaster.getCurrentSong().Pause();                //hard pause will stop the music
         GameMaster.PlayPauseSFX();
         GameMaster.PauseCheck(true);
         Time.timeScale = 0; //sets the game's timescale to 0, effectively pausing the game
     }                       /* else if (Input.GetButtonDown(ControllerInputManager.Weapons())) {
                              *     mainPause = false;
                              *     weaponPause = true;
                              *     createMenu(weaponsMenu);
                              *
                              *     GameMaster.PlayPauseSFX();				//music stil plays to keep the flow of the game going
                              *     GameMaster.PauseCheck(true);			//useful for weapon select menus
                              *     Time.timeScale = 0;
                              * }*/
 }
Ejemplo n.º 30
0
        public static void InitializeGameSystems()
        {
            touchInput = new TouchInputManager();
            controlInput = new ControllerInputManager();

            game = new Game();

            Lib.current.addChild(game);

            Lib.current.get_stage().dispatchEvent(new Event(Event.RESIZE));

            game.init();
            game.render.set_zoom(1.15);

            Lib.current.addChild(game.gui);

            Lib.current.get_stage().renderer.validateTransform();
            Lib.current.renderer.validateTransform();

            Lib.current.get_stage().dispatchEvent(new Event(Event.RESIZE));
        }
Ejemplo n.º 31
0
    public bool IsPlayerController(CharacterController.ePlayerId playerId, ControllerInputManager.eControllerId controllerId)
    {
        if (controllerId == ControllerInputManager.Instance.MouseControllerId)
        {
            return playerId == ePlayerId.PLAYER_1;
        }
        else if (controllerId == ControllerInputManager.Instance.Keyboard1ControllerId)
        {
            return playerId == ePlayerId.PLAYER_1;
        }
        else if (controllerId == ControllerInputManager.Instance.Keyboard2ControllerId)
        {
            return GameUtils.m_GameMode == GameUtils.eGameMode.TWO_PLAYER && playerId == ePlayerId.PLAYER_2;
        }
        else if ((playerId == ePlayerId.PLAYER_1 && controllerId == ControllerInputManager.eControllerId.CONTROLLER_01) ||
                (playerId == ePlayerId.PLAYER_2 && controllerId == ControllerInputManager.eControllerId.CONTROLLER_02))
        {
            return true;
        }

        return false;
    }
Ejemplo n.º 32
0
    void Start()
    {
        if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
        {
            ControllerInputManager.UseWindows();
        }
        else if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
        {
            ControllerInputManager.UseMac();
        }
        else if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            if (isSafari())
            {
                ControllerInputManager.UseWebMac();
                Debug.Log("Safari detected");
            }
            else
            {
                ControllerInputManager.UseWindows();
                Debug.Log("No Safari detected");
            }
        }
        if (isOneGamepadConnected())
        {
            InputManager.UseController();
            ui.SetGamepadUI();
            isController = true;
        }
        else
        {
            InputManager.UseKeyboard();
            ui.SetKeyboardUI();
            isController = false;
        }

        InvokeRepeating("CheckPlattform", 0.2f, 3f);
    }
Ejemplo n.º 33
0
    public bool RemoveController(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers.Remove(controllerId);
        }

        return false;
    }
    public List<BaseController.eButtonId> GetButtonUp(ControllerInputManager.eControllerId controllerId)
    {
        List<BaseController.eButtonId> buttons = new List<BaseController.eButtonId>();
        if (m_Controllers.ContainsKey(controllerId))
        {
            foreach (BaseController.eButtonId buttonId in System.Enum.GetValues(typeof(BaseController.eButtonId)))
            {
                // NOTE ppoirier: I had to do the Contains check for some reason.
                if (!buttons.Contains(buttonId) && GetButtonUp(controllerId, buttonId))
                {
                    buttons.Add(buttonId);
                }
            }
        }

        return buttons;
    }
    public float GetR2(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers[controllerId].GetR2();
        }

        return -1.0f;
    }
    public bool GetButtonUp(ControllerInputManager.eControllerId controllerId, string alias)
    {
        if (m_ButtonAliases.ContainsKey(alias))
        {
            return GetButtonUp(controllerId, m_ButtonAliases[alias]);
        }

        return false;
    }
    public bool GetButtonUp(ControllerInputManager.eControllerId controllerId, BaseController.eButtonId buttonId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers[controllerId].GetButtonUp(buttonId);
        }

        return false;
    }
    public BaseController GetController(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers[controllerId];
        }

        return null;
    }
    public Vector2 GetMotion(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers[controllerId].GetMotion();
        }

        return Vector2.zero;
    }
Ejemplo n.º 40
0
    void Awake()
    {
        instance = this;
        print(ot);
        if(ot)
        {
            p1_stocks = 1;
            p2_stocks = 1;
        }
        else
        {
            p1_stocks = MatchSettingsData.stock_total;
            p2_stocks = MatchSettingsData.stock_total;
        }
        countdown = MatchSettingsData.match_time + 1;
        p1Left.text = p1_stocks.ToString();
        p2Left.text = p2_stocks.ToString();

        inptmng = GameObject.Find("InputManager");
        keyinpt = inptmng.GetComponent<KeyInputManager>();
        continpt = inptmng.GetComponent<ControllerInputManager>();
        sfxmng = GameObject.Find("SoundManager").GetComponent<SFXManager>();
        if(MatchSettingsData.mstrinptmng == "Keys")
        {
            continpt.enabled = false;
            keyinpt.enabled = true;
            primaryINPT = keyinpt;
            keys = true;
        }
        else
        {
            continpt.enabled = true;
            keyinpt.enabled = false;
            primaryINPT = continpt;
            keys = false;
        }
        stats = GameObject.Find("StatsManager").GetComponent<StatsManager>();

        P1.setTag("P1");
        P1.transform.position = P1spawnPoint.position;
        p1_origin = Instantiate(P1);//clone P1
        p1_origin.enabled = false;
        p1_origin.transform.position = new Vector3(-425.5f, 245, 0);
        //p1_origin.rend.enabled = false;

        P2.setTag("P2");
        P2.transform.position = P2spawnPoint.position;
        p2_origin = Instantiate(P2);//clone P2
        p2_origin.enabled = false;
        p2_origin.transform.position = new Vector3(-431.5f, 245, 0);

        pauseMenu.SetActive(false);
        primaryINPT.lockcontrols();
    }
    public Vector2 GetRightJoystick(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return m_Controllers[controllerId].GetRightJoystick();
        }

        return Vector2.zero;
    }