public void AddRule(int ruleID) { if (mActiveRules.Contains(ruleID)) { return; } mActiveRules.Add(ruleID); LifeFormRule addRule = LifeFormRule.GetRule(ruleID); mRulesDecreaseStackCount[addRule.mID] = addRule.mUpdateInterval; mIndexList.Add(addRule.mID); mPropertyMaxs[addRule.mPropertyType] = addRule.mPropertyValueMax; mPropertys[addRule.mPropertyType] = 0; }
// Update is called once per frame void Update() { //PLayer only Update //Player player = mSkillRunner as Player; //if(null != player) //{ // mPropertys[(int)LifeFormProperty.LFP_Stamina] = player.GetAttribute(Pathea.AttribType.Comfort); // mPropertys[(int)LifeFormProperty.LFP_Oxygen] = player.GetAttribute(Pathea.AttribType.Oxygen); // FoodCheckInterval -= Time.deltaTime; // if(FoodCheckInterval < 0) // { // FoodCheckInterval = 1f; // int Count = 0; // foreach(int property in mPropertys.Keys) // { // if((LifeFormProperty)property >= LifeFormProperty.LFP_Food_Min // && (LifeFormProperty)property <= LifeFormProperty.LFP_Food_Max // && mPropertys[property] > 0) // { // Count++; // } // } // if(Count > 0 && !mSkillRunner.IsEffRunning(10020 + Count)) // mSkillRunner.RunEff(10020 + Count, mSkillRunner); // } //} //CheckRules foreach (int index in mIndexList) { mRulesDecreaseStackCount[index] -= Time.deltaTime; if (mRulesDecreaseStackCount[index] < 0) { LifeFormRule rule = LifeFormRule.GetRule(index); mRulesDecreaseStackCount[index] = rule.mUpdateInterval; if ((rule.mConditionType == 0 && mPropertys[rule.mPropertyType] >= rule.mConditionMin && mPropertys[rule.mPropertyType] <= rule.mConditionMax) || (rule.mConditionType == 1 && mPropertys[rule.mPropertyType] / mPropertyMaxs[rule.mPropertyType] >= rule.mConditionMin && mPropertys[rule.mPropertyType] / mPropertyMaxs[rule.mPropertyType] <= rule.mConditionMax)) { mSkillRunner.RunEff(rule.mCostSkillID, mSkillRunner); } } } }
public static void LoadData() { s_tblRules = new Dictionary <int, LifeFormRule>(); SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("LifeFormRule"); while (reader.Read()) { LifeFormRule addRule = new LifeFormRule(); addRule.mID = Convert.ToInt32(reader.GetString(reader.GetOrdinal("ID"))); addRule.mUpdateInterval = Convert.ToSingle(reader.GetString(reader.GetOrdinal("UpdateInterval"))); addRule.mPropertyType = Convert.ToInt32(reader.GetString(reader.GetOrdinal("PropertyType"))); addRule.mPropertyValueMax = Convert.ToSingle(reader.GetString(reader.GetOrdinal("PropertyValueMax"))); addRule.mConditionType = Convert.ToInt32(reader.GetString(reader.GetOrdinal("ConditionType"))); addRule.mConditionMin = Convert.ToSingle(reader.GetString(reader.GetOrdinal("ConditionMin"))); addRule.mConditionMax = Convert.ToSingle(reader.GetString(reader.GetOrdinal("ConditionMax"))); addRule.mCostSkillID = Convert.ToInt32(reader.GetString(reader.GetOrdinal("CostSkillID"))); s_tblRules[addRule.mID] = addRule; } }
public static void LoadAllData() { if (s_localDatabase != null) { return; } #if UNITY_EDITOR System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); #endif s_localDatabase = LoadDb(); SkillSystem.SkData.LoadData(); Pathea.Effect.EffectData.LoadData(); Pathea.Projectile.ProjectileData.LoadData(); Pathea.RequestRelation.LoadData(); Pathea.CampData.LoadData(); Pathea.ThreatData.LoadData(); Pathea.DamageData.LoadData(); HumanSoundData.LoadData(); ItemDropData.LoadData(); PELocalization.LoadData(); NaturalResAsset.NaturalRes.LoadData(); //SkillAsset.EffCastData.LoadData(); //SkillAsset.EffSkill.LoadData(); //SkillAsset.MergeSkill.LoadData(); //AnimData.LoadData(); //AnimSoundData.LoadData(); AiAsset.AiData.LoadData(); SoundAsset.SESoundBuff.LoadData(); SoundAsset.SESoundStory.LoadData(); //CharacterData.LoadCharacterData(); StoryDoodadMap.LoadData(); StoreRepository.LoadData(); NpcMissionDataRepository.LoadData(); //PlayerAttribute.LoadData(); MissionRepository.LoadData(); TalkRespository.LoadData(); //NpcRandomRepository.LoadData(); ShopRespository.LoadData(); WareHouseManager.LoadData(); //HeroTalkRepository.LoadData(); MutiPlayRandRespository.LoadData(); PromptRepository.LoadData(); //MapIconData.LoadDate(); //MapMaskData.LoadDate(); CampPatrolData.LoadDate(); Camp.LoadData(); RepProcessor.LoadData(); CloudManager.LoadData(); //BattleUnitData.LoadData(); TutorialData.LoadData(); //RepairMachineManager.LoadData(); MapMaskData.LoadDate(); MessageData.LoadData(); //lz-2016.07.13 Add it MonsterHandbookData.LoadData(); //lz-2016.07.20 Add it StoryRepository.LoadData(); RMRepository.LoadRandMission(); MisInitRepository.LoadData(); CameraRepository.LoadCameraPlot(); AdRMRepository.LoadData(); VCConfig.InitConfig(); Cutscene.LoadData(); // BuildBrushData.LoadBrush(); BSPattern.LoadBrush(); BSVoxelMatMap.Load(); BSBlockMatMap.Load(); BlockBuilding.LoadBuilding(); LifeFormRule.LoadData(); PlantInfo.LoadData(); MetalScanData.LoadData(); BattleConstData.LoadData(); CustomCharactor.CustomMetaData.LoadData(); SkillTreeInfo.LoadData(); VArtifactUtil.LoadData(); Pathea.ActionRelationData.LoadActionRelation(); //colony CSInfoMgr.LoadData(); ProcessingObjInfo.LoadData(); CSTradeInfoData.LoadData(); CampTradeIdData.LoadData(); AbnormalTypeTreatData.LoadData(); CSMedicineSupport.LoadData(); //RandomItemMgr RandomItemDataMgr.LoadData(); FecesData.LoadData(); //randomdungeon RandomDungeonDataBase.LoadData(); AbnormalData.LoadData(); PEAbnormalNoticeData.LoadData(); RelationInfo.LoadData(); EquipSetData.LoadData(); SuitSetData.LoadData(); CheatData.LoadData(); Pathea.NpcProtoDb.Load(); Pathea.MonsterProtoDb.Load(); Pathea.MonsterRandomDb.Load(); Pathea.MonsterGroupProtoDb.Load(); Pathea.RandomNpcDb.Load(); Pathea.PlayerProtoDb.Load(); Pathea.TowerProtoDb.Load(); Pathea.DoodadProtoDb.Load(); Pathea.AttPlusNPCData.Load(); Pathea.AttPlusBuffDb.Load(); Pathea.NpcTypeDb.Load(); Pathea.NpcRandomTalkDb.Load(); Pathea.NpcThinkDb.LoadData(); Pathea.NpcEatDb.LoadData(); Pathea.NpcRobotDb.Load(); Pathea.NPCScheduleData.Load(); Pathea.NpcVoiceDb.LoadData(); InGameAidData.LoadData(); //lz-2016.08.21 add it MountsSkillDb.LoadData(); #if UNITY_EDITOR sw.Stop(); Debug.Log("Database Loaded : " + sw.ElapsedMilliseconds); sw.Reset(); #else Debug.Log("Database Loaded"); #endif }