// Update is called once per frame void Update() { time = Mathf.Clamp01(time + Time.deltaTime * timeStep); Vector3 _currentPos = Vector3.Lerp(currentPos, currentPos + targetPos, time); transform.position = new Vector3(_currentPos.x, _currentPos.y + Mathf.Abs(Mathf.Sin(_currentPos.x * Mathf.PI) + Mathf.Sin(_currentPos.z * Mathf.PI)), _currentPos.z); if (time >= 1 && !complete) { complete = true; CallToJs.SetElementText(200); } }
public void AddTargetPos(string _targetPos) { if (time < 1) { return; } currentPos += targetPos; targetPos = JsonUtility.FromJson <Vector3>(_targetPos); time = 0; complete = false; CallToJs.SetElementText(0); }
private void Awake() { CallToJs.SetElementText(200); }