public void MoveMent() { if (JoyStick.DragCheck() && !isStick && isTreeCol) { if (JoyStick.GetMoveVecY() == 1 || JoyStick.GetMoveVecY() == -1) { isStick = true; } } if (JoyStick.DragCheck() && isStick && isTreeCol) { if (JoyStick.GetJoyVec().y >= 0.5f || JoyStick.GetJoyVec().y <= 0.5f) { SetPlayerState(PLAYER_STATE.UPDOWN); } else { SetPlayerState(PLAYER_STATE.SIDE); } transform.position += new Vector3(0, JoyStick.GetJoyVec().y *upSpeed, 0) * Time.deltaTime; } else { SetPlayerState(PLAYER_STATE.STOP); } transform.position += new Vector3(JoyStick.GetJoyVec().x *sideSpeed, 0, 0) * Time.deltaTime; }
public override void Update(TimeSpan elapsedTime) { base.Update(elapsedTime); Helpers.GameState = Helpers.State.InMainMenu; if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_UP) == TVButtonState.Pressed || JoyStick.JoyUpKeyDown() || Gamepad[0].DPad.Up.State == TVButtonState.Pressed) { View.ExecuteJavascript("keyUp()"); PlayButtonFocusSound(); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_DOWN) == TVButtonState.Pressed || JoyStick.JoyDownKeyDown() || Gamepad[0].DPad.Down.State == TVButtonState.Pressed) { View.ExecuteJavascript("keyDown()"); PlayButtonFocusSound(); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed || JoyStick.JoyButtonDown(0)) { View.ExecuteJavascript("keyEnter()"); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed) { UIManager.Exit(); } }
void Start() { js = GameObject.FindObjectOfType <JoyStick>(); js.OnJoyStickTouchBegin += OnJoyStickBegin; js.OnJoyStickTouchMove += OnJoyStickMove; js.OnJoyStickTouchEnd += OnJoyStickEnd; }
// 초기화 private void Start() { player = GetComponent <PlayerCharacter>(); stick = GameObject.Find("JoyStickCanvas").GetComponentInChildren <JoyStick>(); keyboardInput = keyboard.nothing; touch = keyboard.nothing; }
public override void Update(TimeSpan elapsedTime) { base.Update(elapsedTime); Helpers.GameState = Helpers.State.InOptionsMenu; if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_LEFT) == TVButtonState.Pressed || JoyStick.JoyLeftKeyDown() || Gamepad[0].DPad.Left.State == TVButtonState.Pressed) { View.ExecuteJavascript("keyLeft()"); PlayButtonFocusSound(); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RIGHT) == TVButtonState.Pressed || JoyStick.JoyRightKeyDown() || Gamepad[0].DPad.Right.State == TVButtonState.Pressed) { View.ExecuteJavascript("keyRight()"); PlayButtonFocusSound(); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed || JoyStick.JoyButtonDown(0)) { View.ExecuteJavascript("keyEnter()"); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed) { View.ExecuteJavascript("keyEscape()"); } }
// Use this for initialization void Start() { network = GameObject.Find("NetworkManager").GetComponent <Network>(); myCharacterName = PlayerPrefs.GetString("myCharacter"); joy = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>(); playerParams = GameObject.FindWithTag("Player").GetComponent <PlayerParams>(); playerFSM2 = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>(); remoteParams = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteParams>(); remoteFSM = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>(); remoteAni = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>(); characterCreate = GetComponent <CharacterCreate>(); //greenRespawnTaiLung = GameObject.Find("GreenRespawnTaiLung").GetComponent<GameObject>(); //redRespawnTiaLung = GameObject.Find("RedRespawnTaiLung").GetComponent<GameObject>(); //greenRespawnCoundDown = GameObject.Find("GreenRespawnCoundDown").GetComponent<Text>(); //redRespawnCoundDown = GameObject.Find("RedRespawnCoundDown").GetComponent<Text>(); myBase = characterCreate.myTeam; countDown = 10f; respawnTimer = 0f; }
public void SetMove(JoyStick joyStick) { if (heroState != HeroState.Dead) { if (attackMonster.Count > 0) { heroState = HeroState.Attack; if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Attack")) { animator.Play("Attack"); } } else { heroState = HeroState.Idle; Invoke("ResetState", 0.5f); } Rect rectRange = joyStick.m_JoyStickBackGround.GetComponent <RectTransform>().rect; Vector3 joyStickLocalpos = joyStick.m_JoyStick.transform.localPosition; Vector3 resultMoving = Vector3.zero; resultMoving += new Vector3(joyStickLocalpos.x / (rectRange.width * 0.5f), joyStickLocalpos.y / (rectRange.height * 0.5f)); resultMoving *= movingSpeed; this.transform.position += resultMoving; SetLeftRight(joyStickLocalpos.x); } }
// 초기화 void Start() { playerCharacter = GameObject.FindWithTag("Player"); player = GameObject.FindWithTag("Player").transform; myParams = GetComponent <PlayerParams>(); myAni = GetComponent <PlayerAni>(); myParams.InitParams(); myParams.deadEvent.AddListener(ChangeToPlayerDead); remotePlayer = GameObject.FindWithTag("RemotePlayer").transform; remoteParams = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteParams>(); remoteAni = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>(); remoteFSM = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>(); monster = GameObject.Find("Spider").transform; skillButton = GameObject.Find("TaiLungSpell1").GetComponent <SkillButton>(); curEnemyParams = GameObject.Find("Monster").GetComponent <MonsterParams>(); basicAttack = GameObject.Find("AttackButton").GetComponent <AttakButton>(); redTowerPos = GameObject.FindWithTag("RedTower").transform; towerParams = GameObject.FindWithTag("RedTower").GetComponent <TowerParams>(); network = GameObject.Find("NetworkManager").GetComponent <Network>(); joy = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>(); }
public void UpdateCurrentJoystick() { if (FrameWorkStaticHelper.GetNumberOfAvailableJoysticks() > 0) { currentJoystick = joysticks[FrameWorkStaticHelper.GetCurrentJoystickIndex()]; } }
public void HideAll() { canvasGroup.alpha = 0; canvasGroup.blocksRaycasts = false; JoyStick.enabled = false; JoyStick.Stop(); }
public void AddJoyStick() { GameObject draggedImage = GetWidget("JoyStick_N"); joyStick = new JoyStick(player, draggedImage.transform); AddOnDrag("JoyStick_N", joyStick.OnDrag); AddEndDrag("JoyStick_N", joyStick.EndDrag); }
public static void JoystickBind(Component joyStick, Action <float, float, float> mov, Action begin, Action end) { JoyStick js = (JoyStick)joyStick; js.move = mov; js.begin = begin; js.end = end; }
public void EnableJoyStick(bool value) { JoyStick.enabled = value && !(DialogueManager.Instance.IsUIOpen || ShopManager.Instance.IsUIOpen || WarehouseManager.Instance.IsUIOpen || QuestManager.Instance.IsUIOpen || BuildingManager.Instance.IsPreviewing); if (!JoyStick.enabled) { JoyStick.Stop(); } }
private GTextField gTextField; //角度文本 // Start is called before the first frame update void Start() { mainUI = GetComponent <UIPanel>().ui; joyStick = new JoyStick(mainUI); gTextField = mainUI.GetChild("n4").asTextField; //为摇杆移动和结束添加事件 joyStick.onMove.Add(JoyStickMove); joyStick.onEnd.Add(JoyStickEnd); }
// Use this for initialization void Start() { GC = FindObjectOfType <GameController> (); npc = FindObjectOfType <NPCController> (); player = FindObjectOfType <PlayerData> (); inventory = FindObjectOfType <Inventory> (); dia = FindObjectOfType <DialogueList> (); moveJoystick = FindObjectOfType <JoyStick> (); }
public void ClearJoyStickMoveListener() { JoyStick stk = transform.GetComponent <JoyStick>(); if (stk != null) { stk.ClearJoyStickMoveListener(); } }
void Start() { m_JoyStick = GameObject.FindObjectOfType<JoyStick>(); m_JoyStick.OnJoyStickTouchBegin += OnJoyStickBegin; m_JoyStick.OnJoyStickTouchMove += OnJoyStickMove; m_JoyStick.OnJoyStickTouchEnd += OnJoyStickEnd; m_Animator = transform.GetComponent<Animator>(); }
static void handleNonBufferedJoy(JoyStick js) { //Just dump the current joy state JoyStickState_NativePtr joy = js.JoyStickState; for (int i = 0; i < joy.AxisCount; ++i) { Console.Write("\nAxis " + i + " X: " + joy.GetAxis(i).abs); } }
void Awake() { playerRigidbody = GetComponent<Rigidbody>(); anim = GetComponent<Animation>(); joyStick = GameObject.FindObjectOfType<JoyStick>(); joyStick.OnJoyStickTouchBegin += OnJoyStickBegin; joyStick.OnJoyStickTouchMove += OnJoyStickMove; joyStick.OnJoyStickTouchEnd += OnJoyStickEnd; }
private void Start() { rect = GetComponent <RectTransform>(); joyStick = GetComponentInParent <JoyStick>(); canvas = GetComponentInParent <Canvas>(); if (canvas == null) { throw new System.Exception("未查询到Canvas!"); } }
public SdlInput(bool fullscreen) { keyBoardInput = new KeyBoardInput(); joyStick = new JoyStick(0); mouseInput = new MouseInput(); if (fullscreen) { mouseInput.Hide(); } }
public void SetJoyStickBeginListener(JoyStickTouchBegin action) { if (action != null) { JoyStick stk = transform.GetComponent <JoyStick>(); if (stk != null) { stk.SetJoyStickBeginListener(action); } } }
public void SetJoyStickEndListener(JoyStickTouchEnd action) { if (action != null) { JoyStick stk = transform.GetComponent <JoyStick>(); if (stk != null) { stk.RemoveJoyStickEndListener(action); } } }
public void AddJoyStickMoveListener(JoyStickTouchMove action) { if (action != null) { JoyStick stk = transform.GetComponent <JoyStick>(); if (stk != null) { stk.AddJoyStickMoveListener(action); } } }
public void LookDirectionCheck() { if (JoyStick.GetJoyVec().x < 0) { playerLookDirection = -1; } else if (JoyStick.GetJoyVec().x > 0) { playerLookDirection = 1; } }
void Awake() { if (instance != null) { Destroy(this.gameObject); } else { instance = this; } }
// Use this for initialization void Start() { //Splats = GameObject.Find("SplatManager").GetComponent<SplatManager>(); myAni = GameObject.FindWithTag("Player").GetComponent <PlayerAni>(); playerFsm = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>(); playerAnimator = GameObject.FindWithTag("Player").GetComponent <Animator>(); joy = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>(); network = GameObject.Find("NetworkManager").GetComponent <Network>(); Timer = 0f; }
public MainWindow() : base(Gtk.WindowType.Toplevel) { joyStick = new JoyStick(); loopTimer = new Timer(20); loopTimer.Elapsed += (sender, e) => MainLoop(sender, e, this); loopTimer.Start(); Build(); //buttonDebug.Text = DS4Display.MainClass.joyStick.getNumDevs().ToString(); //buttonDebug.Text = DS4Display.MainClass.joyStick.getPos(1).dwXpos.ToString(); }
void FixedUpdate() { cam.transform.position = offset; cam.transform.rotation = Quaternion.Euler(rotation); HandleCamMovement(); if (!manager.getPlayerEnum().Equals(PlayerStatEnum.PAUSED)) { transform.position = move.moveDirection_z(transform.position); if (move.getMotion()) { transform.position = move.moveToFinalPosition(transform.position); } if (Input.GetKey("a") || Input.GetKey("d")) { float dirct = Input.GetAxisRaw("Horizontal"); move.firstMotion(transform.position, (dirct * floorTransform.localScale.x)); } else if (Input.GetKey(KeyCode.Space) && transform.position.y <= 1) { rb.velocity = (new Vector3(0, 6, 0)); } else if (Input.touchCount > 0) { Touch touch = Input.touches[0]; if (touch.phase.Equals(TouchPhase.Began) && !blocked) { blocked = true; startPoint = touch.position; } else if (touch.phase.Equals(TouchPhase.Ended) && blocked) { blocked = true; endPoint = touch.position; //directionRaw = touch.position - startPoint; Vector2 test = JoyStick.CalculateInput(startPoint, endPoint); //float temp = directionRaw.x / Mathf.Abs(directionRaw.x); move.firstMotion(transform.position, (test.x * floorTransform.localScale.x)); Debug.Log(test); rb.velocity = (new Vector3(0, test.y * 6, 0)); } } } else { manager.playerEnum = PlayerStatEnum.DEAD; } }
/// <summary> /// 初始化代委托理事件 /// </summary> private void InitDelegateEvent() { m_JoyStick = GameObject.FindObjectOfType<JoyStick>(); m_JoyStick.OnJoyStickTouchBegin += OnTouchBegin; m_JoyStick.OnJoyStickTouchMove += OnTouchMove; m_JoyStick.OnJoyStickTouchEnd += OnTouchEnd; m_ButtonEvent = GameObject.FindObjectOfType<FightButtonEvent>(); m_ButtonEvent.OnAttack += OnAttack; m_ButtonEvent.OnJump += OnJump; m_ButtonEvent.OnSkill += OnSkill; m_PlayerState = GameObject.FindObjectOfType<StateDelegate>(); m_PlayerState.OnStateChange += SwitchPlayerState; }
// Use this for initialization void Start() { GC = FindObjectOfType <GameController> (); npc = FindObjectOfType <NPCController> (); player = FindObjectOfType <PlayerData> (); inventory = FindObjectOfType <Inventory> (); dia = FindObjectOfType <DialogueList> (); moveJoystick = FindObjectOfType <JoyStick> (); OIP = FindObjectOfType <OnItemPickup> (); doThingText = GameObject.Find("DoThingText").GetComponent <Text> (); doThingButton = GameObject.Find("DoThingButton").GetComponent <Button> (); doThingCanvas = GameObject.Find("DoThingsCanvas").GetComponent <Canvas> (); finishCanvas = GameObject.Find("FinishCanvas").GetComponent <Canvas> (); anim = GetComponentInChildren <Animator>(); }
public override void Update(TimeSpan elapsedTime) { base.Update(elapsedTime); Helpers.GameState = Helpers.State.GameFinished; if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed || JoyStick.JoyButtonDown(0)) { View.ExecuteJavascript("keyEnter()"); } else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed) { View.ExecuteJavascript("keyEscape()"); } }
//private PlayerStatusfixed playerstatus; private void Start() { leftJoyStick = GameObject.Find("UIControl/joyStick/leftJoyStick/leftFront").GetComponent <JoyStick>(); rightJoyStick = GameObject.Find("UIControl/joyStick/rightJoyStick/rightFront").GetComponent <JoyStick>(); leftJoyStick.OnJoyStickTouchBegin += OnLeftJoyStickBegin; leftJoyStick.OnJoyStickTouchMove += OnLeftJoyStickMove; leftJoyStick.OnJoyStickTouchEnd += OnLeftJoyStickEnd; rightJoyStick.OnJoyStickTouchBegin += OnRightJoyStickBegin; rightJoyStick.OnJoyStickTouchMove += OnRightJoyStickMove; rightJoyStick.OnJoyStickTouchEnd += OnRightJoyStickEnd; controller = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); //playerstatus = GetComponent<PlayerStatusfixed>(); }
static void handleNonBufferedJoy(JoyStick js) { //Just dump the current joy state JoyStickState_NativePtr joy = js.JoyStickState; for (int i = 0; i < joy.AxisCount; ++i) Console.Write("\nAxis " + i + " X: " + joy.GetAxis(i).abs); }
public void Awake() { _instance = this; }