void UpdateAttachPointTransform(tk2dSpriteDefinition.AttachPoint attachPoint, Transform t) { t.localPosition = Vector3.Scale(attachPoint.position, sprite.scale); t.localScale = sprite.scale; float scl = Mathf.Sign(sprite.scale.x) * Mathf.Sign(sprite.scale.y); t.localEulerAngles = new Vector3(0, 0, attachPoint.angle * scl); // handle angle fixup }
public void DrawAttachPointInspector(tk2dSpriteCollectionDefinition param, Texture2D texture) { // catalog all names HashSet <string> apHashSet = new HashSet <string>(); foreach (tk2dSpriteCollectionDefinition def in SpriteCollection.textureParams) { foreach (tk2dSpriteDefinition.AttachPoint currAp in def.attachPoints) { apHashSet.Add(currAp.name); } } Dictionary <string, int> apNameLookup = new Dictionary <string, int>(); List <string> apNames = new List <string>(apHashSet); for (int i = 0; i < apNames.Count; ++i) { apNameLookup.Add(apNames[i], i); } apNames.Add("Create..."); int toDelete = -1; tk2dSpriteGuiUtility.showOpenEditShortcuts = false; tk2dSpriteDefinition.AttachPoint newEditingAttachPointName = editingAttachPointName; int apIdx = 0; foreach (var ap in param.attachPoints) { GUILayout.BeginHorizontal(); if (editingAttachPointName == ap) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) { newEditingAttachPointName = null; HandleUtility.Repaint(); GUIUtility.keyboardControl = 0; } ap.name = GUILayout.TextField(ap.name); } else { int sel = EditorGUILayout.Popup(apNameLookup[ap.name], apNames.ToArray()); if (sel == apNames.Count - 1) { newEditingAttachPointName = ap; HandleUtility.Repaint(); } else { ap.name = apNames[sel]; } } ap.angle = EditorGUILayout.FloatField(ap.angle, GUILayout.Width(45)); if (GUILayout.Button("x", GUILayout.Width(22))) { toDelete = apIdx; } GUILayout.EndHorizontal(); if (showAttachPointSprites) { bool pushGUIEnabled = GUI.enabled; string tmpName; if (editingAttachPointName != ap) { tmpName = ap.name; } else { tmpName = ""; GUI.enabled = false; } tk2dSpriteCollection.AttachPointTestSprite spriteProxy = null; if (!SpriteCollection.attachPointTestSprites.TryGetValue(tmpName, out spriteProxy)) { spriteProxy = new tk2dSpriteCollection.AttachPointTestSprite(); SpriteCollection.attachPointTestSprites.Add(tmpName, spriteProxy); } tk2dSpriteGuiUtility.SpriteSelector(spriteProxy.spriteCollection, spriteProxy.spriteId, AttachPointSpriteHandler, tmpName); GUI.enabled = pushGUIEnabled; } editingAttachPointName = newEditingAttachPointName; ++apIdx; } if (GUILayout.Button("Add AttachPoint")) { // Find an unused attach point name string unused = ""; foreach (string n in apHashSet) { bool used = false; for (int i = 0; i < param.attachPoints.Count; ++i) { if (n == param.attachPoints[i].name) { used = true; break; } } if (!used) { unused = n; break; } } tk2dSpriteDefinition.AttachPoint ap = new tk2dSpriteDefinition.AttachPoint(); ap.name = unused; ap.position = Vector3.zero; param.attachPoints.Add(ap); if (unused == "") { editingAttachPointName = ap; } } if (toDelete != -1) { param.attachPoints.RemoveAt(toDelete); HandleUtility.Repaint(); } showAttachPointSprites = GUILayout.Toggle(showAttachPointSprites, "Preview", "button"); tk2dSpriteGuiUtility.showOpenEditShortcuts = true; }
public void DrawAttachPointInspector(tk2dSpriteCollectionDefinition param, Texture2D texture) { // catalog all names HashSet<string> apHashSet = new HashSet<string>(); foreach (tk2dSpriteCollectionDefinition def in SpriteCollection.textureParams) { foreach (tk2dSpriteDefinition.AttachPoint currAp in def.attachPoints) { apHashSet.Add( currAp.name ); } } Dictionary<string, int> apNameLookup = new Dictionary<string, int>(); List<string> apNames = new List<string>( apHashSet ); for (int i = 0; i < apNames.Count; ++i) { apNameLookup.Add( apNames[i], i ); } apNames.Add( "Create..." ); attachPointScroll = EditorGUILayout.BeginScrollView(attachPointScroll); int toDelete = -1; tk2dSpriteGuiUtility.showOpenEditShortcuts = false; tk2dSpriteDefinition.AttachPoint newEditingAttachPointName = editingAttachPointName; int apIdx = 0; foreach (var ap in param.attachPoints) { GUILayout.BeginHorizontal(); if (editingAttachPointName == ap) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) { newEditingAttachPointName = null; HandleUtility.Repaint(); GUIUtility.keyboardControl = 0; } ap.name = GUILayout.TextField(ap.name); } else { int sel = EditorGUILayout.Popup(apNameLookup[ap.name], apNames.ToArray()); if (sel == apNames.Count - 1) { newEditingAttachPointName = ap; HandleUtility.Repaint(); } else { ap.name = apNames[sel]; } } ap.angle = EditorGUILayout.FloatField(ap.angle, GUILayout.Width(45)); if (GUILayout.Button("x", GUILayout.Width(22))) { toDelete = apIdx; } GUILayout.EndHorizontal(); if (showAttachPointSprites) { bool pushGUIEnabled = GUI.enabled; string tmpName; if (editingAttachPointName != ap) { tmpName = ap.name; } else { tmpName = ""; GUI.enabled = false; } tk2dSpriteCollection.AttachPointTestSprite spriteProxy = null; if (!SpriteCollection.attachPointTestSprites.TryGetValue(tmpName, out spriteProxy)) { spriteProxy = new tk2dSpriteCollection.AttachPointTestSprite(); SpriteCollection.attachPointTestSprites.Add( tmpName, spriteProxy ); } tk2dSpriteGuiUtility.SpriteSelector( spriteProxy.spriteCollection, spriteProxy.spriteId, AttachPointSpriteHandler, tmpName ); GUI.enabled = pushGUIEnabled; } editingAttachPointName = newEditingAttachPointName; ++apIdx; } EditorGUILayout.EndScrollView(); if (GUILayout.Button("Add AttachPoint")) { // Find an unused attach point name string unused = ""; foreach (string n in apHashSet) { bool used = false; for (int i = 0; i < param.attachPoints.Count; ++i) { if (n == param.attachPoints[i].name) { used = true; break; } } if (!used) { unused = n; break; } } tk2dSpriteDefinition.AttachPoint ap = new tk2dSpriteDefinition.AttachPoint(); ap.name = unused; ap.position = Vector3.zero; param.attachPoints.Add(ap); if (unused == "") { editingAttachPointName = ap; } } if (toDelete != -1) { param.attachPoints.RemoveAt(toDelete); HandleUtility.Repaint(); } showAttachPointSprites = GUILayout.Toggle(showAttachPointSprites, "Preview", "button"); tk2dSpriteGuiUtility.showOpenEditShortcuts = true; }
public void TransformToTargetGunSpecial(Gun targetGun) { int clipShotsRemaining = this.gun.ClipShotsRemaining; if (((VFXPool)m_currentlyPlayingChargeVFX_info.GetValue(this.gun)) != null) { ((VFXPool)m_currentlyPlayingChargeVFX_info.GetValue(this.gun)).DestroyAll(); m_currentlyPlayingChargeVFX_info.SetValue(this.gun, null); } ProjectileVolleyData volley = this.gun.Volley; this.gun.RawSourceVolley = targetGun.RawSourceVolley; this.gun.singleModule = targetGun.singleModule; this.gun.modifiedVolley = null; if (targetGun.sprite) { this.gun.DefaultSpriteID = targetGun.sprite.spriteId; this.gun.GetSprite().SetSprite(targetGun.sprite.Collection, this.gun.DefaultSpriteID); if (base.spriteAnimator && targetGun.spriteAnimator) { base.spriteAnimator.Library = targetGun.spriteAnimator.Library; } tk2dSpriteDefinition.AttachPoint[] attachPoints = this.gun.GetSprite().Collection.GetAttachPoints(this.gun.DefaultSpriteID); tk2dSpriteDefinition.AttachPoint attachPoint; if (attachPoints != null) { attachPoint = Array.Find(attachPoints, (tk2dSpriteDefinition.AttachPoint a) => a.name == "PrimaryHand"); } else { attachPoint = null; } tk2dSpriteDefinition.AttachPoint attachPoint2 = attachPoint; if (attachPoint2 != null) { m_defaultLocalPosition_info.SetValue(this.gun, -attachPoint2.position); } } if (targetGun.GetBaseMaxAmmo() != this.gun.GetBaseMaxAmmo() && targetGun.GetBaseMaxAmmo() > 0) { int num = (!this.gun.InfiniteAmmo) ? this.gun.AdjustedMaxAmmo : this.gun.GetBaseMaxAmmo(); this.gun.SetBaseMaxAmmo(targetGun.GetBaseMaxAmmo()); if (this.gun.AdjustedMaxAmmo > 0 && num > 0 && this.gun.ammo > 0 && !this.gun.InfiniteAmmo) { this.gun.ammo = Mathf.FloorToInt((float)this.gun.ammo / (float)num * (float)this.gun.AdjustedMaxAmmo); this.gun.ammo = Mathf.Min(this.gun.ammo, this.gun.AdjustedMaxAmmo); } else { this.gun.ammo = Mathf.Min(this.gun.ammo, this.gun.GetBaseMaxAmmo()); } } this.gun.gunSwitchGroup = targetGun.gunSwitchGroup; this.gun.isAudioLoop = targetGun.isAudioLoop; this.gun.gunClass = targetGun.gunClass; if (!string.IsNullOrEmpty(this.gun.gunSwitchGroup)) { AkSoundEngine.SetSwitch("WPN_Guns", this.gun.gunSwitchGroup, base.gameObject); } this.gun.currentGunDamageTypeModifiers = targetGun.currentGunDamageTypeModifiers; this.gun.carryPixelOffset = targetGun.carryPixelOffset; this.gun.carryPixelUpOffset = targetGun.carryPixelUpOffset; this.gun.carryPixelDownOffset = targetGun.carryPixelDownOffset; this.gun.leftFacingPixelOffset = targetGun.leftFacingPixelOffset; this.gun.UsesPerCharacterCarryPixelOffsets = targetGun.UsesPerCharacterCarryPixelOffsets; this.gun.PerCharacterPixelOffsets = targetGun.PerCharacterPixelOffsets; this.gun.gunPosition = targetGun.gunPosition; this.gun.forceFlat = targetGun.forceFlat; if (targetGun.GainsRateOfFireAsContinueAttack != this.gun.GainsRateOfFireAsContinueAttack) { this.gun.GainsRateOfFireAsContinueAttack = targetGun.GainsRateOfFireAsContinueAttack; this.gun.RateOfFireMultiplierAdditionPerSecond = targetGun.RateOfFireMultiplierAdditionPerSecond; } if (this.gun.barrelOffset && targetGun.barrelOffset) { this.gun.barrelOffset.localPosition = targetGun.barrelOffset.localPosition; m_originalBarrelOffsetPosition_info.SetValue(this.gun, targetGun.barrelOffset.localPosition); } if (this.gun.muzzleOffset && targetGun.muzzleOffset) { this.gun.muzzleOffset.localPosition = targetGun.muzzleOffset.localPosition; m_originalMuzzleOffsetPosition_info.SetValue(this.gun, targetGun.muzzleOffset.localPosition); } if (this.gun.chargeOffset && targetGun.chargeOffset) { this.gun.chargeOffset.localPosition = targetGun.chargeOffset.localPosition; m_originalChargeOffsetPosition_info.SetValue(this.gun, targetGun.chargeOffset.localPosition); } this.gun.reloadTime = targetGun.reloadTime; this.gun.blankDuringReload = targetGun.blankDuringReload; this.gun.blankReloadRadius = targetGun.blankReloadRadius; this.gun.reflectDuringReload = targetGun.reflectDuringReload; this.gun.blankKnockbackPower = targetGun.blankKnockbackPower; this.gun.blankDamageToEnemies = targetGun.blankDamageToEnemies; this.gun.blankDamageScalingOnEmptyClip = targetGun.blankDamageScalingOnEmptyClip; this.gun.doesScreenShake = targetGun.doesScreenShake; this.gun.gunScreenShake = targetGun.gunScreenShake; this.gun.directionlessScreenShake = targetGun.directionlessScreenShake; this.gun.AppliesHoming = targetGun.AppliesHoming; this.gun.AppliedHomingAngularVelocity = targetGun.AppliedHomingAngularVelocity; this.gun.AppliedHomingDetectRadius = targetGun.AppliedHomingDetectRadius; this.gun.GoopReloadsFree = targetGun.GoopReloadsFree; this.gun.gunHandedness = targetGun.gunHandedness; m_cachedGunHandedness_info.SetValue(this.gun, null); this.gun.shootAnimation = targetGun.shootAnimation; this.gun.usesContinuousFireAnimation = targetGun.usesContinuousFireAnimation; this.gun.reloadAnimation = targetGun.reloadAnimation; this.gun.emptyReloadAnimation = targetGun.emptyReloadAnimation; this.gun.idleAnimation = targetGun.idleAnimation; this.gun.chargeAnimation = targetGun.chargeAnimation; this.gun.dischargeAnimation = targetGun.dischargeAnimation; this.gun.emptyAnimation = targetGun.emptyAnimation; this.gun.introAnimation = targetGun.introAnimation; this.gun.finalShootAnimation = targetGun.finalShootAnimation; this.gun.enemyPreFireAnimation = targetGun.enemyPreFireAnimation; this.gun.dodgeAnimation = targetGun.dodgeAnimation; this.gun.muzzleFlashEffects = targetGun.muzzleFlashEffects; this.gun.usesContinuousMuzzleFlash = targetGun.usesContinuousMuzzleFlash; this.gun.finalMuzzleFlashEffects = targetGun.finalMuzzleFlashEffects; this.gun.reloadEffects = targetGun.reloadEffects; this.gun.emptyReloadEffects = targetGun.emptyReloadEffects; this.gun.activeReloadSuccessEffects = targetGun.activeReloadSuccessEffects; this.gun.activeReloadFailedEffects = targetGun.activeReloadFailedEffects; this.gun.shellCasing = targetGun.shellCasing; this.gun.shellsToLaunchOnFire = targetGun.shellsToLaunchOnFire; this.gun.shellCasingOnFireFrameDelay = targetGun.shellCasingOnFireFrameDelay; this.gun.shellsToLaunchOnReload = targetGun.shellsToLaunchOnReload; this.gun.reloadShellLaunchFrame = targetGun.reloadShellLaunchFrame; this.gun.clipObject = targetGun.clipObject; this.gun.clipsToLaunchOnReload = targetGun.clipsToLaunchOnReload; this.gun.reloadClipLaunchFrame = targetGun.reloadClipLaunchFrame; this.gun.IsTrickGun = targetGun.IsTrickGun; this.gun.TrickGunAlternatesHandedness = targetGun.TrickGunAlternatesHandedness; this.gun.alternateVolley = targetGun.alternateVolley; this.gun.alternateShootAnimation = targetGun.alternateShootAnimation; this.gun.alternateReloadAnimation = targetGun.alternateReloadAnimation; this.gun.alternateIdleAnimation = targetGun.alternateIdleAnimation; this.gun.alternateSwitchGroup = targetGun.alternateSwitchGroup; this.gun.rampBullets = targetGun.rampBullets; this.gun.rampStartHeight = targetGun.rampStartHeight; this.gun.rampTime = targetGun.rampTime; this.gun.usesDirectionalAnimator = targetGun.usesDirectionalAnimator; this.gun.usesDirectionalIdleAnimations = targetGun.usesDirectionalIdleAnimations; Component[] targetGunComponents = targetGun.GetComponents <Component>(); Component[] thisGunComponents = this.GetComponents <Component>(); foreach (Component targetGunComponent in targetGunComponents) { if (this.gun.GetComponent(targetGunComponent.GetType()) == null) { Component comp = this.gun.gameObject.AddComponent(targetGunComponent.GetType()); comp.SetFields(targetGunComponent, includeProperties: true, includeFields: true); } } foreach (Component thisGunComponent in thisGunComponents) { if (thisGunComponent != this && targetGun.GetComponent(thisGunComponent.GetType()) == null) { Destroy(thisGunComponent); } } if (base.aiAnimator) { Destroy(base.aiAnimator); base.aiAnimator = null; } if (targetGun.aiAnimator) { AIAnimator aianimator = base.gameObject.AddComponent <AIAnimator>(); AIAnimator aiAnimator = targetGun.aiAnimator; aianimator.facingType = aiAnimator.facingType; aianimator.DirectionParent = aiAnimator.DirectionParent; aianimator.faceSouthWhenStopped = aiAnimator.faceSouthWhenStopped; aianimator.faceTargetWhenStopped = aiAnimator.faceTargetWhenStopped; aianimator.directionalType = aiAnimator.directionalType; aianimator.RotationQuantizeTo = aiAnimator.RotationQuantizeTo; aianimator.RotationOffset = aiAnimator.RotationOffset; aianimator.ForceKillVfxOnPreDeath = aiAnimator.ForceKillVfxOnPreDeath; aianimator.SuppressAnimatorFallback = aiAnimator.SuppressAnimatorFallback; aianimator.IsBodySprite = aiAnimator.IsBodySprite; aianimator.IdleAnimation = aiAnimator.IdleAnimation; aianimator.MoveAnimation = aiAnimator.MoveAnimation; aianimator.FlightAnimation = aiAnimator.FlightAnimation; aianimator.HitAnimation = aiAnimator.HitAnimation; aianimator.OtherAnimations = aiAnimator.OtherAnimations; aianimator.OtherVFX = aiAnimator.OtherVFX; aianimator.OtherScreenShake = aiAnimator.OtherScreenShake; aianimator.IdleFidgetAnimations = aiAnimator.IdleFidgetAnimations; base.aiAnimator = aianimator; } MultiTemporaryOrbitalSynergyProcessor component = targetGun.GetComponent <MultiTemporaryOrbitalSynergyProcessor>(); MultiTemporaryOrbitalSynergyProcessor component2 = base.GetComponent <MultiTemporaryOrbitalSynergyProcessor>(); if (!component && component2) { Destroy(component2); } else if (component && !component2) { MultiTemporaryOrbitalSynergyProcessor multiTemporaryOrbitalSynergyProcessor = base.gameObject.AddComponent <MultiTemporaryOrbitalSynergyProcessor>(); multiTemporaryOrbitalSynergyProcessor.RequiredSynergy = component.RequiredSynergy; multiTemporaryOrbitalSynergyProcessor.OrbitalPrefab = component.OrbitalPrefab; } if (this.gun.RawSourceVolley != null) { for (int i = 0; i < this.gun.RawSourceVolley.projectiles.Count; i++) { this.gun.RawSourceVolley.projectiles[i].ResetRuntimeData(); } } else { this.gun.singleModule.ResetRuntimeData(); } if (volley != null) { this.gun.RawSourceVolley = DuctTapeItem.TransferDuctTapeModules(volley, this.gun.RawSourceVolley, this.gun); } if (this.gun.CurrentOwner is PlayerController) { PlayerController playerController = this.gun.CurrentOwner as PlayerController; if (playerController.stats != null) { playerController.stats.RecalculateStats(playerController, false, false); } } if (base.gameObject.activeSelf) { base.StartCoroutine((IEnumerator)HandleFrameDelayedTransformation_info.Invoke(this.gun, new object[0])); } this.gun.DidTransformGunThisFrame = true; }
public void CopyFrom(tk2dSpriteCollectionDefinition src) { name = src.name; disableTrimming = src.disableTrimming; additive = src.additive; scale = src.scale; texture = src.texture; materialId = src.materialId; anchor = src.anchor; anchorX = src.anchorX; anchorY = src.anchorY; overrideMesh = src.overrideMesh; doubleSidedSprite = src.doubleSidedSprite; customSpriteGeometry = src.customSpriteGeometry; geometryIslands = src.geometryIslands; dice = src.dice; diceUnitX = src.diceUnitX; diceUnitY = src.diceUnitY; diceFilter = src.diceFilter; pad = src.pad; source = src.source; fromSpriteSheet = src.fromSpriteSheet; hasSpriteSheetId = src.hasSpriteSheetId; spriteSheetX = src.spriteSheetX; spriteSheetY = src.spriteSheetY; spriteSheetId = src.spriteSheetId; extractRegion = src.extractRegion; regionX = src.regionX; regionY = src.regionY; regionW = src.regionW; regionH = src.regionH; regionId = src.regionId; colliderType = src.colliderType; boxColliderMin = src.boxColliderMin; boxColliderMax = src.boxColliderMax; polyColliderCap = src.polyColliderCap; colliderColor = src.colliderColor; colliderConvex = src.colliderConvex; colliderSmoothSphereCollisions = src.colliderSmoothSphereCollisions; extraPadding = src.extraPadding; colliderData = new List <ColliderData>(src.colliderData.Count); foreach (ColliderData srcCollider in src.colliderData) { ColliderData data = new ColliderData(); data.CopyFrom(srcCollider); colliderData.Add(data); } if (src.polyColliderIslands != null) { polyColliderIslands = new tk2dSpriteColliderIsland[src.polyColliderIslands.Length]; for (int i = 0; i < polyColliderIslands.Length; ++i) { polyColliderIslands[i] = new tk2dSpriteColliderIsland(); polyColliderIslands[i].CopyFrom(src.polyColliderIslands[i]); } } else { polyColliderIslands = new tk2dSpriteColliderIsland[0]; } if (src.geometryIslands != null) { geometryIslands = new tk2dSpriteColliderIsland[src.geometryIslands.Length]; for (int i = 0; i < geometryIslands.Length; ++i) { geometryIslands[i] = new tk2dSpriteColliderIsland(); geometryIslands[i].CopyFrom(src.geometryIslands[i]); } } else { geometryIslands = new tk2dSpriteColliderIsland[0]; } attachPoints = new List <tk2dSpriteDefinition.AttachPoint>(src.attachPoints.Count); foreach (tk2dSpriteDefinition.AttachPoint srcAp in src.attachPoints) { tk2dSpriteDefinition.AttachPoint ap = new tk2dSpriteDefinition.AttachPoint(); ap.CopyFrom(srcAp); attachPoints.Add(ap); } }
public void CopyFrom(tk2dSpriteCollectionDefinition src) { this.name = src.name; this.disableTrimming = src.disableTrimming; this.additive = src.additive; this.scale = src.scale; this.texture = src.texture; this.materialId = src.materialId; this.anchor = src.anchor; this.anchorX = src.anchorX; this.anchorY = src.anchorY; this.overrideMesh = src.overrideMesh; this.doubleSidedSprite = src.doubleSidedSprite; this.customSpriteGeometry = src.customSpriteGeometry; this.geometryIslands = src.geometryIslands; this.dice = src.dice; this.diceUnitX = src.diceUnitX; this.diceUnitY = src.diceUnitY; this.diceFilter = src.diceFilter; this.pad = src.pad; this.source = src.source; this.fromSpriteSheet = src.fromSpriteSheet; this.hasSpriteSheetId = src.hasSpriteSheetId; this.spriteSheetX = src.spriteSheetX; this.spriteSheetY = src.spriteSheetY; this.spriteSheetId = src.spriteSheetId; this.extractRegion = src.extractRegion; this.regionX = src.regionX; this.regionY = src.regionY; this.regionW = src.regionW; this.regionH = src.regionH; this.regionId = src.regionId; this.colliderType = src.colliderType; this.boxColliderMin = src.boxColliderMin; this.boxColliderMax = src.boxColliderMax; this.polyColliderCap = src.polyColliderCap; this.colliderColor = src.colliderColor; this.colliderConvex = src.colliderConvex; this.colliderSmoothSphereCollisions = src.colliderSmoothSphereCollisions; this.extraPadding = src.extraPadding; this.colliderData = new List<ColliderData>(src.colliderData.Count); foreach (ColliderData data in src.colliderData) { ColliderData item = new ColliderData(); item.CopyFrom(data); this.colliderData.Add(item); } if (src.polyColliderIslands != null) { this.polyColliderIslands = new tk2dSpriteColliderIsland[src.polyColliderIslands.Length]; for (int i = 0; i < this.polyColliderIslands.Length; i++) { this.polyColliderIslands[i] = new tk2dSpriteColliderIsland(); this.polyColliderIslands[i].CopyFrom(src.polyColliderIslands[i]); } } else { this.polyColliderIslands = new tk2dSpriteColliderIsland[0]; } if (src.geometryIslands != null) { this.geometryIslands = new tk2dSpriteColliderIsland[src.geometryIslands.Length]; for (int j = 0; j < this.geometryIslands.Length; j++) { this.geometryIslands[j] = new tk2dSpriteColliderIsland(); this.geometryIslands[j].CopyFrom(src.geometryIslands[j]); } } else { this.geometryIslands = new tk2dSpriteColliderIsland[0]; } this.attachPoints = new List<tk2dSpriteDefinition.AttachPoint>(src.attachPoints.Count); foreach (tk2dSpriteDefinition.AttachPoint point in src.attachPoints) { tk2dSpriteDefinition.AttachPoint point2 = new tk2dSpriteDefinition.AttachPoint(); point2.CopyFrom(point); this.attachPoints.Add(point2); } }
public void CopyFrom(tk2dSpriteCollectionDefinition src) { name = src.name; disableTrimming = src.disableTrimming; additive = src.additive; scale = src.scale; texture = src.texture; materialId = src.materialId; anchor = src.anchor; anchorX = src.anchorX; anchorY = src.anchorY; overrideMesh = src.overrideMesh; doubleSidedSprite = src.doubleSidedSprite; customSpriteGeometry = src.customSpriteGeometry; geometryIslands = src.geometryIslands; dice = src.dice; diceUnitX = src.diceUnitX; diceUnitY = src.diceUnitY; diceFilter = src.diceFilter; pad = src.pad; source = src.source; fromSpriteSheet = src.fromSpriteSheet; hasSpriteSheetId = src.hasSpriteSheetId; spriteSheetX = src.spriteSheetX; spriteSheetY = src.spriteSheetY; spriteSheetId = src.spriteSheetId; extractRegion = src.extractRegion; regionX = src.regionX; regionY = src.regionY; regionW = src.regionW; regionH = src.regionH; regionId = src.regionId; colliderType = src.colliderType; boxColliderMin = src.boxColliderMin; boxColliderMax = src.boxColliderMax; polyColliderCap = src.polyColliderCap; colliderColor = src.colliderColor; colliderConvex = src.colliderConvex; colliderSmoothSphereCollisions = src.colliderSmoothSphereCollisions; extraPadding = src.extraPadding; if (src.polyColliderIslands != null) { polyColliderIslands = new tk2dSpriteColliderIsland[src.polyColliderIslands.Length]; for (int i = 0; i < polyColliderIslands.Length; ++i) { polyColliderIslands[i] = new tk2dSpriteColliderIsland(); polyColliderIslands[i].CopyFrom(src.polyColliderIslands[i]); } } else { polyColliderIslands = new tk2dSpriteColliderIsland[0]; } if (src.geometryIslands != null) { geometryIslands = new tk2dSpriteColliderIsland[src.geometryIslands.Length]; for (int i = 0; i < geometryIslands.Length; ++i) { geometryIslands[i] = new tk2dSpriteColliderIsland(); geometryIslands[i].CopyFrom(src.geometryIslands[i]); } } else { geometryIslands = new tk2dSpriteColliderIsland[0]; } attachPoints = new List<tk2dSpriteDefinition.AttachPoint>(src.attachPoints.Count); foreach (tk2dSpriteDefinition.AttachPoint srcAp in src.attachPoints) { tk2dSpriteDefinition.AttachPoint ap = new tk2dSpriteDefinition.AttachPoint(); ap.CopyFrom(srcAp); attachPoints.Add(ap); } }