Brief introduction:
Thank:
This application uses the resources provided by the UNITY3D\2D mobile game development, the copyright belongs to its author, here thank the author. This application is based on two development of the original.
Enhanced Features:
1. Add 2s cd fuselage rotation, keep invincible when rotating, people block kill ...
2. Join the 0,5S CD tracking missile and the missile randomly strikes the target enemy.
3. Strengthen small aircraft AI, small aircraft with three flight modes, straight lines, sin curves, and tracking players. Randomly select flight modes at different probabilities.
Technical elements:
1. For player aircraft, a simple switch-case finite state machine is used.
2. For small aircraft AI use rain ai behavior tree.
3. The source package of the book is upgraded to unity5.0, and the mesh trigger bug of the upgrade is eliminated.
Player part state machine source code
void Normal () {if (Input.getmousebutton (1)) {state=playerstate.arounding;}} void Shoot () {m_superrate-= time.deltatime;if (m_superrate <= 0) {m_superrate=0.5f;instantiate (M_srocket, m_ Transform.position+new Vector3 (0.5f,0,0), m_transform.rotation); Instantiate (M_srocket, m_transform.position+new Vector3 ( -0.5f,0,0), m_transform.rotation);} M_rocketrate-= time.deltatime;if (m_rocketrate <= 0) {m_rocketrate = 0.1f;if (Input.getkey (KeyCode.Space) | | Input.getmousebutton (0)) {Instantiate (M_rocket, m_transform.position, m_transform.rotation); M_audio. Playoneshot (M_shootclip);}}} void CoolDown () {m_around-= time.deltatime;if (m_around <= 0) {m_around = 1f;state=playerstate.normal;}}
Enemyai behavior Tree:
GitHub Address
https://github.com/RonTang/ShootingGamex/
Unity aircraft vs. enhanced version