Beispiel #1
0
    protected override void OnUpdate(float deltaTime)
    {
        base.OnUpdate(deltaTime);

        if (UIJoystick.Joystick != null)
        {
            if (CharSkill.IsAnyLife())
            {
                return;
            }
            if (UIJoystick.Joystick.IsDragging)
            {
                Vector2 joyAxis = UIJoystick.Joystick.JoystickAxis;
                Vector3 joyDir  = Camera.main.transform.forward * joyAxis.y + Camera.main.transform.right * joyAxis.x;
                CharMove.BeginJoyMove(joyDir);
            }
        }
    }
    protected override void OnUpdateAvatar(float deltaTime)
    {
        if (CharSkill.IsAnyLife())
        {
            return;
        }

        if (CharMove.IsMoving)
        {
            float animSpeed = CharData.MoveSpeed / Avatar.GetRunAnimationSpeed();
            CharAnim.SetSpeed(CharData.CurrentRunAnimName, animSpeed);
            if (CharAnim.IsPlaying(CharData.CurrentRunAnimName) == false)
            {
                CharAnim.Play(CharData.CurrentRunAnimName, 0.15f);
            }
        }
        else
        {
            if (CharAnim.IsPlaying(CharData.CurrentIdleAnimName) == false)
            {
                CharAnim.Play(CharData.CurrentIdleAnimName, 0.15f);
            }
        }
    }