当前位置:网站首页>Unity3D+moba+技能指示器(一)
Unity3D+moba+技能指示器(一)
2022-07-23 05:45:00 【四夕立羽】
1 功能描述
类似王者荣耀,按下的技能如果是需要预判的或者是可以选择单一目标,产生一个摇杆,在地形上显示辅助的UI提示。存在以下几种情况:
1.扇形范围技能

2.方向性技能

3.指向范围性技能

4.指向技能

这些地形上的UI提示共性是:1.外围大圈的范围;2.内圈UI具有大小,方向,范围角度的特点
2 详细设计
要点:
1.所有英雄的技能数量都是固定的,开始战斗时,读表载入技能。
2.Ui上技能摇杆每个都是固定,对应该英雄的第几个技能
3.技能属性有id,施法范围(大圆半径),影响范围(内圈),技能提示种类
4.每个技能摇杆要装填相对应的技能信息。
2.1指向范围性技能
主要是摇杆上thumb与bg的相对位置转化为技能提示器上PointRange与bg
的相对位置,然后设置PointRange的loaclPosition即可。如图所示,技能会攻击上方的敌人。

2.2方向性技能
得到摇杆thumb相对bg位置localPosition的标准化向量,然后改变Direction的方向即可。如图所示,技能会攻击下方敌人。

当摇杆移动时,方向性技能和指向范围性指示器调用如下代码:
/// <summary>
/// 指示器位置更新
/// </summary>
/// <param name="skill">摇杆上绑定的技能信息</param>
/// <param name="dir">摇杆方向向量</param>
/// <param name="obj">激活的类型指示器</param>
public void hintUpdate(SkillCtrl skill, Vector2 dir, GameObject obj)
{
float bgRange = skill.m_disRange;//施法距离
Vector3 scale = m_bg.transform.localScale;
scale.x = bgRange * 0.1f * 2.0f;
scale.z = scale.x;
m_bg.transform.localScale = scale;
float smallRange = skill.m_smallRange;//影响范围
Vector3 scaleSmall = Vector3.zero;
if (skill.m_hintType == enSkillHintType.PointRange)
{
scaleSmall.x = 0.1f * smallRange * 2.0f;
scaleSmall.z = scaleSmall.x;
}
else
{
scaleSmall.x = 0.1f * smallRange;
scaleSmall.z = 1.0f;
}
scaleSmall.y = 1.0f;
obj.transform.localScale = scaleSmall;
if (skill.m_hintType == enSkillHintType.PointRange )
obj.transform.localPosition = new Vector3(dir.x * bgRange, 0, dir.y * bgRange );
else
{
Vector3 posWorld = obj.transform.position;
obj.transform.LookAt(new Vector3(posWorld.x + dir.x, posWorld.y, posWorld.z + dir.y));
}
}边栏推荐
- 钢结构复习题
- Interpretation of the paper: "i4mc deep: intelligent prediction of N4 methylcytosine sites using deep learning methods with chemical properties"
- 队列与堆的相互实现(纯c实现)
- Prometheus Operator使用指南笔记
- *offer--2
- [learning summary]
- Switch implements expression evaluation
- 配置历史版本Detectron遇到的问题
- Summary of video coding and decoding related data
- 二叉树的实现-c
猜你喜欢

【Autosar DEM 四.Event Memory】

Interpretation of the paper: develop and verify the deep learning system to classify the etiology of macular hole and predict the anatomical results

Blog building 4: how to add your blog to Baidu and Google

Redis——配置及应用

鋼結構基本原理複習

常见的排序—交换排序

【Autosar 存储Stack NVM】

Implementation of heap and heap sorting

Axure实现增删改查

常见的排序方法—选择排序
随机推荐
队列与堆的相互实现(纯c实现)
A comprehensive and detailed summary of the basic principles of steel structure
Review of basic principles of steel structure
基于UDP的群聊聊天室
【AUTOSAR CanDrive 1.学习CanDrive的功能和结构】
[AUTOSAR DEM iv.event memory]
比较临时的修改node_modules内包的源码并编译引用 修改依赖包
钢结构基本原理试题及答案
3.2daydayup举一反三:三天打鱼两天晒网式学习
Dynamic programming - "coin exchange problem"
C语言:基于顺序表的学生管理系统,超级详细,全部都有注释,看完不懂来扇我。
钢结构复习题
用单向链表实现 队列
Related repo of synthetic Chinese recognition dataset
Anconda安装的pytorch依赖的cuda版本和系统cuda版本不一致问题
合成中文识别数据集的相关repo
TeX or LaTeX or MikTeX or TeX Live or CTeX
[CAN总线的物理层 ]1.CAN/CANFD采样的点的内容分享
Simply realize the function of stack
Embedded from entry to mastery (buried) - sharing of ultra detailed knowledge points 2