void Start() { LGPScript = GetComponent <LoadGunPrefab>(); switch (gunType) { case GunInfo.GunType.AssaultRifle: GunObj = LGPScript.AssaultRifle; break; case GunInfo.GunType.HandGun: GunObj = LGPScript.HandGun; break; case GunInfo.GunType.LightMachineGun: GunObj = LGPScript.LightMachineGun; break; case GunInfo.GunType.ShotGun: GunObj = LGPScript.ShotGun; break; case GunInfo.GunType.SubMachineGun: GunObj = LGPScript.SubMachineGun; break; case GunInfo.GunType.GrenadeLauncher: GunObj = LGPScript.GrenadeLauncher; break; case GunInfo.GunType.FlameThrower: GunObj = LGPScript.FlameThrower; break; } // ※※※※※※※※※※※※※※※※※※※※※※※※※※※※ // 修正した方がいいかも // ※※※※※※※※※※※※※※※※※※※※※※※※※※※※ MagazineSize = GunObj.GetComponent <GunController>().MagazineSize; ammoMax = GunObj.GetComponent <GunController>().remAmmo; Damage = GunObj.GetComponent <GunController>().Damage; shootInterval = GunObj.GetComponent <GunController>().shootInterval; reloadInterval = GunObj.GetComponent <GunController>().reloadInterval; bulletPower = GunObj.GetComponent <GunController>().bulletPower; GunEXP = GunObj.GetComponent <GunController>().GunEXP; }
void Start() { GIScript = GetComponent <GunInfo>(); gunSprite = GetComponent <SpriteRenderer>(); LGPScript = GetComponent <LoadGunPrefab>(); // 子オブジェクトをリセットしてからパーティクルを出す foreach (Transform n in this.transform) { GameObject.Destroy(n.gameObject); } // 銃の種類を判別する switch (GIScript.gunType) { case GunInfo.GunType.AssaultRifle: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("AssaultRifle(Clone)"); // spriteをセット gunSprite.sprite = AssaultRifleSprite; break; case GunInfo.GunType.HandGun: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("HandGun(Clone)"); // spriteをセット gunSprite.sprite = HandGunSprite; break; case GunInfo.GunType.LightMachineGun: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("LightMachineGun(Clone)"); // spriteをセット gunSprite.sprite = LightMachineGunSprite; break; case GunInfo.GunType.ShotGun: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("ShotGun(Clone)"); // spriteをセット gunSprite.sprite = ShotGunSprite; break; case GunInfo.GunType.SubMachineGun: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("SubMachineGun(Clone)"); // spriteをセット gunSprite.sprite = SubMachineGunSprite; break; case GunInfo.GunType.GrenadeLauncher: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("GrenadeLauncher(Clone)"); // spriteをセット gunSprite.sprite = GrenadeLauncherSprite; break; case GunInfo.GunType.FlameThrower: // gunTypeを元にPrefabを取ってくる WeaponInfo = LGPScript.LoadGun("FlameThrower(Clone)"); // spriteをセット gunSprite.sprite = FlameThrowerSprite; break; } // 銃のランクを判別する switch (GIScript.gunRank) { case GunInfo.GunRank.Rank1: // エフェクトを生成 if (runkEffect == null) { runkEffect = Instantiate <GameObject>(Runk1EffectPrefab, transform.position, Quaternion.identity); runkEffect.transform.parent = this.transform; } break; case GunInfo.GunRank.Rank2: // エフェクトを生成 if (runkEffect == null) { runkEffect = Instantiate <GameObject>(Runk2EffectPrefab, transform.position, Quaternion.identity); runkEffect.transform.parent = this.transform; } break; case GunInfo.GunRank.Rank3: // エフェクトを生成 if (runkEffect == null) { runkEffect = Instantiate <GameObject>(Runk3EffectPrefab, transform.position, Quaternion.identity); runkEffect.transform.parent = this.transform; } break; } // 名前を変更する this.name = "Drop" + WeaponInfo.name; }
void Start() { CEScript = GetComponent <ChangeEquip>(); LGPScript = GetComponent <LoadGunPrefab>(); }