ShootCircle
How do I use Shoot Circle
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
132 | Enemy_01_ShootCircle(); | 1 |
136 | void Enemy_01_ShootCircle() | 2 |
File name: Enemy.cs
Copy
127 IEnumerator ShootingRoutine_01()
128 {
129 for (int i = 0; i < 2; i++)
130 {
131 yield return new WaitForSeconds(1f);
132 Enemy_01_ShootCircle();
133 }
134 }
File name: Enemy.cs
Copy
136 void Enemy_01_ShootCircle()
137 {
138 int bulletSpeed = 2;
139
140 GameObject bullet = pools.GetPoolableObject("e_bullet");
141
142 Vector3 direction = new Vector3(0,0,-1);
143
144 //
145 for (int i = 0; i < 32; i++)
146 {
147 bullet = pools.GetPoolableObject("e_bullet");
148 if (bullet == null)
149 {
150 continue;
151 }
152
153 bullet.SetActive(true);
154 bullet.GetComponent
155
156 //creat circle of bullets
157 if (direction.x < 1 && direction.z == -1)
158 direction.x += 0.25f;
159 else if (direction.z < 1 && direction.x == 1)
160 direction.z += 0.25f;
161 else if (direction.x > -1 && direction.z == 1)
162 direction.x -= 0.25f;
163 else if (direction.x == -1 && direction.z > -1)
164 direction.z -= 0.25f;
165 }
166 }
ShootCircle 123 lượt xem
Gõ tìm kiếm nhanh...