public bool SetInfo(ParticleEmitterInfo info) { // destroy first? Info = info; if (Info.HWGfxObjID == 0) { // destroy return(false); } PhysicsObj = PhysicsObj.makeParticleObject(Info.MaxParticles, Info.SortingSphere); LastEmitOffset = PhysicsObj.Position.Frame.Origin.Copy(); Parts = PhysicsObj.PartArray.Parts; PartStorage = new PhysicsPart[Info.MaxParticles]; for (var i = 0; i < Info.MaxParticles; i++) { PartStorage[i] = PhysicsPart.MakePhysicsPart(Info.HWGfxObjID); } // omitted degrade distance DegradeDistance = float.MaxValue; Particles = new Particle[Info.MaxParticles]; for (var i = 0; i < Info.MaxParticles; i++) { Particles[i] = new Particle(); // ?? } return(true); }
public bool InitParts() { NumParts = Setup.NumParts; if (NumParts == 0) { return(false); } Parts = new List <PhysicsPart>(NumParts); for (var i = 0; i < NumParts; i++) { Parts.Add(null); } if (Setup.Parts == null) { return(true); } // does this need to be pre-initialized / // can this part fail? var created = 0; for (var i = 0; i < NumParts; i++) { Parts[i] = PhysicsPart.MakePhysicsPart(Setup.Parts[i]); if (Parts[i] == null) { break; } created++; } if (created == NumParts) { for (var i = 0; i < NumParts; i++) { Parts[i].PhysObj = Owner; Parts[i].PhysObjIndex = i; } // can defaultscale count be less than numparts? if (Setup.DefaultScale != null && Setup.DefaultScale.Count == NumParts) { for (var i = 0; i < NumParts; i++) { Parts[i].GfxObjScale = Setup.DefaultScale[i]; } } return(true); } return(false); }
public bool MorphToExistingObject(PartArray obj) { DestroyParts(); Setup = obj.Setup; // add reference? Scale = new Vector3(obj.Scale.X, obj.Scale.Y, obj.Scale.Z); NumParts = obj.NumParts; Parts = new List <PhysicsPart>((int)obj.NumParts); InitPals(); for (var i = 0; i < NumParts; i++) { Parts[i] = PhysicsPart.MakePhysicsPart(obj.Parts[i]); Parts[i].PhysObj = Owner; Parts[i].PhysObjIndex = i; // removed palette references } return(true); }