位置: 编程技术 - 正文

[置顶] 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的通信

  • 代扣代缴个人所得税会计分录怎么做
  • 公司购入烟酒会计处理
  • 金税四期有什么优势
  • 只有费用没有收入成本怎么填所得税
  • 个税系统如何增员
  • 增值税加计扣除账务处理
  • 同一投资主体内部所属企业之间土地,房屋权属的划转
  • 免征增值税发票税率
  • 一般纳税人公司是什么型企业
  • 商贸企业收到的检测费可以抵扣进项税吗
  • 小规模纳税人不允许开具零税率发票
  • 出口退税退的是进项税还是销项税
  • 暂估入库的材料需要做T型账户嘛?
  • 税务局退的教育费附加怎么做账
  • 转账时开户行写错了钱转出去了对方收不到
  • 售后回租业务的会计分录
  • 不动产进项税抵扣规定2016
  • 公司购买汽车的购置税怎么做账
  • 办公车辆的燃油费过路费怎么报销?
  • 705元大写金额怎么写的
  • 营改增建筑业税率变化时间
  • 当月凭证做完怎么结转?
  • linux如何开启端口
  • 购货方收到红字发票计入进项税转出还是进项税额负数?
  • win11电脑屏幕倒过来了怎么办
  • 零售企业退货分录
  • php获取中文字符串长度
  • php阿里云oss
  • vue引用svg矢量图
  • 软件企业享受增值服务
  • ai线型工具介绍
  • before跟after区别
  • lnewusers命令 创建用户账号
  • 帝国cms8.0
  • 居间协议合同范本完整版
  • 外币存款利息税
  • php 清除缓存
  • 网上申报完还需要去税务局吗
  • python文档怎么查看
  • mysql5.0升级到8.0
  • 印花税计税金额是主营业务收入吗
  • 房屋出租收入是其他业务收入吗
  • 制作海报属于什么行业
  • 受托代销商品的代销方式有哪两种
  • 当月开的票必须开发票吗
  • 京东提现到公账怎么取消
  • 销售折扣销售方会计处理
  • 外币账户结汇至人民币账户
  • 货物赔偿款怎么做账
  • 高新技术企业进项税加计扣除10%如何填企业所得税季报
  • 住院发票能否用医保卡
  • 建筑业简易征收税率5%
  • 食品加工企业成本核算方法和流程
  • 车辆折旧费法律支持吗
  • 盈余公积是资产类科目吗
  • 企业的管理费用包括
  • 数据库设计三大范式
  • sql server中千万数量级分页存储过程代码
  • 便签windows
  • win8怎么锁定屏幕
  • winxp系统任务栏不见了
  • centos直接安装
  • lsass.exe
  • cygwin在Windows8.1中设置ssh无密码登录
  • win10累积更新 卡住
  • linux vim
  • windows 8whql
  • win7能用多屏协同吗
  • dosbox批处理
  • 使用jquery实现的项目
  • Android 开源项目集合
  • 如何用css画三角形
  • javascript有哪些常用的属性和方法
  • python爬虫入门教程
  • android基础知识
  • 圣诞树代码html
  • js如何使用
  • 深圳地税电子税务局
  • 河南掌上登记手机号换了,登录不进去怎么办
  • 地税网上申报密码
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设