//自機を斜面に合わせて回転させる private void Rotate_Player() { AngleCalculater _angle = new AngleCalculater(); float angle = _angle.Cal_Angle_Two_Points(transform.position, player.transform.position); player.transform.rotation = Quaternion.Euler(0, 0, angle - 90f); }
/// <summary> /// 偶数弾 /// </summary> public List <GameObject> Even_Num_Shoot() { List <GameObject> bullet_List = new List <GameObject>(); GameObject player = GameObject.FindWithTag("PlayerTag"); if (player == null) { Debug.Log("Can't Find Player"); return(null); } AngleCalculater _angle = new AngleCalculater(); center_Angle_Deg = _angle.Cal_Angle_Two_Points(transform.position + (Vector3)offset, player.transform.position); float angle = center_Angle_Deg - ((num - 1) * 0.5f * inter_Angle_Deg); for (int i = 0; i < num; i++) { bullet_List.AddRange(Turn_Shoot_Bullet(angle)); angle += inter_Angle_Deg; } if (default_Shoot_Sound) { UsualSoundManager.Instance.Play_Shoot_Sound(); } return(bullet_List); }
private IEnumerator Wing_Shoot_Cor() { //変数取得 GameObject player = GameObject.FindWithTag("PlayerTag"); AngleCalculater AC = new AngleCalculater(); ShootSystem[,] shoots = new ShootSystem[5, 2]; for (int i = 0; i < 5; i++) { shoots[i, 0] = wing_Shoot_Obj.transform.GetChild(i).GetComponents <ShootSystem>()[0]; shoots[i, 1] = wing_Shoot_Obj.transform.GetChild(i).GetComponents <ShootSystem>()[1]; } //ショット while (true) { float angle = AC.Cal_Angle_Two_Points(transform.position, player.transform.position); for (int i = 0; i < 5; i++) { shoots[i, 0].center_Angle_Deg = angle - 80; shoots[i, 1].center_Angle_Deg = angle + 80; shoots[i, 0].Shoot(); shoots[i, 1].Shoot(); } yield return(new WaitForSeconds(3.4f)); } }
//フェーズ1緑弾 public IEnumerator Shoot_Green_Bullet_Cor(int count) { for (int i = 0; i < count; i++) { //自機の位置を確認 AngleCalculater angle_Cal = new AngleCalculater(); float player_Angle = angle_Cal.Cal_Angle_Two_Points(transform.position, player.transform.position); //ショット for (int j = 0; j < 4; j++) { Shoot_Green_Bullet_4way(j, player_Angle); UsualSoundManager.Instance.Play_Shoot_Sound(0.07f); yield return(new WaitForSeconds(0.3f)); } yield return(new WaitForSeconds(0.3f)); } }
//移動先計算 //自機を中心にGO_AROUND_ANGLE_DEG度回転 private Vector2 Cal_Destination() { float radius = START_ATTACK_DISTANCE; float angle = new AngleCalculater().Cal_Angle_Two_Points(player.transform.position, transform.position); int direction = 1; if (transform.position.y < 0 && transform.position.x < player.transform.position.x) { direction = -1; } else if (transform.position.y > 0 && transform.position.x > player.transform.position.x) { direction = -1; } angle = (angle + GO_AROUND_ANGLE_DEG * direction) * Mathf.Deg2Rad; Vector2 destination = player.transform.position + new Vector3(Mathf.Cos(angle), Mathf.Sin(angle)) * radius; return(destination); }
private IEnumerator Reverse_Wing_Shoot_Cor(float span) { GameObject player = GameObject.FindWithTag("PlayerTag"); if (player == null) { yield break; } ShootSystem[] shoots = wing_Shoot_Reverse_Obj.GetComponents <ShootSystem>(); AngleCalculater AC = new AngleCalculater(); while (true) { float angle = AC.Cal_Angle_Two_Points(transform.position, player.transform.position); shoots[0].center_Angle_Deg = angle - 10f; shoots[1].center_Angle_Deg = angle + 10f; shoots[0].Shoot(); shoots[1].Shoot(); yield return(new WaitForSeconds(span)); } }