//----------------------------------------------------- // 球を飛ばす //----------------------------------------------------- void BulletShot(ScandalType type) { // 球のタイプ Bullet bullet = Instantiate(bulletPre, transformCache.position, Quaternion.identity); bullet.SelectType(type); // 飛ばす方向 Vector3 clickPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 dir = clickPos - transformCache.position; dir.y = 0; bullet.SetMoveDirection(dir.normalized); }
//----------------------------------------------------- // 球のタイプ変更 //----------------------------------------------------- public void SelectType(ScandalType type) { Type = type; GetComponent <MeshRenderer>().material = bulletMaterials[(int)type]; }