private void OnEnable() { waterReflection = target as WaterReflection; waterReflection.UpdateCamera(); spriteRenderer = serializedObject.FindProperty("spriteRenderer"); camera = serializedObject.FindProperty("camera"); waterShader = serializedObject.FindProperty("waterShader"); }
void OnDestroy() { Inst = null; }
private void Awake() { Inst = this; }
public override void ReadDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ele.TryPathTo("EditorID", false, out subEle)) { if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadXML(subEle, master); } if (ele.TryPathTo("Base", false, out subEle)) { if (Base == null) { Base = new RecordReference(); } Base.ReadXML(subEle, master); } if (ele.TryPathTo("EncounterZone", false, out subEle)) { if (EncounterZone == null) { EncounterZone = new RecordReference(); } EncounterZone.ReadXML(subEle, master); } if (ele.TryPathTo("RagdollData", false, out subEle)) { if (RagdollData == null) { RagdollData = new SimpleSubrecord <Byte[]>(); } RagdollData.ReadXML(subEle, master); } if (ele.TryPathTo("RagdollBipedData", false, out subEle)) { if (RagdollBipedData == null) { RagdollBipedData = new SimpleSubrecord <Byte[]>(); } RagdollBipedData.ReadXML(subEle, master); } if (ele.TryPathTo("Patrol", false, out subEle)) { if (Patrol == null) { Patrol = new ReferencePatrolData(); } Patrol.ReadXML(subEle, master); } if (ele.TryPathTo("Owner", false, out subEle)) { if (Owner == null) { Owner = new RecordReference(); } Owner.ReadXML(subEle, master); } if (ele.TryPathTo("FactionRank", false, out subEle)) { if (FactionRank == null) { FactionRank = new SimpleSubrecord <Int32>(); } FactionRank.ReadXML(subEle, master); } if (ele.TryPathTo("Count", false, out subEle)) { if (Count == null) { Count = new SimpleSubrecord <Int32>(); } Count.ReadXML(subEle, master); } if (ele.TryPathTo("Radius", false, out subEle)) { if (Radius == null) { Radius = new SimpleSubrecord <Single>(); } Radius.ReadXML(subEle, master); } if (ele.TryPathTo("Health", false, out subEle)) { if (Health == null) { Health = new SimpleSubrecord <Single>(); } Health.ReadXML(subEle, master); } if (ele.TryPathTo("WaterReflections", false, out subEle)) { if (WaterReflections == null) { WaterReflections = new List <WaterReflection>(); } foreach (XElement e in subEle.Elements()) { WaterReflection tempXPWR = new WaterReflection(); tempXPWR.ReadXML(e, master); WaterReflections.Add(tempXPWR); } } if (ele.TryPathTo("Decals", false, out subEle)) { if (Decals == null) { Decals = new List <SimpleSubrecord <Byte[]> >(); } foreach (XElement e in subEle.Elements()) { SimpleSubrecord <Byte[]> tempXDCR = new SimpleSubrecord <Byte[]>(); tempXDCR.ReadXML(e, master); Decals.Add(tempXDCR); } } if (ele.TryPathTo("LinkedReference", false, out subEle)) { if (LinkedReference == null) { LinkedReference = new RecordReference(); } LinkedReference.ReadXML(subEle, master); } if (ele.TryPathTo("LinkedReferenceColor", false, out subEle)) { if (LinkedReferenceColor == null) { LinkedReferenceColor = new LinkedReferenceColor(); } LinkedReferenceColor.ReadXML(subEle, master); } if (ele.TryPathTo("ParentActivateOnly", false, out subEle)) { if (ParentActivateOnly == null) { ParentActivateOnly = new SimpleSubrecord <NoYesByte>(); } ParentActivateOnly.ReadXML(subEle, master); } if (ele.TryPathTo("ActivateParents", false, out subEle)) { if (ActivateParents == null) { ActivateParents = new List <ActivateParent>(); } foreach (XElement e in subEle.Elements()) { ActivateParent tempXAPR = new ActivateParent(); tempXAPR.ReadXML(e, master); ActivateParents.Add(tempXAPR); } } if (ele.TryPathTo("ActivationPrompt", false, out subEle)) { if (ActivationPrompt == null) { ActivationPrompt = new SimpleSubrecord <String>(); } ActivationPrompt.ReadXML(subEle, master); } if (ele.TryPathTo("EnableParent", false, out subEle)) { if (EnableParent == null) { EnableParent = new EnableParent(); } EnableParent.ReadXML(subEle, master); } if (ele.TryPathTo("Emittance", false, out subEle)) { if (Emittance == null) { Emittance = new RecordReference(); } Emittance.ReadXML(subEle, master); } if (ele.TryPathTo("MultiBound", false, out subEle)) { if (MultiBound == null) { MultiBound = new RecordReference(); } MultiBound.ReadXML(subEle, master); } if (ele.TryPathTo("IgnoredBySandbox", false, out subEle)) { if (IgnoredBySandbox == null) { IgnoredBySandbox = new SubMarker(); } IgnoredBySandbox.ReadXML(subEle, master); } if (ele.TryPathTo("Scale", false, out subEle)) { if (Scale == null) { Scale = new SimpleSubrecord <Single>(); } Scale.ReadXML(subEle, master); } if (ele.TryPathTo("PositionRotation", false, out subEle)) { if (PositionRotation == null) { PositionRotation = new PositionRotation(); } PositionRotation.ReadXML(subEle, master); } }
public override void ReadData(ESPReader reader, long dataEnd) { while (reader.BaseStream.Position < dataEnd) { string subTag = reader.PeekTag(); switch (subTag) { case "EDID": if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadBinary(reader); break; case "NAME": if (Base == null) { Base = new RecordReference(); } Base.ReadBinary(reader); break; case "XEZN": if (EncounterZone == null) { EncounterZone = new RecordReference(); } EncounterZone.ReadBinary(reader); break; case "XRGD": if (RagdollData == null) { RagdollData = new SimpleSubrecord <Byte[]>(); } RagdollData.ReadBinary(reader); break; case "XRGB": if (RagdollBipedData == null) { RagdollBipedData = new SimpleSubrecord <Byte[]>(); } RagdollBipedData.ReadBinary(reader); break; case "XPRD": if (Patrol == null) { Patrol = new ReferencePatrolData(); } Patrol.ReadBinary(reader); break; case "XOWN": if (Owner == null) { Owner = new RecordReference(); } Owner.ReadBinary(reader); break; case "XRNK": if (FactionRank == null) { FactionRank = new SimpleSubrecord <Int32>(); } FactionRank.ReadBinary(reader); break; case "XCNT": if (Count == null) { Count = new SimpleSubrecord <Int32>(); } Count.ReadBinary(reader); break; case "XRDS": if (Radius == null) { Radius = new SimpleSubrecord <Single>(); } Radius.ReadBinary(reader); break; case "XHLP": if (Health == null) { Health = new SimpleSubrecord <Single>(); } Health.ReadBinary(reader); break; case "XPWR": if (WaterReflections == null) { WaterReflections = new List <WaterReflection>(); } WaterReflection tempXPWR = new WaterReflection(); tempXPWR.ReadBinary(reader); WaterReflections.Add(tempXPWR); break; case "XDCR": if (Decals == null) { Decals = new List <SimpleSubrecord <Byte[]> >(); } SimpleSubrecord <Byte[]> tempXDCR = new SimpleSubrecord <Byte[]>(); tempXDCR.ReadBinary(reader); Decals.Add(tempXDCR); break; case "XLKR": if (LinkedReference == null) { LinkedReference = new RecordReference(); } LinkedReference.ReadBinary(reader); break; case "XCLP": if (LinkedReferenceColor == null) { LinkedReferenceColor = new LinkedReferenceColor(); } LinkedReferenceColor.ReadBinary(reader); break; case "XAPD": if (ParentActivateOnly == null) { ParentActivateOnly = new SimpleSubrecord <NoYesByte>(); } ParentActivateOnly.ReadBinary(reader); break; case "XAPR": if (ActivateParents == null) { ActivateParents = new List <ActivateParent>(); } ActivateParent tempXAPR = new ActivateParent(); tempXAPR.ReadBinary(reader); ActivateParents.Add(tempXAPR); break; case "XATO": if (ActivationPrompt == null) { ActivationPrompt = new SimpleSubrecord <String>(); } ActivationPrompt.ReadBinary(reader); break; case "XESP": if (EnableParent == null) { EnableParent = new EnableParent(); } EnableParent.ReadBinary(reader); break; case "XEMI": if (Emittance == null) { Emittance = new RecordReference(); } Emittance.ReadBinary(reader); break; case "XMBR": if (MultiBound == null) { MultiBound = new RecordReference(); } MultiBound.ReadBinary(reader); break; case "XIBS": if (IgnoredBySandbox == null) { IgnoredBySandbox = new SubMarker(); } IgnoredBySandbox.ReadBinary(reader); break; case "XSCL": if (Scale == null) { Scale = new SimpleSubrecord <Single>(); } Scale.ReadBinary(reader); break; case "DATA": if (PositionRotation == null) { PositionRotation = new PositionRotation(); } PositionRotation.ReadBinary(reader); break; default: throw new Exception(); } } }
public static void Update() { if (Nova != null) { if (Pathea.SingleGameStory.curType == Pathea.SingleGameStory.StoryScene.PajaShip) { Nova.LocalTime = 0; } else { Nova.LocalTime = GameTime.Timer.Second; } if (Pathea.PeGameMgr.IsMulti) { if (PlayerNetwork.mainPlayer != null && PlayerNetwork.mainPlayer._curSceneId == (int)Pathea.SingleGameStory.StoryScene.PajaShip) { Nova.LocalTime = 0; } } Nova.Settings.TimeElapseSpeed = GameTime.Timer.ElapseSpeed; Nova.Settings.SoundVolume = SystemSettingData.Instance.SoundVolume * SystemSettingData.Instance.EffectVolume; Nova.WetCoef = (float)System.Math.Pow(System.Math.Max((s_envNoise.Noise(Nova.LocalDay * 1.2) + s_envNoise.Noise(Nova.LocalDay * 2.4) * 0.5 + s_envNoise.Noise(Nova.LocalDay * 4.8) * 0.25 + s_envNoise.Noise(Nova.LocalDay * 9.6) * 0.125) * 0.38 + 0.45, 0), 3); // 小雨多一点.. if (Nova.WetCoef > 0.55f) { Nova.WetCoef -= 0.55f; Nova.WetCoef *= 2.2f; Nova.WetCoef = (float)System.Math.Pow(Nova.WetCoef, 2f); Nova.WetCoef /= 2.2f; Nova.WetCoef += 0.55f; } Nova.WetCoef = (Mathf.Clamp01(Nova.WetCoef) * ControlRain + BaseRain) * rainSwitch; Debug.DrawLine(new Vector3((float)Nova.LocalDay, (float)Nova.WetCoef, 0), new Vector3((float)Nova.LocalDay + 0.01f, (float)Nova.WetCoef, 0), Color.white, 1000); bool water_opt1 = SystemSettingData.Instance.WaterDepth; bool water_opt2 = SystemSettingData.Instance.WaterRefraction; int water_opt_ = 0; if (water_opt1 && water_opt2) { water_opt_ = 3; } else if (water_opt1 || water_opt2) { water_opt_ = 2; } else { water_opt_ = 1; } if (water_opt != water_opt_) { Material water_mat = null; switch (water_opt_) { case 3: water_mat = Resources.Load <Material>("PEWater_High"); break; case 2: water_mat = Resources.Load <Material>("PEWater_Medium"); break; case 1: water_mat = Resources.Load <Material>("PEWater_Low"); break; default: break; } if (VFVoxelWater.self != null && PEWaveSystem.Self != null) { Material new_water_mat = Material.Instantiate(water_mat) as Material; VFVoxelWater.self.WaterMat = new_water_mat; NovaSettings.WaterMaterial = new_water_mat; water_opt = water_opt_; } } RenderSettings.fog = !VCEditor.s_Ready; if (Pathea.PeGameMgr.sceneMode == Pathea.PeGameMgr.ESceneMode.Story) { if (PeMappingMgr.inited) { switch (PeMappingMgr.Instance.Biome) { case GraphMapping.EBiome.Sea: Nova.BiomoIndex = 0; break; case GraphMapping.EBiome.Marsh: Nova.BiomoIndex = 4; break; case GraphMapping.EBiome.Jungle: Nova.BiomoIndex = 2; break; case GraphMapping.EBiome.Forest: Nova.BiomoIndex = 1; break; case GraphMapping.EBiome.Desert: Nova.BiomoIndex = 0; break; case GraphMapping.EBiome.Canyon: Nova.BiomoIndex = 0; break; case GraphMapping.EBiome.Volcano: Nova.BiomoIndex = 6; break; case GraphMapping.EBiome.Grassland: Nova.BiomoIndex = 0; break; case GraphMapping.EBiome.Mountainous: Nova.BiomoIndex = 3; break; default: Nova.BiomoIndex = 0; break; } float mul_target = 1f; float ofs_target = 0f; switch (PeMappingMgr.Instance.Biome) { case GraphMapping.EBiome.Desert: mul_target = 0.3f; ofs_target = 0.0f; break; case GraphMapping.EBiome.Volcano: mul_target = 0.3f; ofs_target = 0.45f; break; default: mul_target = 1f; ofs_target = 0f; break; } wetcoef_multiplier = Mathf.Lerp(wetcoef_multiplier, mul_target, 0.01f); wetcoef_offset = Mathf.Lerp(wetcoef_offset, ofs_target, 0.01f); Nova.WetCoef *= wetcoef_multiplier; Nova.WetCoef += wetcoef_offset; } else { Nova.BiomoIndex = 0; } } else { Nova.BiomoIndex = 0; } if (RandomDungenMgrData.InDungeon) { Nova.BiomoIndex = 5; } else { if (Pathea.PeGameMgr.IsAdventure || Pathea.PeGameMgr.IsBuild) { if (Pathea.PeCreature.Instance.mainPlayer != null) { RandomMapType rmt = VFDataRTGen.GetXZMapType(Mathf.RoundToInt(Pathea.PeCreature.Instance.mainPlayer.position.x), Mathf.RoundToInt(Pathea.PeCreature.Instance.mainPlayer.position.z)); switch (rmt) { case RandomMapType.Swamp: Nova.BiomoIndex = 4; break; case RandomMapType.Rainforest: Nova.BiomoIndex = 2; break; case RandomMapType.Forest: Nova.BiomoIndex = 1; break; case RandomMapType.Desert: Nova.BiomoIndex = 0; break; case RandomMapType.Redstone: Nova.BiomoIndex = 0; break; case RandomMapType.Crater: Nova.BiomoIndex = 6; break; case RandomMapType.GrassLand: Nova.BiomoIndex = 0; break; case RandomMapType.Mountain: Nova.BiomoIndex = 3; break; default: Nova.BiomoIndex = 0; break; } } } } if (Pathea.PeGameMgr.sceneMode == Pathea.PeGameMgr.ESceneMode.Story || Pathea.PeGameMgr.sceneMode == Pathea.PeGameMgr.ESceneMode.Custom) { switch (SystemSettingData.Instance.TerrainLevel) { //lz-2016.06.17 由(0=128M,1=256M,2=512M,3=1KM)改为(0=256M,1=512M,2=1KM),因此这里改为这样 case 0: Nova.Settings.MaxFogEndDistance = 200; break; case 1: Nova.Settings.MaxFogEndDistance = 340; break; case 2: Nova.Settings.MaxFogEndDistance = 700; break; case 3: Nova.Settings.MaxFogEndDistance = 1300; break; } } else { Nova.Settings.MaxFogEndDistance = 550; } // 靠近海洋才打开水的反射效果,远离海洋则关闭, //if (Input.GetKeyDown(KeyCode.I)){ AlterNearSea(false); } //if (Input.GetKeyDown(KeyCode.O)){ AlterNearSea(true); } AlterNearSea(WaterReflection.ReqRefl()); if (Mathf.Abs(_nearSeaTarget - _nearSeaCurrent) > 0.0001f) { _nearSeaCurrent = Mathf.Lerp(_nearSeaCurrent, _nearSeaTarget, 0.04f); // About 3s } if (_nearSeaCurrent < 0.001f) { WaterReflection.DisableRefl(); } else { WaterReflection.EnableRefl(); } Nova.WaterReflectionMasterBlend = _nearSeaCurrent; } // End Nova != null }