示例#1
0
    /// <summary>
    /// 播放角色动画
    /// </summary>
    /// <param name="dir"></param>
    /// <param name="type"></param>
    /// <param name="isPlayingAnim"> 闲置播放动作</param>
    protected virtual void PlayRoleAnim(PlayerAnimDirection dir, PlayerAnimType type, bool isPlayingAnim = false)
    {
        _timer         = 0.0f;
        _isPlayingAnim = true;
        CurPlayerAnim.PlayAnim(dir, type);
        if (!isPlayingAnim)
        {
            _isPlayingAnim = false;
        }

        //蝴蝶互动
        if (_isNeedbutterfly)
        {
            ButterflyAndPlayerAnimTable butterflyAndPlayerAnimTable = _animTable.Find((table) => type == table.PlayerAnim);
            string butterflyAnimName = string.Empty;
            if (butterflyAndPlayerAnimTable != null)
            {
                butterflyAnimName = butterflyAndPlayerAnimTable.ButterflyAnimName;
            }
            if (string.IsNullOrEmpty(butterflyAnimName))
            {
                //隐藏蝴蝶
                HideButterflay();
                return;
            }
            ShowButterflay(butterflyAnimName);
        }
    }
    public void ChangeAnim(PlayerAnimType type)
    {
        if (CurAnim == type)
        {
            return;
        }

        switch (type)
        {
        case PlayerAnimType.Idle_Front:
            SetAnimInfo(idleFront);
            break;

        case PlayerAnimType.Walk:
            SetAnimInfo(walk);
            break;

        case PlayerAnimType.Jump:
            SetAnimInfo(jumping);
            break;

        case PlayerAnimType.Idle_Side:
        default:
            SetAnimInfo(idleSide);
            break;
        }

        CurAnim = type;

        frameTime    = 0;
        currentFrame = 0;

        DrawFrame();
    }
示例#3
0
    /// <summary>
    /// 设置动画类型
    /// </summary>
    protected virtual void SetAnimType(PlayerAnimType type)
    {
        switch (type)
        {
        case PlayerAnimType.Idle: PlayerAnimation.SetTrigger("Idle"); break;

        case PlayerAnimType.Jump:
            PlayerAnimation.SetTrigger("Jump");
            break;

        case PlayerAnimType.EventJump: PlayerAnimation.SetTrigger("EventJump"); break;

        case PlayerAnimType.Great: PlayerAnimation.SetTrigger("Great"); break;

        case PlayerAnimType.Bored: PlayerAnimation.SetTrigger("Bored"); break;

        case PlayerAnimType.Appearance: PlayerAnimation.SetTrigger("Appearance"); break;

        case PlayerAnimType.IdleShow: PlayerAnimation.SetTrigger("IdleShow"); break;

        case PlayerAnimType.Hair: PlayerAnimation.SetTrigger("Hair"); break;

        case PlayerAnimType.Clothes: PlayerAnimation.SetTrigger("Clothes"); break;

        case PlayerAnimType.Bottoms: PlayerAnimation.SetTrigger("Bottoms"); break;

        default: PlayerAnimation.SetTrigger("Idle"); break;
        }
    }
示例#4
0
    /// <summary>
    /// 播放动画
    /// </summary>
    /// <param name="dir"></param>
    /// <param name="type"></param>
    public virtual void PlayAnim(PlayerAnimDirection dir, PlayerAnimType type)
    {
        InitAnimParameter();
        if (dir != PlayerAnimDirection.Down)
        {
            if (type == PlayerAnimType.Appearance || type == PlayerAnimType.Hair || type == PlayerAnimType.Clothes ||
                type == PlayerAnimType.Bottoms || type == PlayerAnimType.IdleShow)
            {
                Debug.LogError("播放动画类型戳我 PlayAnim dir = " + dir + " //type = " + type);
                return;
            }
        }

        Debug.Log(string.Format("播放动画类型 PlayAnim dir = {0},type = {1}", dir, type));

        SetDirection(dir);
        SetAnimType(type);
    }
示例#5
0
    /// <summary>
    /// 开始移动播放动画
    /// </summary>
    private void StartMovePlayAnim()
    {
        //是否为事件跳跃 最后一步需要判断跳跃事件
        _jumpType = PlayerAnimType.Jump;
        if (_moveIndex >= _moveGrids.Count - 1 && (_moveGrids[_moveIndex].IsActiveEvent || _moveGrids[_moveIndex].GridInfo.IsEvent))
        {
            _jumpType = PlayerAnimType.EventJump;
        }

        //播放动画
        if (!_isReverseMove)
        {
            //Debug.Log();
            PlayRoleAnim(_moveGrids[_moveIndex - 1].NextStepMoveDirection, _jumpType);
        }
        else
        {
            PlayRoleAnim(_moveGrids[_moveIndex - 1].ReverseNextStepMoveDirection, _jumpType);
        }
    }
示例#6
0
文件: Player.cs 项目: GITHZZ/rgDemo
 void PlayAnimation(PlayerAnimType type)
 {
     if(type == PlayerAnimType.left) this.animation.Play("Left");
     if(type == PlayerAnimType.right) this.animation.Play("Right");
 }
示例#7
0
 /// <summary>
 /// 播放动画
 /// </summary>
 /// <param name="dir"></param>
 /// <param name="type"></param>
 public override void PlayAnim(PlayerAnimDirection dir, PlayerAnimType type)
 {
     base.PlayAnim(dir, type);
 }
示例#8
0
 /// <summary>
 /// 设置动画类型
 /// </summary>
 protected override void SetAnimType(PlayerAnimType type)
 {
     base.SetAnimType(type);
 }