随笔分类 -  C#

摘要:1.创建一个新的空游戏对象,将代码挂载到它身上 2.创建脚本 3.将脚本挂载到物体身上 打印函数 using System.Collections; using System.Collections.Generic; using UnityEngine; //******************** 阅读全文
posted @ 2023-03-09 22:08 flyall 阅读(75) 评论(0) 推荐(0)
摘要:方法 阅读全文
posted @ 2023-03-08 21:46 flyall 阅读(34) 评论(0) 推荐(0)
摘要:面向对象 阅读全文
posted @ 2023-03-07 18:42 flyall 阅读(21) 评论(0) 推荐(0)
摘要:字符串 阅读全文
posted @ 2023-03-07 00:39 flyall 阅读(20) 评论(0) 推荐(0)
摘要:数组 阅读全文
posted @ 2023-03-07 00:27 flyall 阅读(26) 评论(0) 推荐(0)
摘要:C#语言的基本语法 阅读全文
posted @ 2023-03-06 21:57 flyall 阅读(57) 评论(0) 推荐(0)
摘要:保存按钮和加载按钮的实现 注册两个按钮 二进制方法存储 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using System.Runtime.Seria 阅读全文
posted @ 2023-03-06 01:35 flyall 阅读(71) 评论(0) 推荐(0)
摘要:新建脚本 using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class Save { public List<int> livingT 阅读全文
posted @ 2023-03-05 23:57 flyall 阅读(39) 评论(0) 推荐(0)
摘要:设置每一组target怪物的编号 TargetManager //18.设置target编号 public int targetPosition; 设置每一个怪物的编号 MonsterManager //13.设置怪物的编号 public int monsterType; 赋值 四个怪物 设置 us 阅读全文
posted @ 2023-03-05 21:54 flyall 阅读(284) 评论(0) 推荐(0)
摘要:存储背景音乐开关的状态 using System.Collections; using System.Collections.Generic; using UnityEngine; //2.获得UI using UnityEngine.UI; public class UIManager : Mon 阅读全文
posted @ 2023-03-05 20:34 flyall 阅读(21) 评论(0) 推荐(0)
摘要:Unity中使用的存档方式 PlayerPrefs:数据持久化方案 采用键值对的方式对数据进行存储 PlayPrefs.SetInt("Index",1); 可以存储Int Float String类型的数据 PlayPrefs.SetFloat("Height",183.5f); PlayPref 阅读全文
posted @ 2023-03-05 20:06 flyall 阅读(79) 评论(0) 推荐(0)
摘要:得到背景音乐选框 赋值 赋值 using System.Collections; using System.Collections.Generic; using UnityEngine; //2.获得UI using UnityEngine.UI; public class UIManager : 阅读全文
posted @ 2023-03-05 19:40 flyall 阅读(86) 评论(0) 推荐(0)
摘要:添加组件 选择文件 设置循环 给手枪添加音效 子弹和怪物碰撞 添加第二个音效 手枪开火 using System.Collections; using System.Collections.Generic; using UnityEngine; public class GunManager : M 阅读全文
posted @ 2023-03-05 18:08 flyall 阅读(164) 评论(0) 推荐(0)
摘要:file——>build setting 添加场景 阅读全文
posted @ 2023-03-05 16:04 flyall 阅读(20) 评论(0) 推荐(0)
摘要:点击新游戏按钮 所有数据刷新 创建一个空物体存放所有的Target怪 数据归零 将Target放入 ctrl+d复制一份 显示一个怪物并赋值一份target 让每个格子中存在一个怪 双击居中画面 using System.Collections; using System.Collections.G 阅读全文
posted @ 2023-03-05 15:40 flyall 阅读(117) 评论(0) 推荐(0)
摘要:菜单出来时 枪不能旋转 游戏需要暂停 创建空物体控制所有的游戏状态 创建脚本 using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : MonoB 阅读全文
posted @ 2023-03-05 15:08 flyall 阅读(684) 评论(0) 推荐(0)
摘要:创建面板 调整面板透明度 创建背景板 修改背景板颜色 修改背景板大小 按住shift键等比缩放 按住alt键根据中心缩放 创建button 按钮 创建声音开关 阅读全文
posted @ 2023-03-05 00:06 flyall 阅读(171) 评论(0) 推荐(0)
摘要:创建UItext画布 选择2D方便观察 设置字体位置和字体大小 字体颜色等 为UI建立脚本 获取对象 using System.Collections; using System.Collections.Generic; using UnityEngine; //2.获得UI using Unity 阅读全文
posted @ 2023-03-04 23:15 flyall 阅读(340) 评论(0) 推荐(0)
摘要:死亡动画播放后,下次射击之前消失 MonsterManager using System.Collections; using System.Collections.Generic; using UnityEngine; public class MonsterManager : MonoBehav 阅读全文
posted @ 2023-03-04 21:32 flyall 阅读(291) 评论(0) 推荐(0)
摘要:判断子弹是否打到怪物,怪物被碰撞后播放死亡动画 自己给bullet设置的tag 通过tag判断 using System.Collections; using System.Collections.Generic; using UnityEngine; public class MonsterMan 阅读全文
posted @ 2023-03-04 19:36 flyall 阅读(190) 评论(0) 推荐(0)