private void _ChasingBullet(int count) { if (count % 30 != 0 || Time.timeScale <= 0f) { return; } Vector3 self = new Vector3(t.position.x, t.position.y, 0); if (MarisaTrans) { velocity = MarisaTrans.position - t.position; velocity.z = 0; velocity.Normalize(); } else { // 金发的孩子真可怜 velocity = new Vector3(0, -1, 0); //* flySpeed; } GameObject o = (GameObject)GameObject.Instantiate(bullet, self, t.rotation); EBullet e = o.GetComponent <EBullet> (); e.SetMarisa(Marisa); e.flySpeed = ChasingBulletSpeed; e.SetVelocity(velocity); }
private IEnumerator _Cirno() { const int radius = 2; const int deltaAngle = 15; Vector3 self = new Vector3(t.position.x, t.position.y, 0); Vector3 cirPos = new Vector3(); int angle = -180; for (int i = 0; i < 30; angle += deltaAngle, i++) { //for (; angle < 180; angle += deltaAngle) { //angle%= 180; cirPos.x = Mathf.Cos(angle / 180f * Mathf.PI); cirPos.y = Mathf.Sin(angle / 180f * Mathf.PI); cirPos.z = 0; cirPos *= radius; cirPos += self; // Chasing if (MarisaTrans) { velocity = MarisaTrans.position - cirPos; velocity.z = 0; velocity.Normalize(); } else { // 金发的孩子真可怜 velocity = new Vector3(0, -1, 0); //* flySpeed; } GameObject o = (GameObject)GameObject.Instantiate(bullet_r, cirPos, t.rotation); EBullet e = o.GetComponent <EBullet> (); e.SetMarisa(Marisa); e.flySpeed = CirnoBulletSpeed; e.SetVelocity(velocity); o.GetComponent <AudioSource>().Play(); yield return(null); } }