unity3d+moba+ Skill Indicator (i)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.