예제 #1
0
    public void Play(ISnapshot snapshot)
    {
        if (!Replaying)
        {
            return;
        }

        var current = snapshot.As <Snapshot>();

        transform.position   = current.Position;
        transform.localScale = new Vector2(current.FaceDirection, transform.localScale.y);
        m_Animator.SetFloat("absSpeed", current.Animator.AbsSpeed);
        m_Animator.SetBool("isJumping", current.Animator.IsJumping);
        m_Animator.SetBool("isCrouching", current.Animator.IsCrouching);
        m_Animator.SetBool("isFallingNotFromJump", current.Animator.IsFallingNotFromJump);
        m_Animator.SetBool("isSkidding", current.Animator.IsSkidding);
    }
예제 #2
0
    public void Play(ISnapshot snapshot)
    {
        if (!Replaying)
        {
            return;
        }

        if (snapshot is AnimationSnapshot animation)
        {
            m_Animator.SetTrigger(snapshot.As <AnimationSnapshot>().Trigger);
        }
        else if (snapshot is CoinSnapshot coin)
        {
            Debug.Log($"{DateTime.Now.ToShortTimeString()}: playin");

            var instance = Instantiate(objectToSpawn, coin.Position, coin.Quaternion);
            instance.GetComponentInChildren <Animator>().SetBool("forward", coin.Forward);
        }
        else
        {
            throw new Exception($"Unknown snapshot type: {snapshot.GetType()}");
        }
    }