private bool CreateRagdoll() { if (this.ragdollPrefab != null) { ArmorModelRenderer local = this.ragdollPrefab.GetLocal <ArmorModelRenderer>(); if (local != null) { AnimationClip clip; float num; ActorRig actorRig = local.actorRig; if ((actorRig != null) && actorRig.FindPoseClip("sleep", out clip, out num)) { this.ragdollInstance = Object.Instantiate(this.ragdollPrefab, base.transform.position, base.transform.rotation) as Ragdoll; this.ragdollInstance.sourceMain = this; GameObject gameObject = this.ragdollInstance.gameObject; Object.Destroy(gameObject, 80f); gameObject.SampleAnimation(clip, num); local = this.ragdollInstance.GetLocal <ArmorModelRenderer>(); ArmorModelMemberMap map = new ArmorModelMemberMap(); bool flag = false; flag |= BindArmorMap <ArmorModelFeet>(this.footArmor, ref map); flag |= BindArmorMap <ArmorModelLegs>(this.legArmor, ref map); flag |= BindArmorMap <ArmorModelTorso>(this.torsoArmor, ref map); if (flag | BindArmorMap <ArmorModelHead>(this.headArmor, ref map)) { local.BindArmorModels(map); } return(true); } } } return(false); }
public ArmorModelCollection(ArmorModelMemberMap <T> map) : this() { for (ArmorModelSlot i = ArmorModelSlot.Feet; (int)i < 4; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { this[i] = map[i]; } }
private bool CreateRagdoll() { AnimationClip animationClip; float single; if (this.ragdollPrefab) { ArmorModelRenderer local = this.ragdollPrefab.GetLocal <ArmorModelRenderer>(); if (local) { ActorRig actorRig = local.actorRig; if (actorRig) { if (actorRig.FindPoseClip("sleep", out animationClip, out single)) { this.ragdollInstance = UnityEngine.Object.Instantiate(this.ragdollPrefab, base.transform.position, base.transform.rotation) as Ragdoll; this.ragdollInstance.sourceMain = this; GameObject gameObject = this.ragdollInstance.gameObject; UnityEngine.Object.Destroy(gameObject, 80f); gameObject.SampleAnimation(animationClip, single); local = this.ragdollInstance.GetLocal <ArmorModelRenderer>(); ArmorModelMemberMap armorModelMemberMaps = new ArmorModelMemberMap(); if (false | SleepingAvatar.BindArmorMap <ArmorModelFeet>(this.footArmor, ref armorModelMemberMaps) | SleepingAvatar.BindArmorMap <ArmorModelLegs>(this.legArmor, ref armorModelMemberMaps) | SleepingAvatar.BindArmorMap <ArmorModelTorso>(this.torsoArmor, ref armorModelMemberMaps) | SleepingAvatar.BindArmorMap <ArmorModelHead>(this.headArmor, ref armorModelMemberMaps)) { local.BindArmorModels(armorModelMemberMaps); } return(true); } } } } return(false); }
public ArmorModelCollection(ArmorModelMemberMap <T> map) : this() { for (ArmorModelSlot slot = ArmorModelSlot.Feet; slot < ((ArmorModelSlot)4); slot = (ArmorModelSlot)(((int)slot) + 1)) { this[slot] = map[slot]; } }
public ArmorModelMemberMap(T defaultValue) { this = new ArmorModelMemberMap <T>(); for (ArmorModelSlot i = ArmorModelSlot.Feet; (int)i < 4; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { this[i] = defaultValue; } }
public ArmorModelMemberMap(ArmorModelMemberMap <ArmorModel> map) { this = new ArmorModelMemberMap(); for (ArmorModelSlot i = ArmorModelSlot.Feet; (int)i < 4; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { this[i] = map[i]; } }
public ArmorModelMemberMap(ArmorModelMemberMap <ArmorModel> map) { this = new ArmorModelMemberMap(); for (ArmorModelSlot slot = ArmorModelSlot.Feet; slot < ((ArmorModelSlot)4); slot = (ArmorModelSlot)(((int)slot) + 1)) { this[slot] = map[slot]; } }
public bool MoveNext() { ArmorModelMemberMap <T> .Enumerator enumerator = this; int num = enumerator.index + 1; int num1 = num; enumerator.index = num; return(num1 < 4); }
public ArmorModelMemberMap <ArmorModel> ToGenericArmorModelMap() { ArmorModelMemberMap <ArmorModel> map = new ArmorModelMemberMap <ArmorModel>(); for (ArmorModelSlot slot = ArmorModelSlot.Feet; slot < ((ArmorModelSlot)4); slot = (ArmorModelSlot)(((int)slot) + 1)) { map[slot] = this[slot]; } return(map); }
public ArmorModelMemberMap <T> ToMemberMap() { ArmorModelMemberMap <T> item = new ArmorModelMemberMap <T>(); for (ArmorModelSlot i = ArmorModelSlot.Feet; (int)i < 4; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { item[i] = this[i]; } return(item); }
private static bool BindArmorMap <TArmorModel>(ArmorDataBlock armor, ref ArmorModelMemberMap map) where TArmorModel : ArmorModel, new() { if (armor != null) { TArmorModel armorModel = armor.GetArmorModel <TArmorModel>(); if (armorModel != null) { map.SetArmorModel <TArmorModel>(armorModel); return(true); } } return(false); }
public ArmorModelSlotMask BindArmorModels(ArmorModelMemberMap map) { if (!this.awake) { return(this.Initialize(map, ArmorModelSlotMask.Feet | ArmorModelSlotMask.Legs | ArmorModelSlotMask.Torso | ArmorModelSlotMask.Head)); } ArmorModelSlotMask mask = (ArmorModelSlotMask)0; for (ArmorModelSlot i = ArmorModelSlot.Feet; (int)i < 4; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { if (this.BindArmorModel(map[i], i)) { mask = mask | i.ToMask(); } } return(mask); }
public ArmorModelSlotMask BindArmorModels(ArmorModelMemberMap map, ArmorModelSlotMask slotMask) { if (!this.awake) { return(this.Initialize(map, slotMask)); } ArmorModelSlotMask mask = 0; foreach (ArmorModelSlot slot in slotMask.EnumerateSlots()) { if (this.BindArmorModel(map[slot], slot)) { mask |= slot.ToMask(); } } return(mask); }
public ArmorModelSlotMask BindArmorModels(ArmorModelMemberMap map) { if (!this.awake) { return(this.Initialize(map, ArmorModelSlotMask.Head | ArmorModelSlotMask.Torso | ArmorModelSlotMask.Legs | ArmorModelSlotMask.Feet)); } ArmorModelSlotMask mask = 0; for (ArmorModelSlot slot = ArmorModelSlot.Feet; slot < ((ArmorModelSlot)4); slot = (ArmorModelSlot)(((int)slot) + 1)) { if (this.BindArmorModel(map[slot], slot)) { mask |= slot.ToMask(); } } return(mask); }
public ArmorModelSlotMask BindArmorModels(ArmorModelMemberMap map, ArmorModelSlotMask slotMask) { if (!this.awake) { return(this.Initialize(map, slotMask)); } ArmorModelSlotMask mask = (ArmorModelSlotMask)0; ArmorModelSlot[] armorModelSlotArray = slotMask.EnumerateSlots(); for (int i = 0; i < (int)armorModelSlotArray.Length; i++) { ArmorModelSlot armorModelSlot = armorModelSlotArray[i]; if (this.BindArmorModel(map[armorModelSlot], armorModelSlot)) { mask = mask | armorModelSlot.ToMask(); } } return(mask); }
public void Dispose() { this = new ArmorModelMemberMap <T> .Enumerator(); }
internal Enumerator(ArmorModelMemberMap <T> collection) { this.collection = collection; this.index = -1; }
private ArmorModelSlotMask Initialize(ArmorModelMemberMap memberMap, ArmorModelSlotMask memberMask) { ActorMeshRenderer actorMeshRenderer; this.awake = true; string rendererName = ArmorModelSlot.Head.GetRendererName(); ActorRig item = this.defaultArmorModelGroup[ArmorModelSlot.Head].actorRig; actorMeshRenderer = (!this.originalRenderer ? ActorMeshRenderer.CreateOn(base.transform, rendererName, item, this.boneStructure.rigOrderedTransformArray, base.gameObject.layer) : ActorMeshRenderer.Replace(this.originalRenderer, item, this.boneStructure.rigOrderedTransformArray, rendererName)); this.renderers[ArmorModelSlot.Head] = actorMeshRenderer; for (ArmorModelSlot i = ArmorModelSlot.Feet; i < ArmorModelSlot.Head; i = (ArmorModelSlot)((byte)i + (byte)ArmorModelSlot.Legs)) { this.renderers[i] = actorMeshRenderer.CloneBlank(i.GetRendererName()); } for (ArmorModelSlot j = ArmorModelSlot.Feet; j < ArmorModelSlot.Head; j = (ArmorModelSlot)((byte)j + (byte)ArmorModelSlot.Legs)) { ActorMeshRenderer item1 = this.renderers[j]; if (item1) { item1.renderer.enabled = base.enabled; } } ArmorModelSlotMask mask = (ArmorModelSlotMask)0; ArmorModelGroup armorModelGroups = this.defaultArmorModelGroup; if (!armorModelGroups) { ArmorModelSlot[] armorModelSlotArray = memberMask.EnumerateSlots(); for (int k = 0; k < (int)armorModelSlotArray.Length; k++) { ArmorModelSlot armorModelSlot = armorModelSlotArray[k]; ArmorModel armorModel = memberMap.GetArmorModel(armorModelSlot); if (armorModel && this.BindArmorModelCheckedNonNull(armorModel)) { mask = mask | armorModelSlot.ToMask(); } } } else { for (ArmorModelSlot l = ArmorModelSlot.Feet; (int)l < 4; l = (ArmorModelSlot)((byte)l + (byte)ArmorModelSlot.Legs)) { if (memberMask.Contains(l)) { ArmorModel armorModel1 = memberMap.GetArmorModel(l); if (!armorModel1 || !this.BindArmorModelCheckedNonNull(armorModel1)) { goto Label1; } mask = mask | l.ToMask(); goto Label0; } Label1: ArmorModel item2 = armorModelGroups[l]; if (item2) { this.BindArmorModelCheckedNonNull(item2); } Label0: } } return(mask); }
private ArmorModelSlotMask Initialize(ArmorModelMemberMap memberMap, ArmorModelSlotMask memberMask) { ActorMeshRenderer renderer; this.awake = true; string rendererName = ArmorModelSlot.Head.GetRendererName(); ActorRig actorRig = this.defaultArmorModelGroup[ArmorModelSlot.Head].actorRig; if (this.originalRenderer != null) { renderer = ActorMeshRenderer.Replace(this.originalRenderer, actorRig, this.boneStructure.rigOrderedTransformArray, rendererName); } else { renderer = ActorMeshRenderer.CreateOn(base.transform, rendererName, actorRig, this.boneStructure.rigOrderedTransformArray, base.gameObject.layer); } this.renderers[ArmorModelSlot.Head] = renderer; for (ArmorModelSlot slot = ArmorModelSlot.Feet; slot < ArmorModelSlot.Head; slot = (ArmorModelSlot)(((int)slot) + 1)) { this.renderers[slot] = renderer.CloneBlank(slot.GetRendererName()); } for (ArmorModelSlot slot2 = ArmorModelSlot.Feet; slot2 < ArmorModelSlot.Head; slot2 = (ArmorModelSlot)(((int)slot2) + 1)) { ActorMeshRenderer renderer2 = this.renderers[slot2]; if (renderer2 != null) { renderer2.renderer.enabled = base.enabled; } } ArmorModelSlotMask mask = 0; ArmorModelGroup defaultArmorModelGroup = this.defaultArmorModelGroup; if (defaultArmorModelGroup != null) { for (ArmorModelSlot slot3 = ArmorModelSlot.Feet; slot3 < ((ArmorModelSlot)4); slot3 = (ArmorModelSlot)(((int)slot3) + 1)) { if (memberMask.Contains(slot3)) { ArmorModel armorModel = memberMap.GetArmorModel(slot3); if ((armorModel != null) && this.BindArmorModelCheckedNonNull(armorModel)) { mask |= slot3.ToMask(); continue; } } ArmorModel model2 = defaultArmorModelGroup[slot3]; if (model2 != null) { this.BindArmorModelCheckedNonNull(model2); } } return(mask); } foreach (ArmorModelSlot slot4 in memberMask.EnumerateSlots()) { ArmorModel model = memberMap.GetArmorModel(slot4); if ((model != null) && this.BindArmorModelCheckedNonNull(model)) { mask |= slot4.ToMask(); } } return(mask); }