public ChassisVisuals( ) { Decals.Add(new Decal { ID = 10000, Usage = 0xff, Color = 0xffffffff, Transform = new Half[] { (Half)0.052460, (Half)0.019623, (Half)0, (Half)0.007484, (Half)(-0.020020), (Half)(-0.051758), (Half)0.018127, (Half)(-0.048492), (Half)0.021362, (Half)0.108154, (Half)(-0.105469), (Half)1.495117, } }); Colors.Add(0x10000020u); Colors.Add(0xc8000000u); Colors.Add(0xfe206281u); Colors.Add(0xc8000000u); Colors.Add(0xc8000000u); Colors.Add(0xf5621861u); Colors.Add(0xf5621861u); Palettes.Add(new Palette { ID = 85163, Type = Enums.Visuals.PaletteType.FullBody }); Patterns.Add(new Pattern { ID = 10022, Usage = 0x0, Transform = new Half[] { 0, Half.ToHalf((ushort)16384u), 0, 0 } }); }
/// <summary> /// Checks to see if the hit colldier has a valid tag override and return the Decal class related to that override. If not returns the first/blank element. /// </summary> /// <param name="hit">Raycast hit information.</param> /// <returns></returns> private Decals CheckOverrides(RaycastHit hit) { Decals defaultDecals = null; string tag = hit.collider.tag; for (int i = 0; i < decals.Length; i++) { if (decals[i].overrideTag == "") { defaultDecals = decals[i]; } if (tag == decals[i].overrideTag) { return(decals[i]); } } if (decals.Length > 0) { defaultDecals = decals[0]; } return(defaultDecals); }
public FootPlanting(FootStepSoundsAndFx _props, Animator _animator) { footStepProps = _props; surfaces = _props.surfaces; m_AnimatorKinematics = new AnimatorKinematics(_animator); m_Animator = _animator; OnLeftFootPlantAction += OnLeftFootPlant; OnRightFootPlantAction += OnRightFootPlant; decalScript = GameObject.FindGameObjectWithTag("EnvFx").GetComponent <Decals>(); }
void LayoutItems() { EnsureControlsAdded(); int vcentre = ClientRectangle.Height / 2; int hcentre = ClientRectangle.Width / 2; int husabled = ClientRectangle.Width - Padding.Horizontal; backgroundpanel.Size = ClientRectangle.Size; textlab.Location = new Point(Padding.Left, Padding.Top); textlab.Size = new Size(husabled, 20); int buttonvtop = ClientRectangle.Height; if (Buttons != null) { int totalwidth = (from x in Buttons select x.Width).Sum() + (Buttons.Count() - 1) * ButtonSpacing; int maxvertheight = (from x in Buttons select x.Height).Max(); int buttonvcentre = ClientRectangle.Height - Padding.Bottom - maxvertheight / 2; buttonvtop = buttonvcentre - maxvertheight / 2; //System.Diagnostics.Debug.WriteLine("Button vline at " + buttonvcentre); int sp = hcentre - totalwidth / 2; foreach (ExtButton b in Buttons) { b.Location = new Point(sp, buttonvcentre - b.Height / 2); //System.Diagnostics.Debug.WriteLine("Button {0} {1}", b.Name, b.Location); sp += b.Width + ButtonSpacing; } } if (Decals != null) { int totalwidth = (from x in Decals select x.Width).Sum() + (Decals.Count() - 1) * DecalSpacing; int maxvertheight = (from x in Decals select x.Height).Max(); int decalvcentre = vcentre; if (decalvcentre + maxvertheight / 2 >= buttonvtop) { decalvcentre = buttonvtop - maxvertheight / 2 - MinimumDecalButtonVerticalSpacing; } //System.Diagnostics.Debug.WriteLine("Decal vline at " + decalvcentre); int sp = hcentre - totalwidth / 2; foreach (Panel bm in Decals) { bm.Location = new Point(sp, decalvcentre - bm.Height / 2); sp += bm.Width + DecalSpacing; } } Invalidate(); }
private void Awake() { decals = GameObject.FindGameObjectWithTag("EnvFx").GetComponent <Decals>(); if (isFiringProjectile && firesCurClipObject) { currentClipCapacity = 1; maxClipCapacity = 1; } if (curClipObject) { clipDefLocalPos = curClipObject.localPosition; clipDefLocalRot = curClipObject.localRotation; DisableRbAndCol(curClipObject); } }
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("LevelModifier", false, out subEle)) { if (LevelModifier == null) { LevelModifier = new SimpleSubrecord <Int32>(); } LevelModifier.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("MerchantContainer", false, out subEle)) { if (MerchantContainer == null) { MerchantContainer = new RecordReference(); } MerchantContainer.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("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 "XLCM": if (LevelModifier == null) { LevelModifier = new SimpleSubrecord <Int32>(); } LevelModifier.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 "XMRC": if (MerchantContainer == null) { MerchantContainer = new RecordReference(); } MerchantContainer.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 "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(); } } }
private void Awake() { decals = GameObject.FindGameObjectWithTag("EnvFx").GetComponent <Decals>(); GetDefault(); ManageParts(); }
/// <summary> /// Get a projector from the pool and place it at the correct location and rotation. Activate the gameobject and adjust the size, material and parent transform. /// </summary> /// <param name="position">The position in the world where the projector will be placed.</param> /// <param name="rotation">The rotation in the world where the projector will be placed.</param> /// <param name="hit">Details from the raycast hit.</param> /// <param name="_decals">Materials for each of the decals to be randomly projected.</param> private void DrawDecalProjector(Vector3 position, Quaternion rotation, RaycastHit hit, Decals _decals) { GameObject projector = ObjectPooler.instance.GetPooledObject(); if (projector != null && _decals.decals != null) { projector.transform.position = position; projector.transform.rotation = Quaternion.FromToRotation(Vector3.forward, -hit.normal); projector.SetActive(true); int randIndex = Random.Range(0, _decals.decals.Length); Material randMaterial = _decals.decals[randIndex]; Projector _projector = projector.GetComponentInChildren <Projector>(); _projector.material = randMaterial; _projector.orthographicSize = _decals.decalSize; _projector.farClipPlane = _decals.decalDepth; SetParentObject(projector, hit.collider.gameObject); } }