/// <summary> /// Init /// </summary> protected void Init(uint batteryId, uint barrelId, uint bulletId) { this.batteryData = Masters.BatteryDB.FindById(batteryId); this.barrelData = Masters.BarrelDB.FindById(barrelId); this.bulletData = Masters.BulletDB.FindById(bulletId); this.fvAttackData = Masters.FvAttackDB.FindById(this.batteryData.fvAttackId); this.turretBase.batteryKey = this.batteryData.key; this.turretBase.barrelKey = this.barrelData.key; this.turretBase.bulletKey = this.bulletData.key; this.loader.Add<GameObject>(SharkDefine.GetBatteryPrefabPath(this.turretBase.batteryKey)); this.loader.Add<GameObject>(SharkDefine.GetBarrelPrefabPath(this.turretBase.barrelKey)); this.loader.Add<BulletBase>(SharkDefine.GetBulletPrefabPath(this.turretBase.bulletKey)); this.fvaAsset = this.loader.Add<FvAttackBase>(SharkDefine.GetFvAttackPrefabPath((FvAttackType)this.fvAttackData.type)); this.fvaBulletAsset = this.loader.Add<BulletBase>(SharkDefine.GetFvAttackBulletPrefabPath(this.fvAttackData.key)); this.loader.Add<Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)this.fvAttackData.type)); this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(this.barrelData.seName)); this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(this.bulletData.seName)); string fvAttackSeName = SeName.FvAttackSeName[(int)this.fvAttackData.type]; if (!string.IsNullOrEmpty(fvAttackSeName)) { this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(fvAttackSeName)); } if (this.fvAttackData.type == (uint)FvAttackType.Penetration) { this.fvaPenetrationChargeEffectAsset = this.loader.Add<GameObject>(SharkDefine.GetFVAChargeEffectPrefabPath(this.fvAttackData.key)); } }
/// <summary> /// 弾丸生成 /// </summary> private void CreateBullet(BulletDto data) { var prefab = data.isNormalBullet ? this.turretBase.bulletPrefab : AssetManager.FindHandle <BulletBase>(SharkDefine.GetFvAttackBulletPrefabPath(this.fvAttackData.key)).asset as BulletBase; data.bulletBase = this.turretBase.CreateBullet(prefab, BattleGlobal.instance.bulletArea); data.bulletBase.gameObject.AddComponent <BulletBouncing>(); data.bulletBase.movement.timeStamp = data.timeStamp; data.bulletBase.movement.speed = data.speed; data.bulletBase.transform.localPosition = this.cachedTransform.localRotation * data.bulletLocalPosition; data.bulletBase.transform.rotation = this.cachedTransform.localRotation * Quaternion.Euler(data.bulletLocalEulerAngles); data.bulletBase.SetParticleLayer(BattleGlobal.instance.bulletCanvas); this.bulletList.Add(data); }