コード例 #1
0
    // レース開始演出
    void InitRaceStart()
    {
        // 位置
        var beginPos = new Vector3(0, this.settings.StartHeight, 0) + transform.localPosition;

        this.pos = new EasingVector3();
        this.pos.Start(this.settings.PositionPattern, this.settings.PositionTime, beginPos, transform.localPosition);
        this.pos.SetOnUpdate(value =>
        {
            transform.localPosition = value;
        });
        this.pos.SetFinishEvent(() =>
        {
            this.demo -= 1;
        });
        // 向き
        this.rotateStart = Quaternion.LookRotation(Vector3.down, Vector3.forward);
        var r = transform.localRotation;

        this.rotateEnd = Quaternion.Euler(90.0f, r.eulerAngles.y, 0.0f);
        this.rot       = new Easing();
        // 開始Delayを実現
        this.rot.Start(EasingPattern.Linear, RaceCameraSettings.Instance.RotationDelay, 0.0f, 0.0f);
        this.rot.SetOnUpdate(value =>
        {
            transform.localRotation = Quaternion.Lerp(this.rotateStart, this.rotateEnd, value);
        });
        this.rot.SetFinishEvent(() =>
        {
            // Delay完了後に改めて演出を設定
            this.rot.Start(this.settings.RotationPattern, this.settings.RotationTime, 0.0f, 1.0f);
            this.rot.SetFinishEvent(() =>
            {
                // 最後に前方を向く
                this.pitch = new Easing();
                this.pitch.Start(this.settings.PitchPattern, this.settings.PitchTime, 0.0f, 1.0f);
                this.pitch.SetOnUpdate(value =>
                {
                    transform.localRotation = Quaternion.Lerp(this.pitchStart, this.pitchEnd, value);
                });
                this.pitch.SetFinishEvent(() =>
                {
                    this.demo -= 1;
                });
                this.pitchStart = transform.localRotation;
                this.pitchEnd   = r;
            });
        });
        // 演出開始位置
        transform.localPosition = beginPos;
        transform.localRotation = this.rotateStart;
        this.demo      = 2;
        this.demoExec  = false;
        this.demoDelay = RaceCameraSettings.Instance.CameraDelayTime;
    }
コード例 #2
0
ファイル: easing.cs プロジェクト: kuwazoe2714/Unity_BJ
 public static EasingCoroutine CreateVector3(EasingFunction func, Vector3 from, Vector3 to, float duration, EasingVector3 update)
 {
     return(new EasingVector3Coroutine
     {
         from = from,
         to = to,
         duration = duration,
         startTime = Time.time,
         func = func,
         updateFunc = update,
     });
 }