private void Start() { fixedJoystic = joystic.GetComponent <FixedJoystick>(); }
void Awake() { Stick = GetComponent<FixedJoystick>(); }
private void Awake() { joystick = GameObject.FindWithTag("Joystick").GetComponent <FixedJoystick>(); }
private void Awake() { cc = GetComponent <CharacterController>(); joystick = FindObjectOfType <FixedJoystick>(); }
public void Awake() { fixedJoystick_look = GameObject.FindWithTag("Joystick_look").GetComponent <FixedJoystick>(); }
void Start() { this.pad = FindObjectOfType <FixedJoystick>(); this.primaryButton = FindObjectOfType <ActionButton>(); this.secondaryButton = FindObjectOfType <HoldButton>(); }
private void DeviceLockController() { if (movementJoystick.pressedJoystick && !joystickPressedOnce) { Debug.Log("Joystick Pressed Once"); //joysticks inputs joystickPressedOnce = true; joystickReleased = false; actualNumber = (int)Mathf.Round((transform.localRotation.eulerAngles.z) / (divider)); if (actualNumber == (int)Mathf.Round(360 / divider)) { actualNumber = 0; } } //if drag the joystick if (movementJoystick.pressedJoystick) { //transform.eulerAngles = transform.eulerAngles + new Vector3(-Input.GetAxis("Mouse X"), 0, 0) * Time.deltaTime * speed; transform.Rotate(new Vector3(0, 0, -movementJoystick.Horizontal) * Time.deltaTime * joystickSpeed, Space.Self); int actualAux = (int)Mathf.Round((transform.localRotation.eulerAngles.z) / (divider)); if (actualAux == (int)Mathf.Round(360 / divider)) { actualAux = 0; } if (actualNumber != actualAux) { if (actualAux != keyNumber[index]) { int index = Random.Range(0, badAudios.Count); audioS.clip = badAudios[index]; } else { audioS.clip = goodAudio; } audioS.Play(); //print(actualAux); actualNumber = actualAux; } //Debug.Log("old: " +oldMovement); if (-movementJoystick.Horizontal > 0.6) { movement = 1; if (oldMovement == 1) { index = 0; oldMovement = 0; Debug.Log("Se resetea"); } } else if (-movementJoystick.Horizontal < -0.6) { movement = 2; if (oldMovement == 2) { index = 0; oldMovement = 0; Debug.Log("Se resetea"); } } //Debug.Log("new; " + movement); } //if release the joystick else if (!movementJoystick.pressedJoystick && !joystickReleased) { Debug.Log("Joystick Released Once"); //joysticks inputs joystickPressedOnce = false; joystickReleased = true; if (movement == oldMovement) { Debug.Log("Vas en el mismo sentido, se resetea la cuenta"); //index = 0; } float rotation = transform.localRotation.eulerAngles.z; int number = (int)Mathf.Round((rotation) / (divider)); if (number == (int)Mathf.Round(360 / divider)) { number = 0; } if (index < keyNumber.Length) { print("number = " + number); if (number == keyNumber[index]) { Debug.Log("Número correcto"); oldMovement = movement; index++; } else { Debug.Log("Número incorrecto, comienza de nuevo"); //index = 0; } } if (index >= keyNumber.Length) { Debug.Log("Has ganado"); door.SetActive(false); GameObject.Find("PlayManager").GetComponent <PlayerEndGame>().rewardPlayer(); transform.parent.gameObject.tag = "Untagged"; GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().EnableRotation(); movementJoystick = null; resolved = true; GetComponent <MeshRenderer>().enabled = false; } } }
void FixedUpdate() { if (GameObject.FindGameObjectWithTag("Dragonfightcam") && GameObject.FindGameObjectWithTag("Dragonfightcam").activeSelf == true) { cam = GameObject.FindGameObjectWithTag("Dragonfightcam").GetComponent <Camera>(); } FixedJoystick[] fixedJoysticks = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks in fixedJoysticks) { if (joysticks.tag == "Joystick2") { joystick = joysticks; } } } else { joystick = null; } if (joystick == null && Input.GetKey(mousebutton) && GetComponentInParent <PlayerController>().ownplayernumber == GameManager.playernumber) { active = true; photonView.RPC("setactive", PhotonTargets.MasterClient, true); } else if (GetComponentInParent <PlayerController>().ownplayernumber == GameManager.playernumber) { active = false; photonView.RPC("setactive", PhotonTargets.MasterClient, false); } if (joystick != null && (joystick.Vertical != 0 || joystick.Horizontal != 0)) { photonView.RPC("setactive2", PhotonTargets.MasterClient, true); } else { photonView.RPC("setactive2", PhotonTargets.MasterClient, false); } if (GetComponentInParent <PlayerController>().ownplayernumber == GameManager.playernumber && active == true) { Vector2 valueToSend = new Vector2(cam.ScreenToWorldPoint(Input.mousePosition).x, cam.ScreenToWorldPoint(Input.mousePosition).y); photonView.RPC("mousefollow1", PhotonTargets.MasterClient, valueToSend.x); photonView.RPC("mousefollow2", PhotonTargets.MasterClient, valueToSend.y); } if (playerController.Dead == true) { speed = 0; Maxspeed = 0; } else if (playerController.Dead == false) { speed = 35; Maxspeed = 35; } if (GameManager.playernumber == 1) { Vector3 difference = playerpos - transform.position; if (GameManager.HandyControllsOn == false) { rotationZ = Mathf.Atan2(difference.x, -difference.y) * Mathf.Rad2Deg; } else if (GameManager.HandyControllsOn == true) { rotationZ = Mathf.Atan2(joystick.Direction.x, -joystick.Direction.y) * Mathf.Rad2Deg; } if (GameManager.playernumber == 1 && (active == true || active2 == true)) { rb.MoveRotation(Mathf.LerpAngle(rb.rotation, rotationZ, speed * Time.fixedDeltaTime)); } } }
// Старт! private void Awake() { JStick = GameObject.Find("Fixed Joystick").GetComponent <FixedJoystick>(); AimJStick = GameObject.Find("AimJoystick").GetComponent <AimJoystick>(); }
private void Start() { Joystick = TankService.Instance.joystick.GetComponent <FixedJoystick>(); }
private void Start() { FixedJoystick = GameObject.FindObjectOfType <FixedJoystick>().GetComponent <FixedJoystick>(); }
private void Awake() { joystick = joystickPrefab.GetComponent <FixedJoystick>(); }
private void Init() { moveJoystic = GameController.GetInstance().moveJoystick; rotateJoystic = GameController.GetInstance().rotateJoystic; rb = GetComponent <Rigidbody2D>(); Physics2D.gravity = Vector2.zero; if (playerType == 2) { body.eulerAngles = new Vector3(0, 180, 0); shell.eulerAngles = new Vector3(0, 180, 0); turret.eulerAngles = new Vector3(0, 180, 0); if (turretAdjtPos != Vector3.zero) { turret.localPosition = turretAdjtPos; } if (shellAdjPos != Vector3.zero) { shell.localPosition = shellAdjPos; } //transform.eulerAngles = new Vector3(0,180,0); //canvas.eulerAngles = new Vector3(0, 180, 0); healthbar = GameController.GetInstance().health2; healthbar.Init(); canvas.gameObject.SetActive(false); if (isAI) { projectileHolder.gameObject.SetActive(false); usedWeaponIds = new List <int>(); usedWeaponIds.Add(1); usedWeaponIds.Add(2); usedWeaponIds.Add(3); usedWeaponIds.Add(4); usedWeaponIds.Add(5); usedWeaponIds.Add(6); usedWeaponIds = Randomize <int>(usedWeaponIds); } } else { healthbar = GameController.GetInstance().health1; healthbar.Init(); } usedWeaponIds = new List <int>(); activeWeapons = new List <RowWeapon>(); foreach (RowWeapon weapon in GameController.Instance.allWeapons) { activeWeapons.Add(weapon); } Physics2D.gravity = GRAVITY; GenerateDot(); }
void Start() { moveStick = FindObjectOfType <MovementJoystick>().gameObject.GetComponent <FixedJoystick>(); rb = GetComponent <Rigidbody2D>(); stopMoving = true; }
private void Awake() { variableJoystick = GameObject.FindObjectOfType <FixedJoystick>(); }
public static void FindJoystick() { JStick = GameObject.Find("Fixed Joystick").GetComponent <FixedJoystick>(); AimJStick = GameObject.Find("AimJoystick").GetComponent <AimJoystick>(); }
void Start() { joystick2 = FindObjectOfType <FixedJoystick>(); joystick1 = FindObjectOfType <VariableJoystick>(); }
// Start is called before the first frame update void Start() { joystick = joystick.GetComponent <FixedJoystick>(); mover = GetComponent <Mover>(); animator = GetComponent <Animator>(); }
private FixedJoystick joystick; //джойстик private void Start() { joystick = GetComponent <FixedJoystick>(); }
void Start() { _joystick = GameObject.Find("Direction"); _handle = GameObject.Find("Direction").transform.GetChild(0).gameObject; _fj = _joystick.GetComponent <FixedJoystick>(); }
public void FixedUpdate() { //stopit = true; if (Input.GetKey(mousebutton) && DisableOnMouseClick == true && disabled == 1) { //stopit = true; } else if (disabled == 1) { } //stopit = false; FixedJoystick[] fixedJoysticks = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks in fixedJoysticks) { if (joysticks.tag == "Joystick2") { joystick = joysticks; } } } else { joystick = null; } if (GetComponentInParent <PlayerController>()) { disabled = 1; } else { disabled = 0; } if (stopit == false && photonView.isMine && joystick == null) { if (PlayerController.Gravitation == true) { if (smoothRotation < 180) { smoothRotation += 2f; } } else { if (smoothRotation > 1) { smoothRotation -= 2f; } } rb.MoveRotation(Mathf.LerpAngle(rb.rotation, targetRotation - smoothRotation, force * Time.fixedDeltaTime)); } else if (joystick != null && !(joystick.Vertical != 0 || joystick.Horizontal != 0) && photonView.isMine) { if (PlayerController.Gravitation == true) { if (smoothRotation < 180) { smoothRotation += 2f; } } else { if (smoothRotation > 1) { smoothRotation -= 2f; } } rb.MoveRotation(Mathf.LerpAngle(rb.rotation, targetRotation - smoothRotation, force * Time.fixedDeltaTime)); } }
private void Awake() { myBody = GetComponent <Rigidbody>(); joystick = GameObject.FindWithTag("Joystick").GetComponent <FixedJoystick>(); anim = GetComponent <Actions>(); }
private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); m_joystick = GameObject.Find("JoystickCanvas/FixedJoystick").GetComponent <FixedJoystick>(); }
void Awake() { Instance = this; }
// Use this for initialization void Awake() { Joystick = FindObjectOfType <FixedJoystick>(); Button = FindObjectOfType <Button>(); TouchField = FindObjectOfType <TouchField>(); }
void Awake() { myBody = GetComponent <Rigidbody>(); joyStick = GameObject.FindWithTag("Joystick").GetComponent <FixedJoystick>(); }
private void Update() { if (ownplayernumber == GameManager.playernumber) { if (Input.GetKeyDown(KeyCode.Space) || ((joystick != null && joystick.Vertical >= 0.3) && Onlyonce == true)) { Onlyonce = false; photonView.RPC("Jumping", PhotonTargets.MasterClient); } else if (joystick != null && joystick.Vertical <= 0.3) { Onlyonce = true; } } if (isFrozen == false && Dead == false) { FixedJoint2D[] freeze = GetComponentsInChildren <FixedJoint2D>(); foreach (FixedJoint2D frozen in freeze) { if (frozen.gameObject.name != "Chest" && frozen.gameObject.name != "Neck") { frozen.enabled = false; } } Rigidbody2D[] rigidbodies = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D rbs in rigidbodies) { rbs.freezeRotation = false; } } else if (isFrozen == true && Dead == false) { Rigidbody2D[] rigidbodies = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D rbs in rigidbodies) { rbs.freezeRotation = true; } } FixedJoystick[] fixedJoysticks = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks in fixedJoysticks) { if (joysticks.tag == "Joystick") { joystick = joysticks; } } } else { joystick = null; } FixedJoystick[] fixedJoysticks2 = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks2 in fixedJoysticks2) { if (joysticks2.tag == "Joystick2") { joystick2 = joysticks2; } } } else { joystick2 = null; } if (Input.GetKeyDown(KeyCode.UpArrow) && Input.GetKeyDown(KeyCode.B)) { //Acivate John Cena JohnCena = true; } if (photonView.isMine) { energybar.SetHealth(currentEnergy); } if (lr.enabled == true && GameObject.FindGameObjectWithTag("RightFist")) { lr.SetPosition(0, GameObject.FindGameObjectWithTag("RightFist").transform.position); } lr.SetPosition(1, Hand1.transform.position); if (MenuController.power == 1 && photonView.isMine) { if ((GameManager.HandyControllsOn == false && Input.GetKeyDown(KeyCode.Mouse0)) || (joystick2 != null && joystick2.Direction != new Vector2(0, 0) && Onlyonce2 == true)) { StartCoroutine("shoot"); Onlyonce2 = false; } if ((GameManager.HandyControllsOn == false && Input.GetKeyUp(KeyCode.Mouse0)) || (joystick2 != null && joystick2.Direction == new Vector2(0, 0))) { Onlyonce2 = true; photonView.RPC("stopGrapling", PhotonTargets.All); springjoint.enabled = false; GameObject.FindGameObjectWithTag("LowerArm").GetComponent <FollowMouse>().enabled = true; GameObject.FindGameObjectWithTag("UpperArm").GetComponent <FollowMouse>().enabled = true; } Vector2 transform2D = new Vector2(Hand1.transform.position.x, Hand1.transform.position.y); //if (Vector2.Distance(springjoint.connectedAnchor, transform2D) <= 5 && !Input.GetKey(KeyCode.Mouse0)) //springjoint.enabled = false; } else { //lr.enabled = false; //springjoint.enabled = false; } if (currentHealth <= 0 && Dead == false) { Dead = true; StartCoroutine("deadbody"); if (MenuController.selectedgamemode != 2 && MenuController.selectedgamemode != 1 && photonView.isMine) { GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>().StartCoroutine("Respawn"); } } if (GameManager.playernumber == 1 && Dead == false && isFrozen == false) { KeyInput(); } }
// Start is called before the first frame update void Start() { Joy = FindObjectOfType <FixedJoystick>(); }
void Awake() { Instance = this; UICamera = GameObject.Find("UICamera").GetComponent <Camera>(); }
private static void GetJoysticks() { leftJoystick = GameObject.Find("LeftJoystick").GetComponent <FixedJoystick>(); rightJoystick = GameObject.Find("RightJoystick").GetComponent <FixedJoystick>(); }