public static rotateLocal ( GameObject gameObject, Vector3 to, float time ) : LTDescr, | ||
gameObject | GameObject | |
to | Vector3 | |
time | float | |
return | LTDescr, |
void ShowGo() { // Trigger Game Count Completed OnGameCountComplete(); LeanTween.scale(_countElements["Go"], new Vector3(1f, 1f, 1f), 0.65f) .setDelay(0f) .setOvershoot(1.25f) .setEase(LeanTweenType.easeOutBack) .setOnComplete(() => { LeanTween.rotateLocal(_countElements["Go"].gameObject, new Vector3(1f, 1f, -45f), 0.65f) .setEase(LeanTweenType.easeInBack) .setDelay(0.25f); LeanTween.scale(_countElements["Go"], Vector3.zero, 0.75f) .setDelay(0.25f) .setEase(LeanTweenType.easeInBack) .setOvershoot(1.25f) .setOnComplete(() => { // Trigger Game Count Finished OnGameCountFinished(); }); }); }
public void PopDown() { isActive = false; shootable.Dormant = true; LeanTween.rotateLocal(gameObject, startAngle, popTime) .setEaseInBounce().setOnComplete(() => { gameObject.SetActive(false); }); }
public void PlayAnim() { if (!isPlaying) { isPlaying = true; rotateTo = Vector3.zero; prevRot = transform.localPosition; if (isPingPong) { if (times % 2 == 0) { rotateTo = new Vector3(transform.localEulerAngles.x + rotateLocal.x, transform.localEulerAngles.y + rotateLocal.y, transform.localEulerAngles.z + rotateLocal.z); } else { rotateTo = new Vector3(transform.localEulerAngles.x - rotateLocal.x, transform.localEulerAngles.y - rotateLocal.y, transform.localEulerAngles.z - rotateLocal.z); } } else { rotateTo = new Vector3(transform.localEulerAngles.x + rotateLocal.x, transform.localEulerAngles.y + rotateLocal.y, transform.localEulerAngles.z + rotateLocal.z); } times++; LeanTween.rotateLocal(this.gameObject, rotateTo, time).setOnComplete(SetNotIsPlaying); } }
private void Shoot() { if (!photonView.IsMine) { return; } var ray = new Ray(camT.position, camT.forward); RaycastHit hit; LeanTween.rotateLocal(cameraForShake, Vector3.one * shakeAmount, 0.1f).setEaseShake(); src.PlayOneShot(gunshot); gun.Shoot(); photonView.RPC("AnimateThirdPersonGun", RpcTarget.AllBufferedViaServer, 1.35f); if (Physics.Raycast(ray, out hit, 100f, targetLayers)) { if (hit.collider != null) { if (hit.collider.CompareTag("Player")) { photonView.RPC("RpcOnPlayerHit", RpcTarget.AllViaServer, hit.point); hit.collider.GetComponent <PhotonView>().RPC("RpcKill", RpcTarget.All); NetworkGameManager.instance.AddKills(PhotonNetwork.LocalPlayer); NetworkGameManager.instance.AddDeaths(hit.collider.GetComponent <PhotonView>().Owner); } else { photonView.RPC("RpcOnHit", RpcTarget.AllViaServer, hit.point); } } } }
public void RemoveTrade(TradeActions tradeAction, PlayerTrade trade) { if (tradeAction == TradeActions.TradeAccepted) { LeanTween.moveLocalX(arrow.gameObject, 43, 0.3f).setEase(LeanTweenType.easeInOutQuad); LeanTween.moveLocalX(counterMove.gameObject, 90, 0.5f).setEase(LeanTweenType.easeInQuad); counterMove.color = ColorPalette.current.GetPlayerColor(trade.ReceivingPlayerTags); LeanTween.rotateLocal(counterMove.gameObject, new Vector3(0, 0, GlobalMethods.GetDirectionRotation(trade.DirectionCounterOffer)), 0); LeanTween.color(GetComponent <Image>().rectTransform, new Color32(120, 224, 143, 255), 0.5f) .setEase(LeanTweenType.easeInOutBounce).setRepeat(3).setRecursive(false).setOnComplete(() => { LeanTween.moveLocalX(gameObject, -400, 0.4f).setEase(LeanTweenType.easeInQuad).setOnComplete(() => Destroy(gameObject)); }); } else { LeanTween.color(GetComponent <Image>().rectTransform, new Color32(229, 80, 57, 255), 0.5f) .setEase(LeanTweenType.easeInOutBounce).setRepeat(3).setRecursive(false).setOnComplete(() => { LeanTween.moveLocalX(gameObject, -400, 0.4f).setEase(LeanTweenType.easeInQuad).setOnComplete(() => Destroy(gameObject)); }); } }
IEnumerator PlayPlayer() { Vector3 nowPos = playerPos.NowPlayerInfo(); float rotateValue = 0; for (int i = 0; i < playerMotion.Count; ++i) { switch (playerMotion[i]) { case buttonstatus.leftSpin: LeanTween.rotateLocal(userChar, new Vector3(0, userChatInfo.SetCharacterRotate(true), 0), 0.4f); rotateValue = nowPos.z - 90; break; case buttonstatus.rightSpin: LeanTween.rotateLocal(userChar, new Vector3(0, userChatInfo.SetCharacterRotate(false), 0), 0.4f); rotateValue = nowPos.z + 90; break; case buttonstatus.roop: break; case buttonstatus.step: Debug.Log(userChatInfo.nowDirection + "asdhflkd"); if (userChatInfo.nowDirection == Charater.UserDirection.North) { nowPlayerPostion.y += 1; } else if (userChatInfo.nowDirection == Charater.UserDirection.East) { nowPlayerPostion.x += 1; } else if (userChatInfo.nowDirection == Charater.UserDirection.South) { nowPlayerPostion.y -= 1; } else if (userChatInfo.nowDirection == Charater.UserDirection.West) { nowPlayerPostion.x -= 1; } playerPos = new PlayerInfo((int)nowPlayerPostion.x, (int)nowPlayerPostion.y); if (playerPos.playerX >= 0 && playerPos.playerX < mapArr[0].Length && playerPos.playerY >= 0 && playerPos.playerY < mapArr.Length) { if (mapArr[playerPos.playerX][playerPos.playerY] == 1) { LeanTween.move(userChar, new Vector3(playerPos.playerX, 0.5f, playerPos.playerY), 0.5f); } } else { FailMotion(); } break; } playerPos = new PlayerInfo((int)nowPos.x, (int)nowPos.y); yield return(new WaitForSeconds(1.0f)); } }
// Use this for initialization void Start() { if (duration <= 0) { Debug.LogWarning("Duration can not be 0 or negative"); duration = 1f; } gameObject.transform.localEulerAngles = startRotation; if (isPingPong) { LeanTween.rotateLocal(this.gameObject, endRotation, duration) .setRepeat(-1) .setLoopPingPong() .setEase(LeanTweenType.easeInOutQuad); } // Use clamp else { LeanTween.rotateLocal(this.gameObject, endRotation, duration) .setRepeat(-1) .setLoopClamp() .setEase(LeanTweenType.easeInOutQuad); } }
private void goSoloScene() { bodyRotation.GetComponent <MeshRenderer>().enabled = true; LeanTween.move(bodyTrans.gameObject, SwitchTrans[1].position, 1f).setEase(LeanTweenType.easeInOutQuad); LeanTween.rotateLocal(bodyTrans.gameObject, SwitchTrans[1].localRotation.eulerAngles, 1f).setEase(LeanTweenType.easeInOutQuad); LeanTween.scale(bodyRotation.gameObject, Vector3.one, 1f); }
public void MoveCamera(Vector3 pos, Vector3 eulerAngles, float time, System.Action endAction = null) { GameObject cameraGo = CameraFollow.gameObject; LeanTween.cancel(cameraGo); bool followEnabled = CameraFollow.enabled; if (followEnabled) { CameraFollow.enabled = false; } LeanTween.rotateLocal(cameraGo, eulerAngles, time).setEase(LeanTweenType.easeOutCubic); LeanTween.moveLocal(cameraGo, pos, time).setEase(LeanTweenType.easeOutCubic).onComplete = () => { if (followEnabled) { CameraFollow.enabled = true; ResetFollowTarget(); } if (endAction != null) { endAction(); } }; }
private void SetTweenOut(byte tween, FageUITransition transition, System.Action callback) { bool move = (tween & FageUITransition.POSITION) != FageUITransition.NONE; bool rotate = (tween & FageUITransition.ROTATION) != FageUITransition.NONE; bool scale = (tween & FageUITransition.SCALE) != FageUITransition.NONE; GameObject go = _component.GetGameObject(); LTDescr ltdesc = null; if (move) { ltdesc = LeanTween.moveLocal(go, transition.GetPosition(), transition.time).setDelay(transition.delay).setEase(transition.ease); } if (rotate) { ltdesc = LeanTween.rotateLocal(go, transition.GetRotation().eulerAngles, transition.time).setDelay(transition.delay).setEase(transition.ease); } if (scale) { ltdesc = LeanTween.scale(go, transition.GetScale(), transition.time).setDelay(transition.delay).setEase(transition.ease); } if ((ltdesc != null) && (callback != null)) { ltdesc.setOnComplete(callback); } }
public override void TransformToHome(bool local = false) { if (Application.isPlaying) { if (local) { LeanTween.moveLocal(gameObject, homePosition, 1f).setEaseInOutQuad(); LeanTween.rotateLocal(gameObject, homeRotation.eulerAngles, 1f); } else { LeanTween.move(gameObject, homePosition, 1f).setEaseInOutQuad(); LeanTween.rotate(gameObject, homeRotation.eulerAngles, 1f); } } else { if (local) { transform.localPosition = homePosition; transform.localRotation = homeRotation; } else { transform.position = homePosition; transform.rotation = homeRotation; } } }
// returns false if there was an obstruction bool SetCrouchingState(bool crouched, bool wasCrouched, bool ignoreObstructions) { // set appropriate heights if (crouched) { //if sliding slope if (isOnSlope) { isSlidingSlope = true; return(false); } //stop sliding slope if on level ground else if (isSlidingSlope) { isSlidingSlope = false; } m_TargetCharacterHeight = capsuleHeightCrouching; //if need to slide if (m_InputHandler.GetSprintInputHeld() && !wasCrouched && !isSliding) { var rotateOut = LeanTween.rotateLocal(CameraGameObject, new Vector3(-slidingTiltAngle, m_CameraHorizontalAngle, 0), slidingTiltTime).setEase(LeanTweenType.easeInOutCubic); isSliding = true; slidingTime = Time.time; StartCoroutine("slideCameraRotation", slidingTiltTime); } else if (!isSliding) { isCrouching = true; } } else { // Detect obstructions if (!ignoreObstructions) { Collider[] standingOverlaps = Physics.OverlapCapsule( GetCapsuleBottomHemisphere(), GetCapsuleTopHemisphere(capsuleHeightStanding), m_Controller.radius, -1, QueryTriggerInteraction.Ignore); foreach (Collider c in standingOverlaps) { if (c != m_Controller) { return(false); } } } m_TargetCharacterHeight = capsuleHeightStanding; isCrouching = false; isSliding = false; slidingTime = 0; } //animator.SetBool("IsCrouching", isCrouching); return(true); }
IEnumerator gatlingGunAttackLeft() { LeanTween.rotateLocal(upperArm.gameObject, new Vector3(0, 0, -42), 1.5f).setEaseOutCirc(); LeanTween.rotateLocal(gatlingGunForearm.gameObject, new Vector3(0, 0, -90), 1.5f).setEaseOutCirc(); yield return(new WaitForSeconds(1.5f)); gatlingGunAudio.Play(); yield return(new WaitForSeconds(0.5f)); foreArmAnimator.enabled = true; foreArmAnimator.SetTrigger("Fire"); for (int i = 0; i < 15; i++) { for (int k = 0; k < 5; k++) { float summonAngle = 202.5f + k * 11.25f; Vector3 positionToSpawn = (new Vector3(Mathf.Cos(summonAngle * Mathf.Deg2Rad), Mathf.Sin(summonAngle * Mathf.Deg2Rad)) * (i * 2.25f)) + centerOfRoom; StartCoroutine(briefLineRendererShow(positionToSpawn, k)); GameObject splashInstant = Instantiate(splash, positionToSpawn, Quaternion.identity); splashInstant.GetComponent <ProjectileParent>().instantiater = boss; yield return(new WaitForSeconds(0.05f)); } } // In total waits five seconds foreArmAnimator.enabled = false; gatlingGunForearm.GetComponent <SpriteRenderer>().sprite = gatlingGunNeutral; rotateBackToOriginalPosition(2f); }
public override void Hide(float time) { if (isShown) { isShown = false; isMoving = true; LeanTween.cancel(gameObject); if (isGUI) { if (showingPos.x != 0f || showingPos.z != 0f) { Debug.LogWarning("GUI rotation will only rotate z-axis"); } LeanTween.rotate(GUIRectTransform, hiddenPos.z, time) .setEase(easeHide) .setDelay(hideDelay) .setUseEstimatedTime(isUseEstimatedTime) .setOnComplete(ShowSendCallback); } else { LeanTween.rotateLocal(gameObject, hiddenPos, time) .setEase(easeHide) .setDelay(hideDelay) .setUseEstimatedTime(isUseEstimatedTime) .setOnComplete(HideSendCallback); } } }
void Update() { if (Input.GetButtonDown("Fire1")) { if (_canAttack && !_isAttacking) { _isAttacking = true; LeanTween.rotateLocal(_attack, new Vector3(0f, 0f, -60f), 0.18f).setOnComplete(StartPourCoffee); } } if (Input.GetButton("Fire1")) { } else { if (_isAttacking) { _isAttacking = false; _isPouring = false; LeanTween.cancel(_attack); LeanTween.rotateLocal(_attack, new Vector3(0f, 0f, 0f), 0.18f); } } if (_isPouring) { int particleNum = CoffeeScript.CoffeeCount > 400 ? 5 : 10; for (int i = 0; i < particleNum; i++) { MakeCoffee(); } } }
// run SelectWeponBox.cs public void SelectedSword(GameObject wepon) { isSelected = true; //hide popup FirstPersonControl firstPersonControl = GameObject.Find("First Person Controller").GetComponent <FirstPersonControl> (); firstPersonControl.ActiveSword(); if (FirstPersonControl.VR) { } else { HandControl.rightGraphicsModel = null; HandControl.leftGraphicsModel = null; } Stan.StartWand(); Stan.playMovingSound(); StartCoroutine(Moving(5F)); sword.gameObject.SetActive(true); wepon.transform.parent = sword.transform; LeanTween.cancel(wepon); LeanTween.scale(wepon, new Vector3(1, 1, 1), 3.0f).setEase(LeanTweenType.easeOutQuad); LeanTween.rotateLocal(wepon, new Vector3(0, 180, 180), 3.0f).setEase(LeanTweenType.easeOutQuad); LeanTween.moveLocal(wepon, new Vector3(0, 0, 0), 3.0f).setEase(LeanTweenType.easeOutQuad); }
private void SetTweenIn(byte tween, FageUITransition transition, System.Action callback, Transform canvas) { bool move = (tween & FageUITransition.POSITION) != FageUITransition.NONE; bool rotate = (tween & FageUITransition.ROTATION) != FageUITransition.NONE; bool scale = (tween & FageUITransition.SCALE) != FageUITransition.NONE; GameObject cach = FageBundleLoader.Instance.Load(uiDetail) as GameObject; GameObject go = GameObject.Instantiate(cach, move ? transition.GetPosition():_uiDetail.GetPosition(), rotate ? transition.GetRotation():_uiDetail.GetRotation()) as GameObject; go.transform.SetParent(canvas, false); _component = go.GetComponent <IFageUIPopupComponent> (); LTDescr ltdesc = null; if (move) { ltdesc = LeanTween.moveLocal(go, _uiDetail.GetPosition(), transition.time).setDelay(transition.delay).setEase(transition.ease); } if (rotate) { ltdesc = LeanTween.rotateLocal(go, _uiDetail.GetRotation().eulerAngles, transition.time).setDelay(transition.delay).setEase(transition.ease); } if (scale) { go.transform.localScale = transition.GetScale(); ltdesc = LeanTween.scale(go, _uiDetail.GetScale(), transition.time).setDelay(transition.delay).setEase(transition.ease); } if ((ltdesc != null) && (callback != null)) { ltdesc.setOnComplete(callback); } }
/// <summary> /// Adds the card. /// </summary> /// <param name="card">Card.</param> /// <param name="flip">If set to <c>true</c> flip.</param> public void AddCard(Card card, bool flip = true) { this.cards.Add(card); if (card.number == 1) { this.aList.Add(card); } card.transform.SetParent(this.transform, true); int i = cards.Count - 1; float angel = i * -3f; float x = i * 20f; float y = 30f * Mathf.Cos(Mathf.Deg2Rad * angel * 5); //cards[i].transform.localPosition = new Vector3(x, y, 0f); //cards[i].transform.localRotation = Quaternion.Euler(0, 0, angel); LeanTween.moveLocal(card.gameObject, new Vector3(x, y, 0f), 0.5f); LeanTween.rotateLocal(card.gameObject, new Vector3(0, 0, angel), 0.5f).setOnComplete(Layout); if (flip) { LeanTween.delayedCall(card.gameObject, 0.25f, () => { card.Flip(); }); } }
// rotate void AnimateRotate() { LeanTween.rotateLocal(gameObject, Vector3.zero.WithZ(rotate), rotateTime) .setEase(LeanTweenType.easeInOutQuad) .setLoopPingPong() .setOnComplete(onRotateComplete); }
private void RotateArrow(Direction move) { int rotationZ = GlobalMethods.GetDirectionRotation(move); Vector3 rotation = new Vector3(0, 0, rotationZ); Vector3 reverseRotation; if (rotationZ == 90 || rotationZ == -90) { reverseRotation = new Vector3(0, 0, rotationZ * -1); } if (rotationZ == 180) { reverseRotation = new Vector3(0, 0, 0); } else { reverseRotation = new Vector3(0, 0, 180); } arrow.gameObject.transform.rotation = Quaternion.Euler(reverseRotation); LeanTween.rotateLocal(arrow.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine); }
public static LTDescr TweenRotateLocal(this Transform transform, Vector3 newRotation, float time = .3f, LeanTweenType easeType = LeanTweenType.easeOutExpo) { return(!transform ? null : LeanTween.rotateLocal(transform.gameObject, newRotation, time).setEase(easeType)); }
void Process() { //Debug.Log("Process"); try { vehicleOffset = jsonData.vehicle_offset; //steeringWheel.UpdateParameters(jsonData.vehicle_offset); if (vehicleOffset != WSClient.instance.vehicleOffset) { LeanTween.cancel(steeringWheel); LeanTween.rotateLocal(steeringWheel, new Vector3(15f, 0f, vehicleOffset * 50f), .25f).setEase(LeanTweenType.easeInOutCubic); } List <int> keys = new List <int>(spawnedVehicles.Keys); for (int key_idx = 0; key_idx < keys.Count; key_idx++) { int key = keys[key_idx]; bool found = false; for (int i = 0; i < jsonData.objects.Length; i++) { if (jsonData.objects[i].id == key) { found = true; break; } } if (!found) { spawnedVehicles[key].Destroy(); spawnedVehicles.Remove(key); } } for (int i = 0; i < jsonData.objects.Length; i++) { DetectedObject o = jsonData.objects[i]; float x = ConvertRange(ConvertRange(o.center_x, 0, 1, -1, 1) * xCorrection, -1, 1, 0, 1) * fovCamera.pixelWidth; float y = (1 - o.center_y) * fovCamera.pixelHeight * yCorrection; Vector3 location = Get3DLocation(x, y); if (spawnedVehicles.ContainsKey(o.id)) { Vehicle spawnedVehicle = spawnedVehicles[o.id]; spawnedVehicle.UpdateParameters(speed, location); } else { SpawnVehicle(o.id, location, o.class_label); } } } catch (Exception e) { Debug.Log(e); } }
private void FlipOneCard(Image imgCard, HandCard card, List <Sprite> textures, float delay, float time) { LeanTween.rotateLocal(imgCard.gameObject, new Vector3(0, 90, 0), time).setDelay(delay).setOnComplete(() => { imgCard.sprite = textures[CardToIndex(card)]; LeanTween.rotateLocal(imgCard.gameObject, Vector3.zero, time); }); }
private IEnumerator StartDelayed() { yield return(new WaitForSeconds(0.1f)); var rotation = Quaternion.AngleAxis(360f / 3.0f, Vector3.up).eulerAngles; LeanTween.rotateLocal(gameObject, rotation, SpinTime / 3.0f).setLoopClamp(); }
void StopWallrun() { isWallRunning = false; //set cooldown nextWallrun = Time.time + wallRunCooldown; //tilt back to ground var rotateOut = LeanTween.rotateLocal(CameraGameObject, new Vector3(m_CameraVerticalAngle, m_CameraHorizontalAngle, 0), wallRunTiltTime).setEase(LeanTweenType.easeInOutCubic); }
public void PlayerDirectionHit(int nr) { ConfirmationScreenIn(); Vector3 rotation = new Vector3(0, 0, GlobalMethods.GetDirectionRotation(_playerController.GetMoves()[nr])); LeanTween.rotateLocal(directionImage.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine); _directionOffer = _playerController.GetMoves()[nr]; }
private void setRotation(Quaternion newRotation) { model.transform.SetParent(null); transform.localRotation = newRotation; model.transform.SetParent(transform); LeanTween.cancel(model); LeanTween.rotateLocal(model, Vector3.zero, rotationAnimationTime); }
public void Return() { LeanTween.moveLocal(PlayerCam.instance.cam.gameObject, new Vector3(0, 0.5f, 0), zoomTime / 2f); LeanTween.rotateLocal(PlayerCam.instance.cam.gameObject, new Vector3(PlayerLook.instance.xRotation, 0, 0), zoomTime / 2f); Invoke("SetFlagToFalse", zoomTime / 2f); Invoke("InvokeFinished", zoomTime / 2f); Invoke("EnablePlayerMovement", zoomTime / 2f); }
public void Swing() { if (!LeanTween.isTweening(gameObject)) { LeanTween.rotateLocal(gameObject, Vector3.forward * _swingAngle, _swingTime).setEase(_swingCurve); AudioController.Play("aud_locked"); } }
private void RotateLocal() { if (startOffset) { _objRectTransform.localRotation = Quaternion.Euler(vectorFrom); } _tweenObject = LeanTween.rotateLocal(objectToAnimate, vectorTo, duration); }