// Update is called once per frame void Update() { MaxInventoryWeight = UpgradesData.instance.CargoUpgrades[upgrades.CurrentCargo]; if (idScript.Shopping) { return; } if (XCI.GetButtonDown(XboxButton.X, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire2")) { DropDynamite(); } if (XCI.GetButtonDown(XboxButton.A, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire1")) { Refill(); } if (XCI.GetButtonDown(XboxButton.B, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire3")) { Repair(); } if (XCI.GetButtonDown(XboxButton.Y, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire4")) { if (TacitusMission.instance.State == TacitusMission.QuestState.Completed) { Teleport(); } else { MasterAudioSummoner.instance.PlayAudio(MasterAudioSummoner.instance.MenuSounds, "ErrorSound", 1f, 0f, transform.position, null); } } if (XCI.GetButtonDown(XboxButton.RightBumper, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire5")) { if (TacitusMission.instance.State == TacitusMission.QuestState.Completed && healthScript.transform.position.y > -1490f) { Beacon(); } else { MasterAudioSummoner.instance.PlayAudio(MasterAudioSummoner.instance.MenuSounds, "ErrorSound", 1f, 0f, transform.position, null); } } if (XCI.GetButtonDown(XboxButton.DPadLeft, idScript.controller) || (idScript.GetControllerInt() == 4) && Input.GetButtonDown("Fire6")) { if (TiberiumMission.instance.State == TiberiumMission.QuestState.Completed && healthScript.transform.position.y > -1490f) { PocketStation(); } else { MasterAudioSummoner.instance.PlayAudio(MasterAudioSummoner.instance.MenuSounds, "ErrorSound", 1f, 0f, transform.position, null); } } }
void Update() { if (healthScript.State == NPCHealth.CurrentStatus.Stunned) { jumpVertical = 0f; vertical = 0f; horizontal = 0f; rg.isKinematic = false; return; } if (healthScript.State == NPCHealth.CurrentStatus.Teleporting) { jumpVertical = 0f; vertical = 0f; horizontal = 0f; rg.isKinematic = true; rg.velocity = Vector2.zero; return; } rg.isKinematic = false; jumpVertical = XCI.GetAxis(XboxAxis.RightTrigger, controller); vertical = XCI.GetAxis(XboxAxis.LeftStickY, controller); horizontal = XCI.GetAxis(XboxAxis.LeftStickX, controller); if (playerID.GetControllerInt() == 4) { jumpVertical = Input.GetAxis("Jump"); vertical = Input.GetAxis("Vertical"); horizontal = Input.GetAxis("Horizontal"); } if (jumpVertical > jumpTreshold) { jumping = true; } else { jumping = false; } if (jetpackSound != null) { jetpackSound.gameObject.SetActive(jumping); } SetFlip(horizontal); ApplyAim(); //aim Vector3 v3Dir = drillObject.transform.position - Aimer.position; float angle = Mathf.Atan2(-v3Dir.y, -v3Dir.x) * Mathf.Rad2Deg; //handle exeptions if (angle > 0f) { if (angle > 90f) { angle = Mathf.Clamp(angle, 180f, 180f); } else { angle = 0f; } } else if (angle < 0f) { if (angle < -45f && angle > -90f) { horizontal = 0f; angle = -90f; } else if (angle > -45f) { angle = 0f; } if (angle > -135f && angle < -90f) { horizontal = 0f; angle = -90f; } else if (angle < -135f) { angle = 180f; } } drillObject.transform.eulerAngles = new Vector3(0, 0, angle); if (WheelAnim != null) { WheelAnim.speed = Mathf.Abs(horizontal) * 2f; } float f = Mathf.MoveTowards(engineSound.pitch, Mathf.Abs(horizontal) * 2f, maxPitchAdjust * Time.deltaTime); engineSound.pitch = Mathf.Clamp(f, 0.25f, 1f); //drillObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); //update stats UpdateStats(); }