private void InitElectricEffect() { for (int i = 1; i < 4; i++) { var texture = contentManager.Load <Texture2D>("ElectricPoint" + i.ToString()); electricPointTextures.Add(texture); } electricEffect = new ElectricEffect(spriteBatch, electricPointTextures); electricEffect.Density = 15; electricEffect.EffectType = (App.Current as App).EffectType; int nodeCount = 10; for (int i = 0; i < (App.Current as App).ElectricFlowCount; i++) { ElectricFlow flow = electricEffect.AddFlow(LifeSpan); Vector2 position = new Vector2() { X = 240, Y = 50 }; for (int j = 0; j < nodeCount; j++) { /* the nearer to the center, the larger radius */ var radius = ((nodeCount - 1f) / 2 - Math.Abs(j - (nodeCount - 1f) / 2)) * 30; flow.AddNode(position, radius, 1f); position.X += 0; position.Y += 80; } } }
// -- 체인 라이트닝 -- // public void setElectricEffect(ElectricEffect eff) { //Debug.Log("======= setParticleEffect " + eff); eff.isEnabled = false; eff.transform.parent = GameManager.me.assetPool; _electricEffectList.Remove(eff); if (_electricEffectPool.ContainsKey(eff.type) == false) { _electricEffectPool.Add(eff.type, new Stack <ElectricEffect>()); } _electricEffectPool[eff.type].Push(eff); }
private void Init() { for (int i = 1; i < 4; i++) { var texture = MGDirector.SharedDirector().Content.Load<Texture2D>("ElectricPoint" + i.ToString(CultureInfo.InvariantCulture)); _electricPointTextures.Add(texture); } var spriteBatch = new SpriteBatch(MGDirector.SharedDirector().Graphics.GraphicsDevice); _electricEffect = new ElectricEffect(spriteBatch, _electricPointTextures) { Density = 4 }; }
void OnDestroy() { //Debug.Log("OnDestroy : EffectManager" ); foreach (tk2dAnimatedSprite ani in _tk2dAnimatedSprites) { Destroy(ani); } _tk2dAnimatedSprites.Clear(); _tk2dAnimatedSprites = null; while (_tk2dAnimatedSpritePool.Count > 0) { Destroy(_tk2dAnimatedSpritePool.Pop().gameObject); } _tk2dAnimatedSpritePool = null; foreach (KeyValuePair <string, Stack <ParticleEffect> > kv in _particleEffectPool) { while (kv.Value.Count > 0) { ParticleEffect pe = kv.Value.Pop(); if (pe != null) { Destroy(pe.gameObject); } } } int count = _particleEffectList.Count; for (int i = count - 1; i >= 0; --i) { if (_particleEffectList[i] != null) { _particleEffectList[i].destroyAsset(); if (_particleEffectList[i] != null && _particleEffectList[i].gameObject != null) { Destroy(_particleEffectList[i].gameObject); } } } _particleEffectList.Clear(); while (_attachedEffectPool.Count > 0) { Destroy(_attachedEffectPool.Pop().gameObject); } _attachedEffectPool = null; while (_getItemEffectPool.Count > 0) { GetItemEffect ge = _getItemEffectPool.Pop(); if (ge != null && ge.gameObject != null) { Destroy(_getItemEffectPool.Pop().gameObject); } } while (_uiGetItemEffectPool.Count > 0) { try { Destroy(_uiGetItemEffectPool.Pop().gameObject); } catch (Exception e) { } } _uiGetItemEffectPool.Clear(); while (_getWordEffectPool.Count > 0) { Destroy(_getWordEffectPool.Pop()); } _getWordEffectPool = null; foreach (KeyValuePair <string, Stack <ElectricEffect> > kv in _electricEffectPool) { while (kv.Value.Count > 0) { ElectricEffect e = kv.Value.Pop(); if (e != null) { Destroy(e); } } } _electricEffectPool = null; while (_cutSceneEffectPool.Count > 0) { Destroy(_cutSceneEffectPool.Pop()); } _cutSceneEffectPool = null; foreach (AttachedEffect ani in _attachedEffectList) { Destroy(ani.gameObject); } _attachedEffectList.Clear(); _attachedEffectList = null; foreach (GetItemEffect ani in _getItemEffectList) { Destroy(ani.gameObject); } _getItemEffectList.Clear(); _getItemEffectList = null; foreach (WordEffect ani in _getWordEffectList) { if (ani != null) { Destroy(ani.gameObject); } } _getWordEffectList.Clear(); _getWordEffectList = null; foreach (ElectricEffect ani in _electricEffectList) { if (ani != null) { Destroy(ani.gameObject); } } _electricEffectList.Clear(); _electricEffectList = null; }
public void getNextTarget(bool isPlayerSide) { _chaByRangeDistance.Clear(); int targetCount = _targets.Count; if (targetCount == 0) { _v = _attacker.cTransformPosition; } else { _v = _targets[_targets.Count - 1].cTransformPosition; } Monster cha; if (isPlayerSide) { len = GameManager.me.characterManager.monsters.Count; // 총알에서 가까운 녀석들부터 처리하기위해... for (i = len - 1; i >= 0; --i) { cha = GameManager.me.characterManager.monsters[i]; if (cha.isEnabled == false || cha.chainLighting.Contains(this)) { continue; } cha.distanceFromHitPoint = VectorUtil.DistanceXZ(_v, cha.cTransformPosition); _chaByRangeDistance.Add(cha); } } else { len = GameManager.me.characterManager.playerMonster.Count; // 총알에서 가까운 녀석들부터 처리하기위해... for (i = len - 1; i >= 0; --i) { cha = GameManager.me.characterManager.playerMonster[i]; if (cha.isEnabled == false || cha.chainLighting.Contains(this)) { continue; } cha.distanceFromHitPoint = VectorUtil.DistanceXZ(_v, cha.cTransformPosition); _chaByRangeDistance.Add(cha); } } _chaByRangeDistance.Sort(CharacterManager.sortByDistHitPointCharacter); len = _chaByRangeDistance.Count; if (len <= 0) { _canMore = false; _delay = 0.0f; _chaByRangeDistance.Clear(); return; } i = len - 1; cha = _chaByRangeDistance[i]; _chaByRangeDistance.Clear(); if (_nowConnectionNum == 0) // 최대연결거리 A만 계산. { // if(VectorUtil.DistanceXZ(_attacker.cTransformPosition, cha.cTransformPosition).AsFloat() > _distanceLimitA - _attacker.damageRange - cha.damageRange) if (VectorUtil.DistanceXZ(_attacker.cTransformPosition, cha.cTransformPosition).AsFloat() > _distanceLimitA) { _canMore = false; _delay = 0.0f; return; } } else // 최대연결거리B와 최대 전체거리를 다 계산해야함. { if (targetCount == 0) { _canMore = false; _delay = 0.0f; return; } _tempF = VectorUtil.DistanceXZ(_targets[targetCount - 1].cTransformPosition, cha.cTransformPosition); if (_tempF > _distanceLimitB) { _canMore = false; _delay = 0.0f; return; } else { _nowTotalDistance = 0.0f; for (i = _targets.Count - 1; i > 0; --i) { _nowTotalDistance += VectorUtil.DistanceXZ(_targets[i].cTransformPosition, _targets[i - 1].cTransformPosition); } if (_nowTotalDistance + _tempF > _totalDistanceLimit) { _canMore = false; _delay = 0.0f; return; } } } _startPosition = cha.cTransformPosition; ElectricEffect eff = GameManager.me.effectManager.getElectricEffect(type); eff.mode = ElectricEffect.Mode.CHARACTER; _effects.Add(eff); ParticleEffect pe = GameManager.me.effectManager.getParticleEffect(hitEffectId, GameManager.info.effectData[hitEffectId].resource); _v = cha.cTransformPosition; _v.y = cha.hitObject.top * 0.5f; if (GameManager.info.effectData[hitEffectId].maxSizeRatio < cha.effectSize) { pe.start(_v, cha.tf, true, GameManager.info.effectData[hitEffectId].maxSizeRatio); } else { pe.start(_v, cha.tf, true, cha.effectSize); } pe.shooterUniqueId = _attacker.stat.uniqueId; pe.checkSkillCam(); _particleEffects.Add(pe); if (_nowConnectionNum == 0) { eff.cFrom = _attacker; if (_attacker.shootingHand != null) { eff.shootingPoint = _attacker.shootingHand; } } else { eff.cFrom = _targets[targetCount - 1]; } eff.cTo = cha; eff.isEnabled = true; cha.chainLighting.Add(this); _targets.Add(cha); ++_nowConnectionNum; IFloat dp = 1.0f; if (_damageOffsetPerConnectionLevel > 0.0f && _nowConnectionNum > 1) { dp = 1.0f - (_nowConnectionNum - 1) * _damageOffsetPerConnectionLevel; } if (_skillData != null) { _skillData.applySkillEffect(cha, _skillLevel, null, _applyInforceLevel, _attacker, dp); } else { cha.damage(_attacker.stat.monsterType, _attacker, _attacker.stat.uniqueId, false, 1, _attacker.tf, _attacker.stat.atkPhysic, _attacker.stat.atkMagic, 1.0f, 1.0f, true, GameManager.info.skillEffectSetupData[_attacker.atkEffectType].effUp, GameManager.info.skillEffectSetupData[_attacker.atkEffectType].soundDown, dp ); } }