1function Description
Similar to the glory of kings, pressed skills if you need to pre-contract or can choose a single target, create a joystick to display the auxiliary UI hints on the terrain . There are several scenarios:
1. Fan Range Skills
2. Directional skills
3. pointing to the scope of the skill
4. Pointing to Skills
The commonality of UI hints on these terrains is:1. the range of the outer large circle; 2. the inner ring UI has the characteristics of size, direction, range angle
2Detailed Design
Points:
1. All heroes have a fixed number of skills, and when they start fighting, read the table loading skills.
2.Ui skill stick Each is fixed, the first few skills on the hero should be
3. Skill attribute has ID, cast range (circle radius), influence range (inner ring), skill tip type
4. Each skill stick should reload the corresponding skill information.
2.1pointing to the scope of the skill
The main is the rocker on the relative position of the thumb and BG into the skill cue on the pointrange and BG
The relative position of the Pointrange , and then set the loaclposition . , the skill will attack the enemy above.
2.2Directional Skills
Get the normalized vector of the joystick thumb relative to the BG position localposition , then change the Direction direction. , the skill will attack the enemy below.
When the joystick moves, the directivity skill and the pointer to the range indicator call the following code :
<summary>////Indicator location Update///</summary>//<param name= "Skill" > Skill information bound by joystick </param>// /<param name= "dir" > Rocker direction vector </param>//<param name= "obj" > Activated type Indicator </param> public void Hintup Date (Skillctrl skill, Vector2 dir, Gameobject obj) {float Bgrange = skill.m_disrange;//cast range Vector3 scal e = 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;//influence range 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)); } }
unity3d+moba+ Skill Indicator (i)