protected void Awake() { //TODO 1: nos registras en el input al boton return con OnReturnPressed. InputMgr inputMgr = GameMgr.GetInstance().GetServer <InputMgr>(); inputMgr.RegisterReturn(OnReturnPressed); }
private Vector3 GoalkeeperAction(String goalkeeperHorizontal, String goalkeeperVertical) { Vector3 saveVector = Vector3.zero; if (Input.GetAxis(goalkeeperHorizontal) > 0.0f && InputMgr.GetProperVerticalValue(goalkeeperVertical) >= 0.0f) { saveVector = new Vector3(1.5f, 1.3f, 0); wallCollider.enabled = true; } if (Input.GetAxis(goalkeeperHorizontal) > 0.0f && InputMgr.GetProperVerticalValue(goalkeeperVertical) < 0.0f) { saveVector = new Vector3(2, 0.3f, 0); wallCollider.enabled = true; } if (Input.GetAxis(goalkeeperHorizontal) < 0.0f && InputMgr.GetProperVerticalValue(goalkeeperVertical) >= 0.0f) { saveVector = new Vector3(-1.5f, 1.3f, 0); wallCollider.enabled = true; } if (Input.GetAxis(goalkeeperHorizontal) < 0.0f && InputMgr.GetProperVerticalValue(goalkeeperVertical) < 0.0f) { saveVector = new Vector3(-2, 0.3f, 0); wallCollider.enabled = true; } if (Input.GetAxis(goalkeeperHorizontal) == 0.0f && InputMgr.GetProperVerticalValue(goalkeeperVertical) > 0.0f) { saveVector = Vector3.up; } return(saveVector); }
void Update() { if (InputMgr.GetDPadRightDown()) { playerAnimator.SetTrigger("switchWeapon"); } }
// Start is called before the first frame update void Start() { InputMgr.GetInstance().StartOrEndCheck(true); EventCenter.GetInstance().AddEventListener <KeyCode>("按下某键", CheckInputDown); EventCenter.GetInstance().AddEventListener <KeyCode>("抬起某键", CheckInputUp); }
// Update is called once per frame void Update() { // get pick up item input if (InputMgr.GetButton((int)m_input.m_nbPlayer, InputMgr.eButton.GRAB) && !IsGrabing) { if (WeaponList.Count > 0) { PickupWeapon(); } } IsGrabing = InputMgr.GetButton((int)m_input.m_nbPlayer, InputMgr.eButton.GRAB); switch (m_attack.EquipWeap) { case PlayerAttack.eWeapon.Pistol: m_weapon.PickPistol(); break; case PlayerAttack.eWeapon.Saber: m_weapon.PickSaber(); break; default: m_weapon.Drop(); break; } }
IEnumerator Start() { hud.loading.gameObject.SetActive(true); player.Initialize(); CanvasMgr.AttachPanel(hud.panelVR.root); CanvasMgr.AttachPanel(hud.loading.gameObject); GameObject.Destroy(hud.root); hud.panelVR.cardboard.onClick.AddListener(() => { VRMgr.SupportCardboard(); InputMgr.Toggle(false); hud.panelVR.root.SetActive(false); }); hud.panelVR.mi.onClick.AddListener(() => { VRMgr.SupportMI(); InputMgr.Toggle(false); hud.panelVR.root.SetActive(false); }); yield return(1); ResourceMgr.ReadPersistentData("latest.vx", (_data) => { player.RunBean(_data); hud.loading.gameObject.SetActive(false); }, (_err) => { Log.Error("ReviewPlayer", _err); }); }
private Vector3 FootballerAction(String footballerHorizontal, String footballerVertical, float missedShot) { Vector3 shotVector = Vector3.forward; if (Input.GetAxis(footballerHorizontal) > 0.0f && InputMgr.GetProperVerticalValue(footballerVertical) >= 0.0f) { shotVector = new Vector3(xShotFactor + missedShot, yShotFactor + missedShot, 1.0f); } if (Input.GetAxis(footballerHorizontal) > 0.0f && InputMgr.GetProperVerticalValue(footballerVertical) < 0.0f) { shotVector = new Vector3(xShotFactor + missedShot, 0, 1.0f); } if (Input.GetAxis(footballerHorizontal) < 0.0f && InputMgr.GetProperVerticalValue(footballerVertical) >= 0.0f) { shotVector = new Vector3(-xShotFactor - missedShot, yShotFactor + missedShot, 1.0f); } if (Input.GetAxis(footballerHorizontal) < 0.0f && InputMgr.GetProperVerticalValue(footballerVertical) < 0.0f) { shotVector = new Vector3(-xShotFactor - missedShot, 0, 1.0f); } if (Input.GetAxis(footballerHorizontal) == 0.0f && InputMgr.GetProperVerticalValue(footballerVertical) > 0.0f) { shotVector = new Vector3(0, yShotFactor + missedShot, 1.0f); } return(shotVector); }
protected void Start() { m_animationComponent = GetComponent <PlayerAnimation>(); Debug.Assert(m_animationComponent != null, "Error: el componente animacion no existe"); m_animationComponent.RegisterOnAnimationEvent = OnAnimationFinish; SendMessage("OnChangeWeapon", m_activeWeapon, SendMessageOptions.DontRequireReceiver); // TODO 1 : Registramos RegisterChangeWeapon en el input controller del inputmgr con el event ChangeWeapon //Cogemos el inputmgr InputMgr inputMgr = GameMgr.GetInstance().GetServer <InputMgr>(); Debug.Assert(inputMgr != null, "Error: el componente InputMgr no existe"); //Cogemos el controlador del pointAndClick PointAndClickInput m_pointInput = inputMgr.GetInput <PointAndClickInput>(); Debug.Assert(m_pointInput != null, "Error: el componente PointAndClickInput no existe"); //Registramos ChangeeWeapon en el m_pointController m_pointInput.RegisterChangeWeapon(this.ChangeWeapon); foreach (TWeapons wp in m_weapons) { wp.gameObject.SetActive(false); } m_weapons[m_activeWeapon].gameObject.SetActive(true); m_animationComponent.ChangeOverrideAnimatorController(m_weapons[m_activeWeapon].AnimationController); }
private void GestionClavier() { if (InputMgr.EstNouvelleTouche(Keys.Z)) { EstEnZoom = !EstEnZoom; } }
private void Start() { GameCtrl.PlayerUnitChangeEvent.AddListener(UpdateMover); if ((mover == null && GameCtrl.PlayerUnit != null)) { mover = GameCtrl.PlayerUnit.GetComponent <Mover>(); rb = mover.GetComponent <Rigidbody>(); } if (mover == null) { return; } mover.V = InputMgr.GetVerticalAxis(); mover.H = InputMgr.GetHorizontalAxis(); mover.CameraForward = CameraGroupController.Instance.transform.forward; if (GameCtrl.IsOnlineGame) { lastSyncA = Gamef.SystemTimeInMillisecond; lastSyncT = Gamef.SystemTimeInMillisecond; Unit unit = GameCtrl.PlayerUnit; long instant = Gamef.SystemTimeInMillisecond; DataSync.SyncMobileControlAxes(unit, instant, Mathf.RoundToInt(mover.H), Mathf.RoundToInt(mover.V), CameraGroupController.Instance.transform.forward); DataSync.SyncTransform(unit, instant, unit.transform.position, unit.transform.rotation, rb.velocity.magnitude); } }
public void ButtonMapUpdate(bool isPad) { Dictionary <string, Func <bool> > pressedFunc = new Dictionary <string, Func <bool> >(); if (isPad) { pressedFunc.Add("z", () => { return(Input.GetButton("Fire1")); }); pressedFunc.Add("x", () => { return(Input.GetButton("Fire2")); }); pressedFunc.Add("c", () => { return(Input.GetButton("Fire3")); }); pressedFunc.Add("U", () => { return(Input.GetAxis("Vertical") > 0.0f); }); pressedFunc.Add("D", () => { return(Input.GetAxis("Vertical") < 0.0f); }); pressedFunc.Add("F", () => { return(Input.GetAxis("Horizontal") > 0.0f); }); pressedFunc.Add("B", () => { return(Input.GetAxis("Horizontal") < 0.0f); }); padtextlog.text = "Pad connected"; padconnected = true; } else { pressedFunc.Add("z", () => { return(Input.GetKey(KeyCode.Z)); }); pressedFunc.Add("x", () => { return(Input.GetKey(KeyCode.X)); }); pressedFunc.Add("c", () => { return(Input.GetKey(KeyCode.C)); }); pressedFunc.Add("U", () => { return(Input.GetKey(KeyCode.UpArrow)); }); pressedFunc.Add("D", () => { return(Input.GetKey(KeyCode.DownArrow)); }); pressedFunc.Add("F", () => { return(Input.GetKey(KeyCode.RightArrow)); }); pressedFunc.Add("B", () => { return(Input.GetKey(KeyCode.LeftArrow)); }); padtextlog.text = "Pad disconnected"; padconnected = false; imgr = new InputMgr(pressedFunc); } imgr = new InputMgr(pressedFunc); }
/// <summary> /// Initializes a new instance of the <see cref="GameMgr"/> class. /// </summary> private GameMgr() { ProcessBaseConfiguration(); m_storageMgr = new StorageMgrImp(m_storageFileName); //Inicializamos el servidorPrincipal y le registramos todos los servidores... if (m_servers == null) { m_servers = GameObject.Find("Servers"); if (m_servers == null) { m_servers = new GameObject("Servers"); } //Registramos todos los servidores... //InputServer: servidor de entrada. //SceneMgr: Gestiona la carga de escenas... //TODO (SceneMgr) AddServer<SceneMgr>(); AddServer <SceneMgr>(); //TODO (InputMgr) //TODO (SceneMgr) AddServer<InputMgr>(); InputMgr inputMgr = AddServer <InputMgr>(); inputMgr.Configure(0, true); //TODO : (SpawnerMgr) SceneMgr smAux = m_servers.GetComponent <SceneMgr>(); m_spawnerMgr = new SpawnerMgr(smAux); } }
// ================================== UNITY FUNCS ================================== #region Unity funcs private void Awake() { s_Instance = this; m_eventProcessSwipeUp += ProcessSwipeUp; m_eventProcessSwipeDown += ProcessSwipeDown; m_eventProcessSwipeRight += ProcessSwipeRight; m_eventProcessSwipeLeft += ProcessSwipeLeft; }
public static void Init(ISetInput setInput) { if (_instance == null) { _instance = MonoSingletonCreator.CreateMonoSingleton <InputMgr>(); } SetInput(setInput); }
void Awake() { instance = this; gameManager = GameManager.Instance; DOTween.Init(); Screen.sleepTimeout = SleepTimeout.NeverSleep; #if UNITY_STANDALONE_WIN Screen.SetResolution(1280, 720, false); #endif Application.targetFrameRate = AppConst.GameFrameRate; DontDestroyOnLoad(gameObject); //加入输入输出管理器 inputMgr = gameObject.AddComponent <InputMgr>(); #if SHOW_FPS fpsHelperObj = new GameObject("FpsHelperObj"); fpsHelper = fpsHelperObj.AddComponent <FPSHelper>(); GameObject.DontDestroyOnLoad(fpsHelperObj); #endif if (AppConst.isLocalGameServer) { var ServerObj = new GameObject("SimulateServer"); ServerObj.AddComponent <ColaFramework.NetWork.SimulateServer>(); GameObject.DontDestroyOnLoad(ServerObj); } #if BUILD_DEBUG_LOG || UNITY_EDITOR #if UNITY_2017_1_OR_NEWER Debug.unityLogger.logEnabled = true; #else Debug.unityLogger.logEnabled = true; #endif #else #if UNITY_2017_1_OR_NEWER Debug.unityLogger.logEnabled = false; #else Debug.logger.logEnabled = false; #endif #endif #if WETEST_SDK gameObject.AddComponent <WeTest.U3DAutomation.U3DAutomationBehaviour>(); #endif #if OUTPUT_LOG GameObject logHelperObj = new GameObject("LogHelperObj"); logHelper = logHelperObj.AddComponent <LogHelper>(); GameObject.DontDestroyOnLoad(logHelperObj); Application.logMessageReceived += logHelper.LogCallback; #endif //初始化多线程工具 ColaLoom.Initialize(); StreamingAssetHelper.SetAssetPathDir(assetPath); }
// ====================================================================================== // PROTECTED MEMBERS // ====================================================================================== override protected void UpdatePhase() { // reset triggers when button released m_dashTrigger = !InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.DASH) || m_dashTrigger; m_jumpTrigger = !InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.JUMP) || m_jumpTrigger; m_grabTrigger = !InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.GRAB) || m_grabTrigger; m_tossTrigger = !InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.TOSS) || m_tossTrigger; m_attackTrigger = !InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.ATTACK) || m_attackTrigger; }
// Start is called before the first frame update void Start() { //开启输入检测 InputMgr.GetInstance().StartOrEndCheck(true); //添加事件监听 EventCenter.GetInstance().AddEventListener("某键按下", CheckInputDown); EventCenter.GetInstance().AddEventListener("某键抬起", CheckInputUp); }
void OnDestroy() { InputMgr inputMgr = GameMgr.GetInstance().GetServer <InputMgr>(); if (inputMgr != null) { inputMgr.ClearInput(); } }
// ====================================================================================== public bool GetUp(int player) { if (m_upTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.UP)) { m_upTriggerList[player] = false; return(true); } return(false); }
public bool GetChangeColor(int player) { if (m_changeColorTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.CHANGE_COLOR)) { m_changeColorTriggerList[player] = false; return(true); } return(false); }
public bool GetPause(int player) { if (m_pauseTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.PAUSE)) { m_pauseTriggerList[player] = false; return(true); } return(false); }
public bool GetPrevious(int player) { if (m_previousTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.PREVIOUS)) { m_previousTriggerList[player] = false; return(true); } return(false); }
public bool GetSubmit(int player) { if (m_submitTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.SUBMIT)) { m_submitTriggerList[player] = false; return(true); } return(false); }
// ====================================================================================== public bool GetRight(int player) { if (m_rightTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.RIGHT)) { m_rightTriggerList[player] = false; return(true); } return(false); }
// ====================================================================================== public bool GetLeft(int player) { if (m_leftTriggerList[player] && InputMgr.GetMenuButton(player + 1, InputMgr.eMenuButton.LEFT)) { m_leftTriggerList[player] = false; return(true); } return(false); }
// ====================================================================================== override public bool GetGrab() { if (m_grabTrigger && InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.GRAB)) { m_grabTrigger = false; return(true); } return(false); }
// ====================================================================================== override public bool GetAttack() { if (m_attackTrigger && InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.ATTACK)) { m_attackTrigger = false; return(true); } return(false); }
// ====================================================================================== override public bool GetToss() { if (m_tossTrigger && InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.TOSS)) { m_tossTrigger = false; return(true); } return(false); }
// ====================================================================================== override public bool GetJump() { if (m_jumpTrigger && InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.JUMP)) { m_jumpTrigger = false; return(true); } return(false); }
// ====================================================================================== override public bool GetDash() { if (m_dashTrigger && InputMgr.GetButton((int)m_nbPlayer, InputMgr.eButton.DASH)) { m_dashTrigger = false; return(true); } return(false); }
/// <summary> /// Used to initialize the InputMgr singleton instance /// </summary> ///<returns>True if everything went ok</returns> public static bool Init() { if (m_instance != null) { Debug.LogError("Second initialisation not allowed"); return false; } else { m_instance = new InputMgr(); return m_instance.open(); } }
// Use this for initialization void Awake() { InputMgr = GetComponent<InputMgr>(); }
/// <summary> /// Used to deinitialize the InputMgr singleton data. /// </summary> public static void Release() { if (m_instance != null) { m_instance.close(); m_instance = null; } }