public void loadEffectFromHeroMonsterData(HeroMonsterData hd) { loadEffectFromMonsterData(hd.resource); loadEffectFromAtkEffectNum(hd.atkEffectType); loadEffectByBulletPatternIdAndAttackType(hd.bulletPatternId, hd.attackType.type); }
public Monster addMonsterToStage(TranscendData td, int[] transcendLevel, bool isPlayerMon, StageMonsterData stageMonData, string monId, Vector3 position, UnitData ud = null, bool addList = true) { // Log.log("addMonsterToStage : " + monId, " pos: " + position); Monster mon; bool isUnitMonster = (stageMonData == null || stageMonData.type == StageMonsterData.Type.UNIT); if (isUnitMonster) { _tempMonResource = GameManager.info.unitData[monId].resource; _tempMonType = Monster.TYPE.UNIT; } else if (stageMonData.type == StageMonsterData.Type.HERO) { _tempMonResource = GameManager.info.heroMonsterData[monId].resource; _tempMonType = Monster.TYPE.HERO; } else if (stageMonData.type == StageMonsterData.Type.NPC) { _tempMonResource = GameManager.info.npcData[monId].resource; _tempMonType = Monster.TYPE.NPC; } #if UNITY_EDITOR //Debug.Log(_tempMonCategory); #endif if (_tempMonType == Monster.TYPE.UNIT) { mon = GameManager.me.characterManager.getMonster(false, isPlayerMon, _tempMonResource, addList); CharacterUtil.setRare(GameManager.info.unitData[monId].rare, mon); } else if (_tempMonType == Monster.TYPE.HERO) { if (GameManager.info.heroMonsterData[monId].isPlayerResourceType) { HeroMonsterData hd = GameManager.info.heroMonsterData[monId]; mon = (Monster)GameManager.me.characterManager.getPlayerCharacter(hd.resource, hd.head, hd.body, hd.weapon, hd.vehicle, hd.faceTexture, false, addList); if (mon.action != null) { GameManager.me.characterManager.setCharacterAction(mon.action, mon.category); } mon.action = null; mon.category = MonsterCategory.Category.HEROMONSTER; } else { mon = GameManager.me.characterManager.getMonster(false, isPlayerMon, _tempMonResource, addList); mon.removeRareLine(); } } else { mon = GameManager.me.characterManager.getMonster(false, isPlayerMon, _tempMonResource, addList); if (mon.monsterData.hasFaceAni == false) { //CharacterUtil.setRare(RareType.NORMAL, mon); mon.removeRareLine(); } } //position.x += (float)(GameManager.inGameRandom.Range(0,101))*0.01f;//(float)GameManager.getRandomNum()*0.01f; //mon.setPositionCtransform( position ); mon.init(td, transcendLevel, monId, isPlayerMon, _tempMonType, stageMonData); mon.setPositionCtransform(position); // Log.log("addMonsterToStage" + mon , mon.resourceId); mon.isCutSceneOnlyCharacter = false; _tempMonCategory = GameManager.info.monsterData[_tempMonResource].category; if (addList) { switch (_tempMonCategory) { case MonsterCategory.Category.HEROMONSTER: ++bossNum; //Debug.LogError("bossNum : " + bossNum); break; case MonsterCategory.Category.UNIT: if (isPlayerMon == false) { monUnitNum.Set(monUnitNum + 1); } //Debug.LogError("monUnitNum : " + monUnitNum); break; } } // 인트로 컷씬 게임용. if (GameManager.me.stageManager.isIntro) { mon.hp = 100000000; } mon.action.setFirstPosition(mon.cTransformPosition); mon.setVisible(true); mon.isEnabled = true; return(mon); }
public void init(TranscendData transcendData, int[] transcendLevel, bool isPlayerUnitData, string id, bool isPlayerMon = false, TYPE type = Monster.TYPE.UNIT, StageMonsterData sMonData = null, bool isPetMonster = false) { #if UNITY_EDITOR cTransform.gameObject.name = ((isPlayerMon)?"pm":"em") + randomNum++; tf.gameObject.name = cTransform.gameObject.name; #endif resetDefaultVals(); if (particleEffect != null) { GameManager.me.effectManager.setParticleEffect(particleEffect); } isPet = isPetMonster; isPlayerSide = isPlayerMon; fowardDirectionValue = (isPlayerSide?1000.0f:-1000.0f); isDeleteObject = false; _v = tf.localScale; _v.x = 1.0f; _v.y = 1.0f; _v.z = 1.0f; tf.localScale = _v; _q = tf.rotation; _v = _q.eulerAngles; _v.x = 0.0f; if (isPlayerSide) { _v.y = 90.0f; } else { _v.y = 270.0f; } _v.z = 0.0f; _q.eulerAngles = _v; tf.rotation = _q; isMonster = true; npcData = null; unitData = null; heroMonsterData = null; stageMonsterData = sMonData; stat.monsterType = type; bool needToSetRareEffect = false; if (type == TYPE.UNIT) { isHero = false; unitData = GameManager.info.unitData[id]; unitData.setDataToCharacter(this, transcendData, transcendLevel); if (isPlayerMon) { // GameManager.me.player.unitHpUp 소환생명력증가 // GameManager.me.player.unitDefUp float tempF = maxHp; tempF += tempF * GameManager.me.player.unitHpUp(unitData); // stat.unitHpUp; maxHp = tempF; hp = tempF; tempF = stat.defMagic; tempF += tempF * GameManager.me.player.unitDefUp(unitData); //.stat.unitDefUp; stat.defMagic = tempF; tempF = stat.defPhysic; tempF += tempF * GameManager.me.player.unitDefUp(unitData); //.stat.unitDefUp; stat.defPhysic = tempF; if (unitData.rare > 0) { needToSetRareEffect = true; } } else if (isPlayerUnitData) // 적인데 주인공 소환수 데이터를 갖고 있으면 걔는 무조건 PVP! { float tempF = maxHp; tempF += tempF * GameManager.me.pvpPlayer.unitHpUp(unitData); //.stat.unitHpUp; maxHp = tempF; hp = tempF; tempF = stat.defMagic; tempF += tempF * GameManager.me.pvpPlayer.unitDefUp(unitData); //..stat.unitDefUp; stat.defMagic = tempF; tempF = stat.defPhysic; tempF += tempF * GameManager.me.pvpPlayer.unitDefUp(unitData); //..stat.unitDefUp; stat.defPhysic = tempF; if (unitData.rare > 0) { needToSetRareEffect = true; } } #if UNITY_EDITOR cTransform.gameObject.name += "_" + unitData.rare; tf.gameObject.name = cTransform.gameObject.name; #endif setAniData(Monster.ATK_IDS[unitData.attackType.type]); setDefaultHitRange(_tempAniData, false); //(unitData.attackType.type == 1 || unitData.attackType.type == 2)); if (unitData.skill != null && unitData.skill.Length > 0) { skillSlots = new UnitSkillSlot[unitData.skill.Length]; _skillSlotsNum = skillSlots.Length; for (i = 0; i < _skillSlotsNum; ++i) { skillSlots[i] = new UnitSkillSlot(); skillSlots[i].setData(this, GameManager.info.unitSkillData[unitData.skill[i]]); } } else { skillSlots = null; } } else if (type == TYPE.HERO) // 히어로.... { isHero = true; heroMonsterData = GameManager.info.heroMonsterData[id]; heroMonsterData.setDataToCharacter(this); setAniData(Monster.ATK_IDS[heroMonsterData.attackType.type]); setDefaultHitRange(_tempAniData, false); //(heroMonsterData.attackType.type == 1 || heroMonsterData.attackType.type == 2)); setUpdateWhenOffscreen(true); int len = 0; if (stageMonsterData != null) { if (stageMonsterData.units != null) { _unitSlotsNum = stageMonsterData.units.Length; unitSlots = new UnitSlot[_unitSlotsNum]; len = unitSlots.Length; for (i = 0; i < len; ++i) { unitSlots[i] = new UnitSlot(); unitSlots[i].setData(this, GameManager.info.unitData[stageMonsterData.units[i]]); } } _skillSlotsNum = stageMonsterData.skills.Length; skillSlots = new HeroSkillSlot[_skillSlotsNum]; len = _skillSlotsNum; for (i = 0; i < len; ++i) { skillSlots[i] = new HeroSkillSlot(); GameIDData skillInfo = new GameIDData(); skillInfo.parse(stageMonsterData.skills[i], GameIDData.Type.Skill); skillSlots[i].setData(this, skillInfo); } _aiSlotsNum = stageMonsterData.ai.Length; aiSlots = new AISlot[_aiSlotsNum]; len = _aiSlotsNum; for (i = 0; i < len; ++i) { aiSlots[i] = new AISlot(); #if UNITY_EDITOR try { #endif aiSlots[i].setData(this, GameManager.info.heroMonsterAI[stageMonsterData.ai[i]]); #if UNITY_EDITOR } catch { Debug.LogError("==== ERRORRRRRR : " + stageMonsterData.ai[i]); } #endif } } } else if (type == TYPE.NPC) { isHero = false; npcData = GameManager.info.npcData[id]; GameManager.info.npcData[id].setDataToCharacter(this); } else if (type == TYPE.EFFECT) { isHero = false; } baseInit(); damageRange = monsterData.damageRange; isBlockMonster = monsterData.isBlockMonster; initShadowAndEffectSize(); _showFirst = false; _recoveryDelay.Set(0.0f); _recoveryDelayMp.Set(0.0f); _recoveryDelaySp.Set(0.0f); _hpRecoveryDelay.Set(0.0f); //_monsterShowTime = 0.0f; invincible = false; //Log.log("monsterData.category : " + monsterData.category); action = GameManager.me.characterManager.getCharacterAction(category); action.init(this); hasAni = !(category == MonsterCategory.Category.OBJECT && ani.GetClip(DEAD) == null); _v = tf.localPosition; _v.y = 1.0f; tf.localPosition = _v; _damageMotionDuration = 1000.0f; if (monsterData.deleteMotionType == ChracterDeleteMotionType.EFFECT) { deleteMotionEffect = GameManager.info.effectData[monsterData.deleteMotionValue].clone(); if (deleteMotionEffect.type == EffectData.ResourceType.CHARACTER) { #if UNITY_EDITOR Debug.Log("deleteMotionEffect.effectChracter : " + (deleteMotionEffect.effectChracter == null)); #endif if (deleteMotionEffect.effectChracter == null) { deleteMotionEffect.effectChracter = GameManager.me.characterManager.getMonster(false, isPlayerMon, deleteMotionEffect.resource, false); if (unitData != null) { CharacterUtil.setRare(unitData.rare, deleteMotionEffect.effectChracter); } else if (isHero) { deleteMotionEffect.effectChracter.removeRareLine(); } deleteMotionEffect.effectChracter.init(null, null, monsterData.deleteMotionValue, isPlayerMon, Monster.TYPE.EFFECT); deleteMotionEffect.effectChracter.isEnabled = false; deleteMotionEffect.effectChracter.cTransform.localScale = cTransform.localScale; } } } else { deleteMotionEffect = null; } if (ani[Monster.NORMAL] != null) { state = Monster.NORMAL; } initHpBar(); initMiniMap(); saveCharacterOriginalValue(); // if(needToSetRareEffect) // { //GameManager.info.effectData[UnitData.rareEffectId[unitData.rare-1]].getEffect(cTransform.position,null,cTransform); //getParticleEffectByCharacterSize(this,null,cTransform); //particleEffect = GameManager.info.effectData[UnitData.rareEffectId[unitData.rare-1]].getParticleEffectByCharacterSize(this,null,cTransform,10000,0,0,0,0.5f); // } if (GameManager.me.stageManager.isIntro) { maxHp = 10000000; _hp = 10000000; } stat.maxHp = MathUtil.RoundToInt(maxHp); if (GameManager.info.modelData.ContainsKey(resourceId)) { useRimShader = GameManager.info.modelData[resourceId].useRimShader; } }