public void Attack() { //これはanimationから呼ばれる Debug.Log("Armor__Attack"); ShotPosition = this.transform.position; ShotPosition.x -= 0.3f; //この下の一行の存在を忘れて永遠に止まっていた許さんぞ過去の俺(許す // Instantiate(ArmorShot,ShotPosition ,Quaternion.identity); NowEnemyShot = Instantiate(ArmorShot, this.transform.position, this.transform.rotation) as GameObject; if (ArmorShot != null) { EnemyShot S = NowEnemyShot.GetComponent <EnemyShot>(); S.Create(360, -ShotSpeed); } }
/* void Candle_Attack() * { * NowEnemyShot = Instantiate(CandleShot, this.transform.position, this.transform.rotation) as GameObject; * if (CandleShot != null) * { * EnemyShot S = NowEnemyShot.GetComponent<EnemyShot>(); * S.Create(angle,ShotSpeed); * } * }*/ IEnumerator Candle_Attack() { while (true) { NowEnemyShot = Instantiate(CandleShot, this.transform.position, this.transform.rotation) as GameObject; if (CandleShot != null) { EnemyShot S = NowEnemyShot.GetComponent <EnemyShot>(); S.Create(angle, ShotSpeed); angle += 60.0f; angle %= 360.0f; if (angle <= 180) { transform.rotation = Quaternion.Euler(0, 0, 0); } else { transform.rotation = Quaternion.Euler(0, 180, 0); } } yield return(new WaitForSeconds(0.5f)); } }