// Update is called once per frame void Update() { float offGroundY = rb2d.transform.position.y - baseY; //print ("off Ground" + offGroundY); GameControl.instance.setPlayerOffGroundY(offGroundY); GameControl.instance.setPlayerPosition(rb2d.transform.position); //Input.GetTouch(0).deltaPosition.x < 0 //if (Input.GetKeyUp("left") ) { if (SwipeManager.IsSwipingLeft()) { rb2d.velocity = Vector2.zero; rb2d.AddForce(new Vector2(-upForce, 0)); ninjaFlyOn(true); removeGravity(); } //if(Input.GetKeyUp("right") ){ if (SwipeManager.IsSwipingRight()) { rb2d.velocity = Vector2.zero; rb2d.AddForce(new Vector2(upForce, 0)); ninjaFlyOn(true); removeGravity(); } }
void Update() { if (autoDetectSwipes) { DetectSwipe(); } if (GameManager.instance.inRun) { if (SwipeManager.IsSwipingUp()) { GameManager.instance.MovePlayer("2"); } if (SwipeManager.IsSwipingDown()) { GameManager.instance.MovePlayer("8"); } if (SwipeManager.IsSwipingLeft()) { GameManager.instance.MovePlayer("4"); } if (SwipeManager.IsSwipingRight()) { GameManager.instance.MovePlayer("6"); } } }
private void GamePlayInputs() { if (GameManager.instance.status == GameStatus.GamePlay) { //Rotate Player To Left if (SwipeManager.IsSwipingLeft() && myCollision.canTurn) { EventManager.TriggerEvent(EventManager.instance.RotateLeftButton); } //Rotate Player To Right else if (SwipeManager.IsSwipingRight() && myCollision.canTurn) { EventManager.TriggerEvent(EventManager.instance.RotateRightButton); } //Jump Player else if (SwipeManager.IsSwipingUp()) { EventManager.TriggerEvent(EventManager.instance.JumpButton); } else if (SwipeManager.IsSwipingDown()) { EventManager.TriggerEvent(EventManager.instance.CrouchButton); } else if (Input.GetMouseButton(0)) { EventManager.TriggerEvent(EventManager.instance.MoveButton); } } }
void Awake() { instance = this; float dpi = (Screen.dpi == 0) ? defaultDPI : Screen.dpi; dpcm = dpi / dpcmFactor; }
//public Player OurPlayer; // Perhaps your playerscript? void Start() { SwipeManager swipeManager = GetComponent <SwipeManager>(); swipeManager.onSwipe += HandleSwipe; swipeManager.onLongPress += HandleLongPress; }
void InputManager() { if (ReadyToMove && playing) { //#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER if (Input.GetKeyDown(KeyCode.UpArrow)) { MoveTiles(0); } else if (Input.GetKeyDown(KeyCode.RightArrow)) { MoveTiles(1); } else if (Input.GetKeyDown(KeyCode.DownArrow)) { MoveTiles(2); } else if (Input.GetKeyDown(KeyCode.LeftArrow)) { MoveTiles(3); } //#elif UNITY_ANDROID || UNITY_IOS MoveTiles(SwipeManager.Swipe()); //#endif } //if (Input.GetKeyDown(KeyCode.Space)) //For Debugging Purposes Only // SpawnTile(); }
// Use this for initialization void Start() { _world = GameObject.Find("world").transform; _title = GameObject.Find("title").transform; _pot = GameObject.Find("pot").transform; _stamp = _title.GetChild(0); StaticGlobal.PotButton = Instantiate(PrefabPotButton) as GameObject; StaticGlobal.PotButton.transform.position = Camera.main.ScreenToWorldPoint(StaticGlobal.PotButtonScreenPosition); Controller.Instance.currentState = Controller.State.MAINTAIN; _swipeManager = new SwipeManager(0.7f); PreManagement(); StaticGlobal.Spin = false; ///----------Pot点击事件----- _pot.GetComponent <MaintainTool>().OnClick += (toolIndex) => { if (isExploded) { OnToolClick(); } }; ////-----------注册tool的点击事件---------- foreach (var trans in Tools) { trans.GetComponent <MaintainTool>().OnClick += (toolIndex) => { //前台Tool被点击 if (toolIndex == _frontToolIndex) { OnToolClick(); } }; } }
// Update is called once per frame void Update() { if (SwipeManager.IsSwipingLeft()) { // do something Debug.Log("LEFT"); } if (SwipeManager.IsSwipingRight()) { // do something Debug.Log("RIGHT"); } if (SwipeManager.IsSwipingDown()) { // do something Debug.Log("DOWN"); } if (SwipeManager.IsSwipingUp()) { // do something Debug.Log("UP"); } if (SwipeManager.IsSwipingDownLeft()) { // do something Debug.Log("DownLeft"); } }
public virtual void Inject( AnimationMonitor animationMonitor, SwipeManager swipeManager, ICurve curve, ISelectedListener <UserEncounterSelectedEventArgs> encounterSelectedListener, ISelector <UserSectionSelectedEventArgs> sectionSelector, ISelectedListener <UserSectionSelectedEventArgs> sectionSelectedListener) { foreach (var behaviour in swipableSectionBehaviours) { if (behaviour is ISwipableSection swipableSection) { SwipableSections.Add(swipableSection); } } AnimationMonitor = animationMonitor; SwipeManager = swipeManager; Curve = curve; EncounterSelectedListener = encounterSelectedListener; SectionSelector = sectionSelector; SectionSelectedListener = sectionSelectedListener; SectionSelectedListener.Selected += OnSectionSelected; if (SectionSelectedListener.CurrentValue != null) { OnSectionSelected(SectionSelector, SectionSelectedListener.CurrentValue); } }
protected virtual void OnEnable() { if (SwipeParamater == null) { InitializeSwipeParamaters(); } SwipeManager.AddSwipeAction(SwipeParamater); }
public void HideCardZoomed() { if (SwipeManager.IsSwiping()) { return; } zoomPanel.gameObject.SetActive(false); }
private void Awake() { //Make sure there is only one SwipeManager. if (instance == null) { instance = this; } }
void Start() { SwipeManager swipeManager = gameObject.GetComponent <SwipeManager>(); swipeManager.onSwipe += HandleSwipe; swipeManager.onLongPress += HandleLongPress; block = gameObject.GetComponent <Block>(); }
void Update() { /*if (transform.position.x < 0) * currentLane = 0; * else if (transform.position.x > 0) * currentLane = 2; * else * currentLane = 1;*/ if ((SwipeManager.IsSwipingRight() || Input.GetKeyDown(KeyCode.RightArrow))) { if (currentLane == 0) { //animator.SetTrigger("LeanRight"); //StartCoroutine("SwitchLane", centralLane); currentLane = 1; animator.SetTrigger("CL01"); animator.ResetTrigger("CL12"); animator.ResetTrigger("CL10"); animator.ResetTrigger("CL21"); } else if (currentLane == 1) { //animator.SetTrigger("LeanRight"); //StartCoroutine("SwitchLane", rightLane); currentLane = 2; animator.SetTrigger("CL12"); animator.ResetTrigger("CL01"); animator.ResetTrigger("CL10"); animator.ResetTrigger("CL21"); } } else if ((SwipeManager.IsSwipingLeft() || Input.GetKeyDown(KeyCode.LeftArrow))) { if (currentLane == 1) { //animator.SetTrigger("LeanLeft"); //StartCoroutine("SwitchLane", leftLane); currentLane = 0; animator.SetTrigger("CL10"); animator.ResetTrigger("CL12"); animator.ResetTrigger("CL01"); animator.ResetTrigger("CL21"); } else if (currentLane == 2) { //animator.SetTrigger("LeanLeft"); //StartCoroutine("SwitchLane", centralLane); currentLane = 1; animator.SetTrigger("CL21"); animator.ResetTrigger("CL12"); animator.ResetTrigger("CL01"); animator.ResetTrigger("CL10"); } } }
// Start is called before the first frame update void Start() { totalCells = (height - 2) * (width - 2); // Total Cells Excluding the border cells filledCells = 0; swipeManager = GetComponent <SwipeManager>(); // Initialise Swipe Manager gridInit(); //Set up Grid SpawnPowerUp(); //Start PowerUp Timer Time.timeScale = 1.0f; }
public override void Start() { base.Start(); rotator = GameObject.Find("Card").GetComponent <Rotate>(); swipeManager = GetComponent <SwipeManager>(); swipeManager.enabled = false; }
// Update is called once per frame void Update() { Debug.Log(SwipeManager.IsSwiping()); if (SwipeManager.IsSwiping()) { // rotate the object obj.transform.Rotate(rotateStep); } }
void Update() { if (SwipeManager.IsSwipingLeft()) { } if (SwipeManager.IsSwiping()) { } }
// Use this for initialization void Start() { invincible = false; isFire = false; swipeManager = FindObjectOfType <SwipeManager>(); isDead = false; myAnim = GetComponent <Animator>(); myRigidBody = GetComponent <Rigidbody2D>(); theSpriteRenderer = GetComponent <SpriteRenderer>(); }
void Start() { gameManager = GameManager.Instance; gridManager = GridManager.Instance; SwipeManager swipeManager = GetComponent <SwipeManager>(); swipeManager.onSwipe += HandleSwipe; swipeManager.onTap += HandleTap; swipeManager.SetGetObjectPositionDelegate(GetSelectedHexPosition); }
void Start() { if (GameManager.gameType == "ranked" || GameManager.gameType == "time_trials") { Destroy(this.gameObject); return; } GameObject grid = Resources.FindObjectsOfTypeAll <GameObject>().Where(obj => obj.name == "LevelGrid").First(); swipeManager = grid.GetComponent <SwipeManager>(); }
void Awake() { instance = this; float dpi = (Screen.dpi == 0) ? defaultDPI : Screen.dpi; dpcm = dpi / dpcmFactor; // //private void Start() // //{ SWIPE_ENABLE = swipe_enable; // //} }
void Awake() { if (instance == null || instance.Equals(null)) { instance = this; } else { Destroy(this); } }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void Awake() { if (!Instance) { Instance = this; } swipeUp = new UnityEvent(); swipeDown = new UnityEvent(); swipeLeft = new UnityEvent(); swipeRight = new UnityEvent(); }
protected override void Awake() { base.Awake(); movement = GetComponent <PlayerMovement> (); weaponSystem = GetComponent <PlayerWeaponSystem> (); swipe = GetComponent <SwipeManager> (); GameObject tempUI = GameObject.FindGameObjectWithTag("UI"); if (tempUI) { ui = tempUI.GetComponent <PlayerUI> (); } }
private void Update() { if (SwipeManager.IsSwipingLeft()) { Map1.SetActive(false); Map2.SetActive(true); } if (SwipeManager.IsSwipingRight()) { Map1.SetActive(true); Map2.SetActive(false); } }
private void Start() { swipeManager = SwipeManager.Instance; mainCamera = Camera.main.transform; swipeManager.onSwipe += DetectSwipeAction; swipeManager.onShortPress += DetectTapAction; swipeManager.onLongPress += DetectHoldAction; if (animator != null) { swipeManager.onSwipe += animator.UpdateMovement; } }
// Use this for initialization void Start() { _title = GameObject.Find("title").transform; StaticGlobal.PotButton = Instantiate(PrefabPotButton) as GameObject; StaticGlobal.PotButton.transform.position = Camera.main.ScreenToWorldPoint(StaticGlobal.PotButtonScreenPosition); Controller.Instance.currentState = Controller.State.SELECTION; _swipeManager = new SwipeManager(0.8f); _swipeManager.SwipeThreshold = 0.15f; _indicatorStartY = (int)Camera.main.WorldToScreenPoint(new Vector3(0, 3.37f, 0)).y; //预加载资源 PreManageResource(); StaticGlobal.Spin = false; }
private void Awake() { if (Instance != null && Instance != this) { Destroy(Instance); } else { Instance = this; } onSwipe += SwipeDetection; onLongPress += SwipeDetection; }