位置: 编程技术 - 正文

[置顶] unity加载与链表([置顶]bilinovel)

编辑:rootadmin

推荐整理分享[置顶] unity加载与链表([置顶]bilinovel),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:[置顶]游戏名:chivalry2,[置顶]电影名字《收件人不详》,[置顶]电影名字《收件人不详》,[置顶]游戏名:chivalry2,[置顶]电影名字《收件人不详》,[置顶]从lv2开始开挂的原勇者候悠闲的异世界生活,[置顶]游戏名:chivalry2,[置顶]bilinovel,内容如对您有帮助,希望把文章链接给更多的朋友!

今天来给大家分享一下unity加载与链表,由于上一讲已经把加载说过了,所以这次我们就来说一下关于链表的问题,主要还是分享一下源代码,如果大家哪里有不懂的地方,可以在社区里面提问,我会及时的做出解答。

Unity 用C#写的链表类用于保存坐标点

1. using UnityEngine;

2. using System;

3. using System.Collections;

4.

5. /// <summary>

6. /// 结点类

7. namespace CS

8. {

9. /// </summary>

. public class ListNode

. {

. public Vector3 data; //ElemType

. public ListNode(){} // 构造函数

. public ListNode next;

. }

.

. /// <summary>

. /// 链表类

. /// </summary>

. public class LinkList{

.

. private ListNode first; //第一个结点

. public LinkList(){

. first = null;

. }

.

. public bool IsEmpty()

. {

. return first == null;

. }

.

.

. /// <summary>

. /// 在第k个元素之后插入x

. /// </summary>

. /// <param name="k"></param>

. /// <param name="x"></param>

. /// <returns></returns>

. public LinkList Insert( int k, Vector3 x )

. {

. if( k<0 )

. return null;

. ListNode pNode = first; //pNode将最终指向第k个结点

. for( int index = 1; index<k && pNode != null; index&#;&#; )

. pNode = pNode.next;

. if( k>0 && pNode == null )

. return null;//不存在第k个元素

. ListNode xNode = new ListNode();

. xNode.data = x;

. if( k>0 )

. {

. //在pNode之后插入

. xNode.next = pNode.next;

. pNode.next = xNode;

. }

. else

. {

. //作为第一个元素插入

. xNode.next = first;

. first = xNode;

. }

. return this;

. }

.

. public int Length()

. {

. ListNode current = first;

. int length = 0;

. while(current != null)

. {

. length&#;&#;;

. current = current.next;

. }

. return length;

. }

.

. /// <summary>

[置顶]
        unity加载与链表([置顶]bilinovel)

. /// 返回第k个元素至x中

. /// </summary>

. /// <param name="k"></param>

. /// <param name="x"></param>

. /// <returns>如果不存在第k个元素则返回false,否则返回true</returns>

. public bool Find( int k, ref Vector3 x )

. {

. if( k<1 )

. return false;

. ListNode current = first;

. int index = 1;

. while( index<k && current != null )

. {

. current = current.next;

. index&#;&#;;

. }

. if( current != null )

. {

. x = current.data;

. return true;

. }

. return false;

. }

.

. /// <summary>

. /// 返回x所在的位置

. /// </summary>

. /// <param name="x"></param>

. /// <returns>如果x不在表中则返回0</returns>

. public int Search( Vector3 x )

. {

. ListNode current = first;

. int index = 1;

. while( current != null && current.data !=x )

. {

. current = current.next;

. index&#;&#;;

. }

. if(current != null)

. return index;

. return 0;

. }

.

. /// <summary>

. /// 删除第k个元素,并用x返回其&#;

. /// </summary>

. /// <param name="k"></param>

. /// <param name="x"></param>

. /// <returns></returns>

. public LinkList Delete( int k, ref Vector3 x )

. {

. //如果不存在第k个元素则引发异常

. if( k<1 || first == null )

. return null;

. ListNode pNode = first; //pNode将最终指向第k个结点

. //将pNode移动至第k个元素,并从链表中删除该元素

. if( k == 1 ) //pNode已经指向第k个元素

. first = first.next; //删除之

. else

. {

. //用qNode指向第k-1个元素

. ListNode qNode = first;

. for( int index=1; index< k-1 && qNode != null; index&#;&#; )

. qNode = qNode.next;

. if( qNode == null || qNode.next == null )

. return null;//不存在第k个元素

. pNode = qNode.next; //pNode指向第k个元素

. qNode.next = pNode.next; //从链表中删除第k个元素

. x = pNode.data;

. }

. return this;

. }

.

. // 清空链表

. public void Clear()

. {

. first = null;

. }

.

. }

}

unity4.5.3f3 和 Android的通信 packagecom.janlr.helloworld;importandroid.app.Activity;importandroid.content.Context;importandroid.content.Intent;importandroid.os.Bundle;importandroid.widget.Toast;importcom.unity3d.player.UnityPlaye

WWW封装共享 [复制链接] WWW其实很好用的。实测了,几百个的并发量毫无问题,相信,你的产品也没多少需要几百个的并发下载吧。WWW说白了就是个Unity3D对http请求的一个封装,

unity学习之摄像机的应用 unity学习,希望我的博客能给喜欢unity的朋友带来帮助今天学习了摄像机的应用,具体用途就是在游戏中,主角在行走时是远距离的跟随照射,当打怪物

标签: [置顶]bilinovel

本文链接地址:https://www.jiuchutong.com/biancheng/375805.html 转载请保留说明!

上一篇:C# Thread中函数如何设置参数(c#中thread的用法)

下一篇:unity4.5.3f3 和 Android的通信

  • 价税合计金额怎么算出税额
  • 增值税附加计入什么科目
  • 税务申报我的待办是空的
  • 建筑公司核定征收所得税怎么算
  • 补充医疗保险应享尽享方案
  • 公司授权给公司有风险吗?
  • 微信手续费发票可以抵扣吗?
  • 发放股票股利的账务处理
  • 住房公积金证书插上为什么登不进去
  • 收到合同款
  • 冲减成本费用会计分录
  • 视同销售存货账务处理方法是什么?
  • 辅导期一般纳税人预缴增值税
  • 普票开票开给个人怎么开
  • 合同预付款要不要开发票?
  • 购买固定资产的进口关税
  • 国税地税企业所得税划分
  • 出口收取佣金要开发票吗?
  • 源泉扣缴税率是多少
  • 金税盘全额抵扣分录怎么做
  • 生物性资产是什么
  • 个体不超过10万怎么交税
  • 支付法院执行款的账务处理
  • 亏损的递延所得税怎么理解
  • 清包工一般记取哪些费用
  • 理财认购申购
  • 财务中暂估入账会计分录
  • windows10如何重置密码
  • 网卡运行异常
  • 对外投资收益要交税吗
  • 简易计税分包抵减
  • 企业所得税可以税前扣除的
  • 如何防止win10自动重启
  • 工地安装监控哪个部门管
  • php中数组的常用函数及用法
  • 存货短缺的账务处理
  • 小规模纳税人销售货物税率是多少
  • windows 11 build 21996.1 dev
  • php可以和iis配合运行吗?
  • navicat的安装
  • 预提费用做账的会计分录
  • pandas模块的主要特点
  • 公司旅游费会计分录
  • 2个公司的法人怎么注销
  • 定期定额个税申报应税项和计税依据为什么不相等
  • 印花税技术服务合同包括哪些
  • 收到银行开具的利息发票怎么做账
  • 以前年度损益调整怎么做账
  • 销售货物的收入计入什么科目
  • 主营业务收入净额在利润表里怎么看
  • 一般纳税人企业所得税税率多少
  • 劳务派遣公司差额征税怎么做账
  • 房屋维修基金交给哪个部门
  • 购建固定资产属于投资活动吗
  • 可转债公允价值变动计入
  • 股东分红算不算成本费用
  • 银行账和实际金额对不上
  • Windows Server 2008禁止模块安装提升网络性能
  • 如何远程重装系统教程
  • win10一直显示正在配置更新
  • 360杀毒恢复区
  • 使用windows防火墙禁止软件联网
  • win7旗舰版显示器亮度调节
  • windows8.1升级win10
  • mac如何设置wifi热点
  • Linux驱动程序开发视频教程
  • win8 设置
  • WIN10更新失败
  • 怎么恢复手机桌面时间和日期
  • opengl绘制函数
  • js传参数有长度限制
  • nodejs mongoose
  • javascript基础入门视频教程
  • python怎么画子图
  • 带领大家学习javascript基础篇(一)之基本概念
  • 湖北国税发票真伪查询
  • 广东省电子居住证怎么查看
  • 餐饮专票可以抵扣吗
  • 建筑工程开票要在项目所在地
  • 武汉市第二税务稽查局地址
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设