void DummyJump() { bool take = false; RaycastHit hit; if (Physics.Raycast(LeftHand.position, LeftHand.forward, out hit, 20f)) { take = true; } if (Physics.Raycast(RightHand.position, RightHand.forward, out hit, 20f)) { take = true; } if (take) { rigidbody.velocity = new Vector3(0, 0, 0); rigidbody.AddForce(Vector3.up * Mathf.Min(1200f, JumpPower * 1200f)); if (JumpPower >= 0.8f) { LeftHand.GetComponentInChildren <ParticleSystem>().Play(); RightHand.GetComponentInChildren <ParticleSystem>().Play(); transform.DOMoveX(Random.Range(-13f, 13f), 6f).SetSpeedBased(); GameObject temp = Instantiate(Sparks) as GameObject; temp.transform.parent = transform; temp.transform.localPosition = new Vector3(0, 1.5f, -0.5f); } } JumpPower = 0; }
public void SetVisible(bool val) { isVisible = val; if (!val) { RightHand.GetComponentInChildren <Pointer>().SetLineVisibility(false); LeftHand.GetComponentInChildren <Pointer>().SetLineVisibility(false); } }
void DoJumpPlayer() { bool take = false; RaycastHit hit; if (Physics.Raycast(LeftHand.position, LeftHand.forward, out hit, 20f)) { take = true; } if (Physics.Raycast(RightHand.position, RightHand.forward, out hit, 20f)) { take = true; } if (take && !isRotate) { if (Global.ScrollSpeed < 20f) { float power = Global.ScrollSpeed + (Time.time - timer) * 10f; if (power > 20f) { power = 20f; // limit power } if (JumpPower >= 0.5f) { LeanTween.value(gameObject, Global.ScrollSpeed, power, 0.5f).setOnComplete(ZoomIn).setOnUpdate( (float value) => { Global.ScrollSpeed = value; } ).setEase(LeanTweenType.easeOutCubic); } } if (JumpPower >= 0.5f) { LeftHand.GetComponentInChildren <ParticleSystem>().Play(); RightHand.GetComponentInChildren <ParticleSystem>().Play(); } if (rigidbody.velocity.y < 0) { rigidbody.velocity = new Vector3(0, rigidbody.velocity.y * 0.3f, 0); } rigidbody.AddRelativeForce(Vector3.up * Mathf.Min(1000f, JumpPower * 1000f)); if (JumpPower >= 0.8f) { GameObject temp = Instantiate(Sparks) as GameObject; temp.transform.parent = transform; temp.transform.localPosition = new Vector3(0, 1.5f, -0.5f); } } JumpPower = 0; }
void RotatePlayer() { if (!isRotate) { isRotate = true; LeftHand.GetComponentInChildren <ParticleSystem>().Stop(); RightHand.GetComponentInChildren <ParticleSystem>().Stop(); if (!isFirst) { Time.timeScale = 0.5f; LeanTween.moveLocal(CameraPoint.gameObject, new Vector3(0.9f, 0.9f, 0f), 0.5f).setEase(LeanTweenType.easeOutQuad); LeanTween.rotateLocal(CameraPoint.gameObject, new Vector3(0, 320f, 0), 0.5f).setEase(LeanTweenType.easeOutQuad); } LeanTween.rotateAround(Body.gameObject, Vector3.right, 360f, 1.0f).setEase(LeanTweenType.easeOutQuad).setOnComplete(RotateComplete); } }