public override void ProcessNiObject(NiObjectNet niObject) { // Process properties first, as some NiNodes such as NiGeomControl will add a mesh renderer which needs the material if (propertyCount > 0) { // Create a new material for the properties to modify //Material = new Material(material); foreach (var property in properties) { niFile.NiObjects[property].NiParent = this; } } // Process Extra Data if (extraData != -1) { niFile.NiObjects[extraData].ProcessNiObject(this); } // Process Controller if (controller != -1) { niFile.NiObjects[controller].ProcessNiObject(this); } }
public override void ProcessNiObject(NiObjectNet niObject) { var animation = niObject.GameObject.AddComponent <Animation>(); animation.AddClip(clip, clip.name); animation.clip = clip; }
public override void ProcessNiObject(NiObjectNet niObject) { base.ProcessNiObject(niObject); // Create a skinned Mesh Renderer if skin is not null if (skin.Target != null) { skin.Target.ProcessNiObject(this); return; } // Check for a skinned mesh renderer as a controller may have added it if (GameObject.GetComponent <SkinnedMeshRenderer>()) { return; } if (IsRootCollision) { GameObject.AddComponent <MeshCollider>().sharedMesh = Mesh; return; } // Create a mesh filer and renderer GameObject.AddComponent <MeshFilter>().sharedMesh = Mesh; var meshRenderer = GameObject.AddComponent <MeshRenderer>(); meshRenderer.sharedMaterial = Material; meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.TwoSided; }
public override void ProcessNiObject(NiObjectNet niObject) { if (nextExtraData.Target != null) { nextExtraData.Target.ProcessNiObject(niObject); } }
public override void ProcessNiObject(NiObjectNet niObject) { var transform = Camera.main.transform; transform.SetParent(niObject.GameObject.transform, false); transform.localPosition = position; transform.localEulerAngles = new Vector3(90, 0, 0); }
public override void ProcessNiObject(NiObjectNet niObject) { if (dataIndex == -1) { return; } niFile.NiObjects[dataIndex].ProcessNiObject(niObject); }
public override void ProcessNiObject(NiObjectNet niObject) { // Place this in the same location as the emitter var emitter = niFile.NiObjects[this.emitter].GameObject; emitter.layer = LayerMask.NameToLayer("Default"); // Emitter layer might be set to hidden, so enable it var particleSystem = emitter.AddComponent <ParticleSystem>(); var particleSystemRenderer = emitter.GetComponent <ParticleSystemRenderer>(); particleSystemRenderer.sharedMaterial = niObject.Material; // This sets the alpha of the vertex to be transparency // Should probably just use a different material, as we want to support soft particles anyway particleSystemRenderer.sharedMaterial.EnableKeyword("VERTEX_DIFFUSE"); particleSystemRenderer.sharedMaterial.EnableKeyword("VERTEX_ALPHA"); // Duration var main = particleSystem.main; main.startColor = unknownColor; particleSystem.Stop(); main.duration = stopTime - startTime; // Don't set while system is playaing? particleSystem.Play(); main.startSize = size; main.startLifetime = lifetime; main.maxParticles = numParticles; // Speed and Direction var velocityOverLifetime = particleSystem.velocityOverLifetime; var vertDir = verticalAngle * (speed + speedRandom); velocityOverLifetime.x = new ParticleSystem.MinMaxCurve(-vertDir, vertDir); velocityOverLifetime.y = new ParticleSystem.MinMaxCurve((speed - speedRandom), (speed + speedRandom)); velocityOverLifetime.z = new ParticleSystem.MinMaxCurve(-vertDir, vertDir); velocityOverLifetime.enabled = true; main.startSpeed = 0; // Disabling as we want to handle direciton seperately var shape = particleSystem.shape; shape.enabled = false; // Rate var emission = particleSystem.emission; emission.rateOverTime = new ParticleSystem.MinMaxCurve(emitRate); if (particleExtra.Target != null) { particleExtra.Target.ProcessParticleSystem(particleSystem); } }
public override void ProcessNiObject(NiObjectNet niObject) { // If name is Bip01, this is a skinned mesh. (Though it could also be root bone) // If name is Bip01, find a transform of the same name and load additively from that if (Parent != null && this.Name == "Bip01") { var bip01 = FindBip01(Parent); if (bip01 != null) { IsBiped = true; GameObject = bip01.gameObject; return; } } if (IsBiped && Parent != null && this.Name.Contains("Bip")) { var child = Parent.transform.Find(this.Name); if (child != null) { GameObject = child.gameObject; return; } } // If this has no name, use the type as the name var name = this.Name; if (string.IsNullOrEmpty(name)) { name = GetType().Name; } // Create the GameObject GameObject = new GameObject(name); niFile.CreatedObjects.Add(GameObject); GameObject.layer = Layer; if (Parent != null) { GameObject.transform.parent = Parent; } // Process Extra Data if (extraData != -1) { niFile.NiObjects[extraData].ProcessNiObject(this); } // Process Controller if (controller != -1) { niFile.NiObjects[controller].ProcessNiObject(this); } }
public override void ProcessNiObject(NiObjectNet niObject) { // Add skinned mesh renderer, and set blend shapes var skinnedMeshRenderer = target.Target.GameObject.AddComponent <SkinnedMeshRenderer>(); niFile.NiObjects[dataIndex].ProcessNiObject(target.Target); skinnedMeshRenderer.updateWhenOffscreen = alwaysUpdate; skinnedMeshRenderer.sharedMesh = target.Target.Mesh; skinnedMeshRenderer.sharedMaterial = target.Target.Material; }
public override void ProcessNiObject(NiObjectNet niObject) { switch (data) { case "NCO": case "NCC": niObject.GameObject.tag = "No Collider"; break; case "MRK": niObject.GameObject.tag = "Marker"; break; } }
public override void ProcessNiObject(NiObjectNet niObject) { var root = niObject.GameObject.transform.root.gameObject; var animation = root.GetComponent <Animation>(); if (animation == null) { animation = root.AddComponent <Animation>(); } foreach (var clipInfo in niFile.animationCache) { animation.AddClip(clipInfo.Value.clip, clipInfo.Value.clip.name); } }
public override void ProcessNiObject(NiObjectNet niObject) { var zWrite = flags.HasFlag(ZBufferFlags.Enabled); niObject.Material.SetInt("_ZWrite", zWrite ? 1 : 0); var compareOp = (CompareOp)((int)flags >> 2); switch (compareOp) { case CompareOp.Always: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Always); break; case CompareOp.Less: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Less); break; case CompareOp.Equal: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Equal); break; case CompareOp.LessOrEqual: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Greater); break; case CompareOp.Greater: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Greater); break; case CompareOp.NotEqual: niObject.Material.SetInt("_ZTest", (int)CompareFunction.NotEqual); break; case CompareOp.GreaterOrEqual: niObject.Material.SetInt("_ZTest", (int)CompareFunction.GreaterEqual); break; case CompareOp.Never: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Never); break; default: niObject.Material.SetInt("_ZTest", (int)CompareFunction.Disabled); break; } }
public override void ProcessNiObject(NiObjectNet niObject) { // Process properties first, as some NiNodes such as NiGeomControl will add a mesh renderer which needs the material if (propertyCount > 0) { // Create a new material for the properties to modify //Material = new Material(material); foreach (var property in properties) { niFile.NiObjects[property].NiParent = this; } } // Process Extra Data if (extraData != -1) { niFile.NiObjects[extraData].ProcessNiObject(this); } // Process Controller if (controller != -1) { niFile.NiObjects[controller].ProcessNiObject(this); } foreach (var child in children) { if (child == -1) { continue; } niFile.NiObjects[child].IsRootCollision = IsRootCollision; niFile.NiObjects[child].Layer = NiParent.Layer; niFile.NiObjects[child].IsBiped = IsBiped; niFile.NiObjects[child].Parent = NiParent.GameObject.transform; niFile.NiObjects[child].ProcessNiObject(this); } foreach (var effect in effects) { niFile.NiObjects[effect].ProcessNiObject(this); } }
public override void ProcessNiObject(NiObjectNet niObject) { // Process properties first, as some NiNodes such as NiGeomControl will add a mesh renderer which needs the material if (propertyCount > 0) { // Create a new material for the properties to modify //Material = new Material(material); foreach (var property in properties) { niFile.NiObjects[property].NiParent = this; } } base.ProcessNiObject(niObject); if (NiParent != null) { GameObject.tag = NiParent.GameObject.tag; GameObject.layer = NiParent.GameObject.layer; } if (flags.HasFlag(Flags.Hidden)) { GameObject.tag = "Hidden"; // Set tag and layer, so we can easily check if an object is hidden/marker etc by checking it's tag GameObject.layer = LayerMask.NameToLayer("Hidden"); //GameObject.hideFlags = HideFlags.HideInHierarchy; } if (flags.HasFlag(Flags.Shadow)) { GameObject.tag = "Shadow"; } // Set transform (Use localPosition/rotation as this may be already parented) GameObject.transform.localPosition = position; GameObject.transform.localRotation = rotation; GameObject.transform.localScale = new Vector3(scale, scale, scale); if (hasBoundingBox) { boundingBox.AddCollider(GameObject); } }
public override void ProcessNiObject(NiObjectNet niObject) { base.ProcessNiObject(niObject); foreach (var child in children) { if (child == -1) { continue; } niFile.NiObjects[child].IsRootCollision = IsRootCollision; niFile.NiObjects[child].Layer = GameObject.layer; niFile.NiObjects[child].IsBiped = IsBiped; niFile.NiObjects[child].Parent = GameObject.transform; niFile.NiObjects[child].ProcessNiObject(this); } foreach (var effect in effects) { niFile.NiObjects[effect].ProcessNiObject(this); } }
public override void ProcessNiObject(NiObjectNet niObject) { niFile.NiObjects[data].ProcessNiObject(niObject); var skinnedMeshRenderer = niObject.GameObject.AddComponent <SkinnedMeshRenderer>(); skinnedMeshRenderer.sharedMesh = niObject.Mesh; skinnedMeshRenderer.sharedMaterial = niObject.Material; skinnedMeshRenderer.rootBone = niFile.NiObjects[rootBone].GameObject.transform; var boneList = new Transform[bones.Length]; for (var i = 0; i < bones.Length; i++) { var boneNiObject = niFile.NiObjects[bones[i]]; var gameObject = boneNiObject.GameObject; var transform = gameObject.transform; boneList[i] = transform; } skinnedMeshRenderer.bones = boneList; skinnedMeshRenderer.localBounds = skinnedMeshRenderer.sharedMesh.bounds; skinnedMeshRenderer.updateWhenOffscreen = true; }
public override void ProcessNiObject(NiObjectNet niObject) { }
public virtual void ProcessNiObject(NiObjectNet niObject) { }
public override void ProcessNiObject(NiObjectNet niObject) { niObject.Mesh.boneWeights = boneWeights; niObject.Mesh.bindposes = bindPoses; }
public override void ProcessNiObject(NiObjectNet niObject) { IsRootCollision = true; base.ProcessNiObject(niObject); }