随笔分类 -  unity_GamePlay

GamePlay
摘要:使用Json存储在在本地 using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using Newtonsoft.Json; using System; usin 阅读全文
posted @ 2021-05-29 19:19 wsfw 阅读(247) 评论(0) 推荐(0)
摘要:许多单机游戏都带有游戏内按键修改功能,今天就来实现一个。其本质上还是对KeyCode 进一步封装。 配置简单方便如下图: 我将按键分为3种: 1、按下或持续按下会触发。 2、带有值的输入,当按下时会持续增加,松开时会不断减少,值会有一个范围,超出范围将会是边界那个值。 3、类似Horizontal 阅读全文
posted @ 2021-04-05 15:11 wsfw 阅读(2329) 评论(0) 推荐(0)
摘要:挂载MapBoxColider的物体Position 设置为0,0,0,总体没什么难度。 using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraControl 阅读全文
posted @ 2021-04-02 23:04 wsfw 阅读(201) 评论(0) 推荐(0)
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class Cameracontroller : MonoBehaviour { public fl 阅读全文
posted @ 2021-03-22 09:09 wsfw 阅读(62) 评论(0) 推荐(0)
摘要:从UE4资产操作导出fbx,直接导入unity角色的朝向不对(角色趴在地上走)。 UE4的坐标是以z轴朝上,x朝前,y轴朝右,unity 的坐标是以y轴朝上,z轴朝前,x轴朝右。 只需将角色模型导入blender等DCC软件,原封不动的导出(可能是DCC软件在导入Fbx模型会重新计算坐标),再导入u 阅读全文
posted @ 2021-02-27 16:46 wsfw 阅读(1620) 评论(0) 推荐(0)
摘要:配合上眼睛转动看向相机,就可以给角色赋予灵魂。 使用控制骨骼旋转。 首页先要将骨骼Offset调整合适和值,使 控制物体的旋转轴分别对应角色的旋转方向。 然后通过计算相机和角色不同方向的角度,赋予ik控制对象,控制骨骼旋转。 代码如下: using System.Collections; using 阅读全文
posted @ 2021-02-20 22:36 wsfw 阅读(269) 评论(0) 推荐(0)
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class MiniMap : MonoBehaviour { public Transform miniMapRange; p 阅读全文
posted @ 2021-02-18 20:03 wsfw 阅读(447) 评论(0) 推荐(0)
摘要:支持按键输入WASD,带有方向指示 脚本挂在Handle上,其它的设置 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Eve 阅读全文
posted @ 2021-02-18 18:38 wsfw 阅读(166) 评论(0) 推荐(0)
摘要:AI控制,AI物体挂载,负责通过视觉/听觉侦查的敌人,记录寻路点。 using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class AICon 阅读全文
posted @ 2021-02-07 22:23 wsfw 阅读(83) 评论(0) 推荐(0)
摘要:AIManager 管理所有阵营的AI using System.Collections; using System.Collections.Generic; using UnityEngine; public enum Camp{ Player, Enemy, NPC, Build } publi 阅读全文
posted @ 2021-02-07 22:18 wsfw 阅读(134) 评论(0) 推荐(0)
摘要:编写一个KeyCodeListener Playables 实现主要细节(使用到插件odin) 1.针对不同按键操作有不同应对方式:比如正常按下,长按,组合按键 2.将动画片段帧分为可输入帧范围和执行成功输入的可执行的帧范围 3.利用编辑器通过枚举控制编辑器属性显示隐藏。 [Serializable 阅读全文
posted @ 2021-02-03 21:44 wsfw 阅读(225) 评论(0) 推荐(0)
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShowCapsuleColider : MonoBehaviour { //画线用的材质球 Material li 阅读全文
posted @ 2021-02-03 15:20 wsfw 阅读(461) 评论(1) 推荐(0)
摘要:原文地址: https://blog.csdn.net/amnrwlm8593/article/details/102253392/ Bounds bounds = GetComponent<BoxCollider>().bounds; Vector3 v3Center = bounds.cente 阅读全文
posted @ 2021-02-03 14:21 wsfw 阅读(291) 评论(0) 推荐(0)
摘要:using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShowSphereColider : MonoBehaviour { //画线用的材质 阅读全文
posted @ 2021-02-03 14:10 wsfw 阅读(284) 评论(0) 推荐(0)
摘要:第一行属性名字,第二行 类型。 对于自定义类型需要在 TypeSetValue<T> 添加对应类型的转换。 tableIndex 指的是Excal下图表的索引。 //读取Excal public static List<T> ReadExcal<T>(string path,int tableInd 阅读全文
posted @ 2021-01-30 17:09 wsfw 阅读(90) 评论(0) 推荐(0)
摘要:Excal格式要求 第一行是类型名 第二行是类型 例如: string name; string是类型,name是类型名。 具体代码 [MenuItem("Tools/ExcalToModel.cs")] public static void GenerationModel() { string s 阅读全文
posted @ 2021-01-30 15:18 wsfw 阅读(227) 评论(0) 推荐(0)
摘要:状态基类:所有状态继承自它 public abstract class IState { public virtual AnimState selfState { get; } public abstract int animHash { get; } public virtual void Ent 阅读全文
posted @ 2021-01-28 17:33 wsfw 阅读(84) 评论(0) 推荐(0)
摘要:using UnityEngine; public class PlayerCamera3rd : MonoBehaviour { Vector3 m_defaultDir; Transform m_PlayerTransform; Vector3 m_RotateValue; Vector3 m_ 阅读全文
posted @ 2021-01-28 17:25 wsfw 阅读(126) 评论(0) 推荐(0)
摘要:跟着CatLike大神的教程敲了一遍,记录下学习心得。地址:https://catlikecoding.com/unity/tutorials/ 通过刚体移动。 一、复合运算符赋值 desiredJump ,使 desiredJump在接受到按键输入后为True,直到主动赋值为false,它才为fa 阅读全文
posted @ 2021-01-25 13:37 wsfw 阅读(107) 评论(0) 推荐(0)
摘要:跟着CatLike大神的教程敲了一遍,记录下学习心得。地址:https://catlikecoding.com/unity/tutorials/ 通过Transform的position移动。 一、通过加速度限制运动物体的速度改变量可以使物体运动更平滑 float maxSpeedChange = 阅读全文
posted @ 2021-01-24 20:53 wsfw 阅读(161) 评论(0) 推荐(0)