自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 queue的实现

using System.Collections;using System.Collections.Generic;using UnityEngine;public class 实现队列 : MonoBehaviour{ class MyQueue { class QueueData { public QueueData nextItem; public object topData;

2021-08-20 20:30:46 77

原创 stack的实现

using System.Collections;using System.Collections.Generic;using UnityEngine;public class 实现栈 : MonoBehaviour { class MyStack { class StackData { public StackData nextItem; public object topData;

2021-08-20 20:16:22 64

原创 数据结构_queue

using System.Collections;//队列在此空间using System.Collections.Generic;using UnityEngine;public class 队列 : MonoBehaviour { //先进先出 Queue queue=new Queue(); Queue<int> queue2=new Queue<int>(); void Start() { queue.Enq

2021-08-20 19:52:21 56

原创 数据结构_stack

using System.Collections;using System.Collections.Generic;using UnityEngine;public class 堆栈 : MonoBehaviour { //stack 先进后出的对象集合 Stack st1 = new Stack(); void Start() { st1.Push("a"); st1.Push("b"); st1.Push("c")

2021-08-20 16:56:48 65

原创 数据结构_链表

using System.Collections;using System.Collections.Generic;//LinkedList LinkedListNode在该空间using UnityEngine;public class 链表 : MonoBehaviour { //双向链表 LinkedList<int> linList = new LinkedList<int>(); LinkedListNode<int> node

2021-08-20 16:25:28 72

原创 数据结构_hashset

using System.Collections;using System.Collections.Generic;using UnityEngine;public class 哈希set : MonoBehaviour { //包含不重复项的无序列表 HashSet<int> hs1 = new HashSet<int>(); HashSet<int> hs2 = new HashSet<int>(); void S

2021-08-20 15:50:42 58

原创 数据结构_hashtable

using System.Collections;using System.Collections.Generic;using UnityEngine;public class 哈希Table : MonoBehaviour { Hashtable ht1 = new Hashtable(); // Use this for initialization void Start () { ht1.Add("1", 100); ht1.Add(1, 99);

2021-08-20 11:04:58 57

原创 arrayList(动态数组)&List<>——两者十分相似

//动态数组(ArrayList)对象的有序集合//动态数组会自动重新调整它的大小//可以使用索引在指定的位置添加和移除项目,它也允许在列表中进行动态内存分配ArrayList arraylist1=new ArrayList();int[]array1=new int[]{1,2,3,4};void Start(){ arraylist1.Add(45); arraylist1.Add(25); arraylist1.Add(12); Debug.Log(arraylist1[0]);

2021-08-20 09:44:13 113

原创 array数组

//数组是用来存储数据的集合//1 元素类型相同//2 固定长度//3 顺序集合int[]array1;int[]array2 = new int[3]{1,2,3};int[]array3 = {1,2,3,4,5};private void Start(){ array1=new int[3]; Debug.Log(array1[0]); array1[0]=5; Debug.Log(array1[0]); Debug.Log("***********"); Debug.

2021-08-20 08:51:39 64

原创 鼠标滚轮控制缩放

public class Wheel : MonoBehaviour { public Camera cam; void Update() { //鼠标滚轮的效果 //Camera.main.fieldOfView 摄像机的视野 //Camera.main.orthographicSize 摄像机的正交投影 //Zoom out if (Input.GetAxis("Mouse ScrollWheel")

2021-08-13 14:36:30 198

原创 timer计时器|C#_OnGUI

public class timer : MonoBehaviour { private float timer0 = 0f; private int h = 0;//小时 private int m = 0;//分钟 private int s = 0;//秒 private string timeStr = string.Empty; void Update() { timer0 += Time.deltaTime;

2021-08-13 14:34:56 71

原创 [unity]InvalidOperationException: Collection was modified; enumeration operation may not execute.

如下,foreach中不能修改处理的集合否则就会报:InvalidOperationException: Collection was modified; enumeration operation may not execute.// An highlighted block foreach (var item in items) { items.Add(item);//不可 items.Remove(item);//不可

2021-07-07 10:19:54 1091 1

原创 点击UI以外的区域触发事件

下面展示一些 内联代码片。using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;using UnityEngine.UI;public class CubeClick : MonoBehaviour, IPointerClickHandler{ private GraphicRaycaster _raycaster;

2020-12-10 20:20:38 201

原创 另一种拖拽实现方式

下面展示一些 内联代码片。注意引用EventSystems命名空间using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;public class Test : MonoBehaviour, IDragHandler{ public void OnDrag(PointerEventData eventData) {

2020-12-10 16:42:41 89

原创 unity选择事件接口&其他部分接口

下面展示一些 内联代码片。// 注意引入EventSystems命名空间using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;public class Test : MonoBehaviour,ISelectHandler,IDeselectHandler,IUpdateSelectedHandler{ publ

2020-12-10 15:46:01 356

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除