Beispiel #1
0
    /// <summary>
    /// 复活一个挂掉的角色
    /// </summary>
    /// <param name="role"></param>
    public void ResuscitateFightRole(RoleBase role)
    {
        //role.BackAllValue(); //复活后属性要回退到初始状态
        role.BeginFight(role.WholeHurtValue);

        //先找个位置
        int index = -1;

        for (int i = 0; i < role.team.Length; i++)
        {
            if (role.team[i] == null)
            {
                index = i;
                break;
            }
        }
        if (index != -1)
        {
            //送回去
            role.team[index] = role;
            role.SetFightPositionIndex(index);
            if (role.fightListType == EnumType.FightListType.Player)
            {
                UIListener.GetUIListener(playerRoleGos[index]).param = role;
                role.SetFightGo(playerRoleGos[index]);

                playerDieRoles.Remove(role);
            }

            else if (role.fightListType == EnumType.FightListType.Ai)
            {
                UIListener.GetUIListener(aiRoleGos[index]).param = role;
                role.SetFightGo(aiRoleGos[index]);

                aiDieRoles.Remove(role);
            }
        }
    }