public override void UpdateTween() { if (_local) { Target.localPosition = _tweener.Get(); } else { Target.position = _tweener.Get(); } }
private IEnumerator LowerWeapon(bool removing) { _state = removing ? State.Removing : State.Playing; SetupLowerTween(); yield return(null); while (_positionAnimator.Active) { _pivot.transform.localPosition = _positionAnimator.Get(); yield return(null); } _renderer.enabled = false; _state = State.None; }
public IEnumerator SetTargetText(string text, float duration, Vector3 end, Color color) { _text.text = text; _text.color = _defaultColor; _moveTween.Restart(transform.position, end, duration); _colorTween.Restart(0, 1, duration); while (_moveTween.Active) { _text.color = Color.Lerp(_defaultColor, _endColor, _colorTween.Get()); transform.position = _moveTween.Get(); transform.LookAt(transform.position + Player.Cam.transform.rotation * Vector3.forward, Player.Cam.transform.rotation * Vector3.up); //_text.fontSize = Vector3.Distance(transform.position, Player.Cam.transform.position) * 0.35f; yield return(null); } ItemPool.Despawn(gameObject); }
public override void UpdateTween() { Target.localScale = _tweener.Get(); }
public void OnSystemUpdate(float dt) { switch (_state) { case State.FinishingFall: if (!FoundFloor()) { _state = State.Falling; } else { transform.position = _floorLerp.Get(); if (!_floorLerp.Active) { _state = State.Disabled; } } break; case State.Pulling: if (_pullTarget == null) { CheckState(); break; } var dir = (_pullTarget.position - transform.position); var distance = dir.magnitude; if (distance > _pullRange.Max * 1.5f) { CheckState(); } else { transform.position = Vector3.MoveTowards(transform.position, _pullTarget.position, Mathf.Lerp(_pullSpeed * 0.25f, _pullSpeed, Mathf.InverseLerp(_pullRange.Max, _pullRange.Min, distance)) * dt); } break; case State.Falling: transform.Translate(-transform.up * _gravitySpeed * dt); CheckState(); break; case State.Throwing: if (!_arcMover.Active) { CheckState(); break; } _arcMover.Get(transform); break; } if (_collisionRadius > 0 && _collisions.Length > 0) { var cnt = Physics.OverlapSphereNonAlloc(transform.position, _collisionRadius, _tempColliders, _collisionMask); for (int c = 0; c < cnt; c++) { var collEntity = UnityToEntityBridge.GetEntity(_tempColliders[c]); if (collEntity == null) { continue; } for (int i = 0; i < _collisions.Length; i++) { _collisions[i].Collision(collEntity); } } } if (_pullRange.Max <= 0) { return; } switch (_state) { case State.Pulling: case State.Throwing: return; } var pullCnt = Physics.OverlapSphereNonAlloc(transform.position, _pullRange.Max, _tempColliders, _pullMask); for (int c = 0; c < pullCnt; c++) { var coll = _tempColliders[c]; if (_playerOnly && !coll.transform.CompareTag(StringConst.TagPlayer)) { continue; } _pullTarget = _tempColliders[0].transform; _state = State.Pulling; break; } }
public override void UpdateTween() { _rectTr.anchoredPosition3D = _tweener.Get(); }