public override void Init(Transform trans, ITrajectoryData data) { base.Init(trans, data); if (data is EllipseData) { _data = data as EllipseData; } else { Debug.LogError("当前传入椭圆形路径的数据类型错误,类型为:" + data); return; } _data.Center = new Vector2(0, (GameUtil.GetCameraMax().y - GameUtil.GetCameraMin().y) * (float)_data.YRatioInScreen); float offsetY = _data.Center.y + (float)_data.YRadius; _enter.InitByOffsetY(_trans, 0, offsetY, EnterPath.MoveDirection.UP_TO_DOWN); Vector2 startPos = new Vector2(_trans.position.x, offsetY); _data.StartPos = startPos; _trajectory = new EllipseTrajectory(); _trajectory.Init(_data); }
private void InitTrajectory(float width) { EllipseData data = new EllipseData(); data.XRadius = width / 2; data.YRadius = 0.3f; var pos = transform.position; pos.y -= (float)data.YRadius; _centerX = pos.x; data.Center = pos; _trajectory = new EllipseTrajectory(); _trajectory.Init(data); }