private void InitProperty(CropsInitParam param) { if (null == param.cropsinfo) { return; } CropsModule module = ModuleManager.Instance.FindModule <CropsModule>(); if (null == module) { return; } float hp = 0.0f; float damage = 0.0f; float crits = 0.0f; float defence = 0.0f; float energy = 0.0f; module.GetProperty(param.cropsinfo.mCropsId, param.cropsinfo.mCropsStarslv, ref hp, ref damage, ref crits, ref defence, ref energy); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeHP, mRes.defaultHP + hp); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMaxHP, mRes.defaultHP + hp); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMana, mRes.defaultEnergy + energy); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMaxMana, mRes.defaultEnergy + energy); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeDamage, mRes.defaultDamage + damage); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeCrticalLV, mRes.defaultCrticalLV + crits); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeDefance, mRes.defaultDamageReduce + defence); SetBaseProperty((int)PropertyTypeEnum.PropertyTypeSpeed, mRes.movespeed); }
override public bool Init(ObjectInitParam param) { CropsInitParam cropsParam = (CropsInitParam)param; if (!DataManager.NPCTable.ContainsKey(cropsParam.crops_res_id)) { return(false); } mRes = DataManager.NPCTable[cropsParam.crops_res_id] as NPCTableItem; mModelResID = mRes.model; if (!base.Init(param)) { return(false); } resid = mRes.resID; mBattleUintAI = AIFactory.Instance.CreateAIObject(this, mRes.ai); if (mBattleUintAI == null) { return(false); } if (cropsParam.talk_id >= 0) { mTalkID = cropsParam.talk_id; } else { mTalkID = mRes.talkID; } if (cropsParam.league != LeagueDef.InvalidLeague) { SetLeague(cropsParam.league); } else { SetLeague(mRes.league); } mDestroyWaiting = true; mMaxDisappearTime = mRes.DisappearTime; mMaxWaitDisappearTime = mRes.WaitDisappearTime; mSummonerAttr = cropsParam.summonerAttr; InitProperty(cropsParam); if (mRes.bossHpUnit < 0 && mRes.showHp) { mBloodNode = BloodUIManager.Instance.CreateBloodUI(); } GetCrySound(); return(true); }
override protected void OnGameStart() { base.OnGameStart(); if (mModule.GetGhostGuid() == null || mModule.GetGhostData() == null) { SceneManager.Instance.RequestEnterLastCity(); return; } GhostInitParam initParam = new GhostInitParam(); initParam.init_pos = GetInitPosByName("ghost"); initParam.init_pos.y = GetHeight(initParam.init_pos.x, initParam.init_pos.z); initParam.init_dir = GetInitDirByName("ghost"); initParam.ghost_data = mModule.GetGhostData(); initParam.league = LeagueDef.Blue; initParam.main_player = false; CreateSprite(initParam); if (Vector3.zero != GetInitPosByName("ghostcrops1") && null != mModule.MainCropsInfo && -1 != mModule.MainCropsInfo.mCropsId) { //创建玩家拥有的佣兵 CropsInitParam cropsParam = new CropsInitParam(); cropsParam.crops_res_id = mModule.MainCropsInfo.mCropsId; cropsParam.init_pos = GetInitPosByName("ghostcrops1"); cropsParam.init_pos.y = GetHeight(cropsParam.init_pos.x, cropsParam.init_pos.z); cropsParam.init_dir = GetInitDirByName("ghostcrops1"); cropsParam.league = LeagueDef.Blue; cropsParam.cropsinfo = mModule.MainCropsInfo; CreateSprite(cropsParam); if (Vector3.zero != GetInitPosByName("ghostcrops2") && null != mModule.SubCropsInfo && -1 != mModule.SubCropsInfo.mCropsId) { cropsParam.crops_res_id = mModule.SubCropsInfo.mCropsId; cropsParam.init_pos = GetInitPosByName("ghostcrops2"); cropsParam.init_pos.y = GetHeight(cropsParam.init_pos.x, cropsParam.init_pos.z); cropsParam.init_dir = GetInitDirByName("ghostcrops2"); cropsParam.league = LeagueDef.Blue; cropsParam.cropsinfo = mModule.SubCropsInfo; CreateSprite(cropsParam); } } WindowManager.Instance.OpenUI("fight321"); }