/// <summary> /// エフェクトの生成 /// </summary> /// <param name="type">エフェクトの種類</param> /// <returns>成功ならエフェクト、失敗したらnull</returns> public override GameObject Create(StgEffectConstant.Type type) { if (type == StgEffectConstant.Type.kExplosion) { GameObject effect = (GameObject)Resources.Load(SceneShare.Instance.GetGameResourcePathData().Get(GameResourcePathDefine.Type.kExplosionPrefab)); MhCommon.Assert(effect != null, "StgEffectFactory::Create() kExplosion null"); return(effect); } else if (type == StgEffectConstant.Type.kExplosion002) { GameObject effect = (GameObject)Resources.Load(SceneShare.Instance.GetGameResourcePathData().Get(GameResourcePathDefine.Type.kExplosion002Prefab)); MhCommon.Assert(effect != null, "StgEffectFactory::Create() kExplosion002 null"); return(effect); } else if (type == StgEffectConstant.Type.kExplosion003) { GameObject effect = (GameObject)Resources.Load(SceneShare.Instance.GetGameResourcePathData().Get(GameResourcePathDefine.Type.kExplosion003Prefab)); MhCommon.Assert(effect != null, "StgEffectFactory::Create() kExplosion003 null"); return(effect); } else { // kUnknownもしくは定義されているが実装されていないtypeが指定された MhCommon.Assert(false, "StgEffectFactory::Create() StgEffectConstant.Type invalid type=" + type); return(null); } }
/// <summary> /// やられた時のエフェクトタイプをランダム生成する /// </summary> /// <param name="x">エフェクトのX座標</param> /// <param name="y">エフェクトのY座標</param> private void CreateRandomEffect(float x, float y) { StgEffectFactory factory = new StgEffectFactory(); MhCommon.Assert(factory != null, "NormalEnemy::CreateRandomEffect() StgEffectFactory null"); RandomIntegerSystem random = new RandomIntegerSystem(); MhCommon.Assert(random != null, "NormalEnemy::CreateRandomEffect() RandomIntegerSystem null"); int value = random.Get(1, 3); StgEffectConstant.Type type = StgEffectConstant.Type.kExplosion; MhCommon.Assert((value >= 1) && (value <= 3), "NormalEnemy::CreateRandomEffect() random range failure"); if (value == 1) { type = StgEffectConstant.Type.kExplosion; } else if (value == 2) { type = StgEffectConstant.Type.kExplosion002; } else { type = StgEffectConstant.Type.kExplosion003; } GameObject effect = factory.Create(type); MhCommon.Assert(effect != null, "NormalEnemy::CreateRandomEffect() effect null"); Instantiate(effect, new Vector3(x, y, 0), Quaternion.identity); }
/// <summary> /// エフェクトの生成 /// </summary> /// <param name="type"></param> /// <returns></returns> public abstract GameObject Create(StgEffectConstant.Type type);