//Gets called when game is started after the awake. private void Start() { //Get the miniGameController. LS_miniGameController = FindObjectOfType <LS_MinigameController>(); //Set the animator LS_animController = GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); //Set player input InputManager.Instance.BindAxis("LS_HorizontalAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.LeftStickX); InputManager.Instance.BindAxis("LS_VerticalAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.LeftStickY); InputManager.Instance.BindAxis("LS_HorizontalMirAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.RightStickX); InputManager.Instance.BindAxis("LS_VerticalMirAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.RightStickY); //Get the default material and set it to the playerColor of the game. LS_defaultMat = GetComponentInChildren <SkinnedMeshRenderer>().material; LS_defaultMat.color = GlobalGameManager.Instance.GetPlayerColor(LS_controllerIndex); //Set a default state. LS_playerState = LS_PlayerState.idle; }
//Move the player according to the left thumbstick. private void MovePlayer(float LS_horMove, float LS_verMove) { if ((LS_horMove == 0) && (LS_verMove == 0)) { LS_playerState = LS_PlayerState.idle; } else { LS_playerState = LS_PlayerState.move; transform.position = new Vector3(transform.position.x + (LS_horMove * LS_moveSpeed * Time.deltaTime), transform.position.y, transform.position.z + (LS_verMove * LS_moveSpeed * Time.deltaTime)); } }
//Gets called when game is started after the awake. private void Start() { //Get the miniGameController. LS_miniGameController = FindObjectOfType<LS_MinigameController>(); //Set the animator LS_animController = GetComponent<Animator>(); rb = GetComponent<Rigidbody>(); //Set player input InputManager.Instance.BindAxis("LS_HorizontalAxis"+ LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.LeftStickX); InputManager.Instance.BindAxis("LS_VerticalAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.LeftStickY); InputManager.Instance.BindAxis("LS_HorizontalMirAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.RightStickX); InputManager.Instance.BindAxis("LS_VerticalMirAxis" + LS_controllerIndex, LS_controllerIndex, ControllerAxisCode.RightStickY); //Get the default material and set it to the playerColor of the game. LS_defaultMat = GetComponentInChildren<SkinnedMeshRenderer>().material; LS_defaultMat.color = GlobalGameManager.Instance.GetPlayerColor(LS_controllerIndex); //Set a default state. LS_playerState = LS_PlayerState.idle; }