protected override void OnPlayFromOriginToTarget(Transform origin, Transform target) { _originPosition = origin.position; _targetPosition = target.position; transform.position = _originPosition; transform.forward = (_targetPosition - _originPosition).normalized; float maxInclusive = Mathf.Min(7f, Vector3.Distance(_originPosition, _targetPosition)); _path = new BezierPath(); List<Vector3> newControlPoints = new List<Vector3>(); newControlPoints.Add(_originPosition); newControlPoints.Add((_originPosition + (transform.right * UnityEngine.Random.Range(-maxInclusive, maxInclusive))) + (transform.up * UnityEngine.Random.Range(0f, maxInclusive))); newControlPoints.Add((_targetPosition + (transform.right * UnityEngine.Random.Range(-maxInclusive, maxInclusive))) + (transform.up * UnityEngine.Random.Range(0f, maxInclusive))); newControlPoints.Add(_targetPosition); _path.SetControlPoints(newControlPoints); time = 0f; stage = 0; visual.gameObject.SetActive(true); drizzle.Clear(true); }
protected override void OnPlayFromOriginToTarget(Transform origin, Transform target) { this._originPosition = origin.position; this._targetPosition = target.position; base.transform.position = this._originPosition; base.transform.forward = (this._targetPosition - this._originPosition).normalized; float maxInclusive = Mathf.Min(7f, Vector3.Distance(this._originPosition, this._targetPosition)); this._path = new BezierPath(); List <Vector3> newControlPoints = new List <Vector3>(); newControlPoints.Add(this._originPosition); newControlPoints.Add((this._originPosition + (base.transform.right * Random.Range(-maxInclusive, maxInclusive))) + (base.transform.up * Random.Range(0f, maxInclusive))); newControlPoints.Add((this._targetPosition + (base.transform.right * Random.Range(-maxInclusive, maxInclusive))) + (base.transform.up * Random.Range(0f, maxInclusive))); newControlPoints.Add(this._targetPosition); this._path.SetControlPoints(newControlPoints); this.time = 0f; this.stage = 0; this.visual.gameObject.SetActive(true); this.drizzle.Clear(true); }