public static void AddSpriteToObject(GameObject targetObject, Texture2D sourceTexture, bool copyFromExisting = true, bool isFakePrefab = true) { SpriteBuilder.SpriteFromTexture(sourceTexture, targetObject, copyFromExisting); if (isFakePrefab) { FakePrefab.MarkAsFakePrefab(targetObject); targetObject.SetActive(false); } }
public static void AddSpriteToObject(GameObject targetObject, string resourcePath, bool copyFromExisting = true, bool isFakePrefab = true) { SpriteBuilder.SpriteFromResource(resourcePath, targetObject, copyFromExisting); if (isFakePrefab) { FakePrefab.MarkAsFakePrefab(targetObject); targetObject.SetActive(false); } }
public static GameObject AddSpriteToObject(Texture2D texture, string objectName, GameObject obj = null, bool copyFromExisting = true, bool isFakePrefab = true) { GameObject gameObject = SpriteBuilder.SpriteFromTexture(texture, obj, copyFromExisting); if (isFakePrefab) { FakePrefab.MarkAsFakePrefab(gameObject); obj.SetActive(false); } gameObject.name = objectName; return(gameObject); }
public static GameObject AddSpriteToObject(string name, string resourcePath, GameObject obj = null, bool copyFromExisting = true, bool isFakePrefab = true) { GameObject gameObject = SpriteBuilder.SpriteFromResource(resourcePath, obj, copyFromExisting); if (isFakePrefab) { FakePrefab.MarkAsFakePrefab(gameObject); obj.SetActive(false); } gameObject.name = name; return(gameObject); }
public static void Init(AssetBundle expandSharedAssets1) { PowBlockObject = expandSharedAssets1.LoadAsset <GameObject>("Pow Block"); ItemBuilder.AddSpriteToObject(PowBlockObject, expandSharedAssets1.LoadAsset <Texture2D>("PowBlock"), false, false); SpriteBuilder.AddSpriteToCollection(expandSharedAssets1.LoadAsset <Texture2D>("PowBlock_Used"), PowBlockObject.GetComponent <tk2dSprite>().Collection); PowBlock powBlock = PowBlockObject.AddComponent <PowBlock>(); string shortDesc = "Shaken not stirred..."; string longDesc = "A special block that when stomped on causes a violent shaking.\n\nEnemies shall lose their footing."; ItemBuilder.SetupItem(powBlock, shortDesc, longDesc, "ex"); ItemBuilder.SetCooldownType(powBlock, ItemBuilder.CooldownType.Damage, 380f); powBlock.quality = ItemQuality.C; PowBlockPickupID = powBlock.PickupObjectId; }
public static void Init(AssetBundle expandSharedAssets1) { CorruptedJunkObject = expandSharedAssets1.LoadAsset <GameObject>("Corrupted Junk"); CorruptedJunk poopSack = CorruptedJunkObject.AddComponent <CorruptedJunk>(); ItemBuilder.AddSpriteToObject(CorruptedJunkObject, expandSharedAssets1.LoadAsset <Texture2D>("corrupted_poopsack_09"), false, false); string shortDesc = "Next Time... What even is this!?"; string longDesc = "Just some corrupted junk.\n\nCarrying this around makes you question your sanity..."; ItemBuilder.SetupItem(poopSack, shortDesc, longDesc, "ex"); poopSack.quality = ItemQuality.A; poopSack.CanBeDropped = false; m_SpriteNames = new List <string> { "corrupted_poopsack_01", "corrupted_poopsack_02", "corrupted_poopsack_03", "corrupted_poopsack_04", "corrupted_poopsack_05", "corrupted_poopsack_06", "corrupted_poopsack_07", "corrupted_poopsack_08", "corrupted_poopsack_09", "corrupted_poopsack_10" }; foreach (string spritePath in m_SpriteNames) { if (spritePath != "corrupted_poopsack_09") { SpriteBuilder.AddSpriteToCollection(expandSharedAssets1.LoadAsset <Texture2D>(spritePath), CorruptedJunkObject.GetComponent <tk2dSprite>().Collection); } } ExpandUtility.GenerateSpriteAnimator(CorruptedJunkObject, playAutomatically: true); ExpandUtility.AddAnimation(CorruptedJunkObject.GetComponent <tk2dSpriteAnimator>(), CorruptedJunkObject.GetComponent <tk2dSprite>().Collection, m_SpriteNames, "idle", tk2dSpriteAnimationClip.WrapMode.RandomLoop, 20); }
public static void Init(AssetBundle expandSharedAssets1) { RockslideObject = expandSharedAssets1.LoadAsset <GameObject>("Rock Slide"); ItemBuilder.AddSpriteToObject(RockslideObject, expandSharedAssets1.LoadAsset <Texture2D>("rockslide"), false, false); RockSlide rockslide = RockslideObject.AddComponent <RockSlide>(); string shortDesc = "Crushing Defeat"; string longDesc = "Falling rocks are a well known threat to everyone, especially within the Gungeon.\n\nIt does not help that a long gone Gungeoneer accidentally popularized the idea of using falling debris as a weapon among the Gundead.\n\nHowever, they quickly grew tired of it, seeming too easy or effortless to eliminate Gungeoneers compared to the exhilarating experience of the combat they were forged for."; ItemBuilder.SetupItem(rockslide, shortDesc, longDesc, "ex"); ItemBuilder.SetCooldownType(rockslide, ItemBuilder.CooldownType.Damage, 275f); rockslide.quality = ItemQuality.B; List <string> spritePaths = new List <string>() { "plunger_fire_001", "plunger_fire_002", "plunger_fire_003", "plunger_fire_004", "plunger_fire_005", "plunger_fire_006" }; tk2dSprite rockslidesprite = RockslideObject.GetComponent <tk2dSprite>(); foreach (string sprite in spritePaths) { SpriteBuilder.AddSpriteToCollection(expandSharedAssets1.LoadAsset <Texture2D>(sprite), rockslidesprite.Collection); } ExpandUtility.GenerateSpriteAnimator(RockslideObject); tk2dSpriteAnimator rockslideAnimator = RockslideObject.GetComponent <tk2dSpriteAnimator>(); ExpandUtility.AddAnimation(rockslideAnimator, rockslidesprite.Collection, spritePaths, "Activate", frameRate: 8); RockSlidePickupID = rockslide.PickupObjectId; }
public static void SetupItem(PickupObject item, string shortDesc, string longDesc, string idPool = "expandItems") { try { item.encounterTrackable = null; ETGMod.Databases.Items.SetupItem(item, item.name); SpriteBuilder.AddToAmmonomicon(item.sprite.GetCurrentSpriteDef()); item.encounterTrackable.journalData.AmmonomiconSprite = item.sprite.GetCurrentSpriteDef().name; GunExt.SetName(item, item.name); GunExt.SetShortDescription(item, shortDesc); GunExt.SetLongDescription(item, longDesc); bool flag = item is PlayerItem; if (flag) { (item as PlayerItem).consumable = false; } Game.Items.Add(idPool + ":" + item.name.ToLower().Replace(" ", "_"), item); ETGMod.Databases.Items.Add(item, false, "ANY"); } catch (Exception ex) { UnityEngine.Debug.LogException(ex); ETGModConsole.Log(ex.Message, false); ETGModConsole.Log(ex.StackTrace, false); } }
public static void AddSpriteToObject(GameObject targetObject, Texture2D sourceTexture) { SpriteBuilder.SpriteFromTexture(sourceTexture, targetObject); }
public static void Init(AssetBundle expandSharedAssets1) { hammerItemObject = expandSharedAssets1.LoadAsset <GameObject>("Baby Good Hammer"); BabyGoodHammer babyGoodHammer = hammerItemObject.AddComponent <BabyGoodHammer>(); ItemBuilder.AddSpriteToObject(hammerItemObject, expandSharedAssets1.LoadAsset <Texture2D>("babygoodhammer"), false, false); string shortDesc = "It's Hammer Time!"; string longDesc = "Summons a Dead Blow Hammer.\n\nIt's cry sounds a lot like a whistle.\n\nThe closer you are to the Forge, the more powerful the hammers will be."; ItemBuilder.SetupItem(babyGoodHammer, shortDesc, longDesc, "ex"); ItemBuilder.SetCooldownType(babyGoodHammer, ItemBuilder.CooldownType.Damage, 350f); babyGoodHammer.quality = ItemQuality.B; // Hammer Spawn FX Object hammerSpawnFX = expandSharedAssets1.LoadAsset <GameObject>("HammerSpawningFX"); ItemBuilder.AddSpriteToObject(hammerSpawnFX, expandSharedAssets1.LoadAsset <Texture2D>("babygoodhammer_spawn_00"), false, false); tk2dBaseSprite spriteComponent = hammerSpawnFX.GetComponent <tk2dBaseSprite>(); List <string> spritePaths = new List <string>() { "babygoodhammer_spawn_00", "babygoodhammer_spawn_00", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_02", "babygoodhammer_spawn_03", "babygoodhammer_spawn_04", "babygoodhammer_spawn_05", "babygoodhammer_spawn_06", "babygoodhammer_spawn_07", "babygoodhammer_spawn_08", "babygoodhammer_spawn_09", "babygoodhammer_spawn_10", "babygoodhammer_spawn_11", "babygoodhammer_spawn_12", "babygoodhammer_spawn_13", "babygoodhammer_spawn_14", "babygoodhammer_spawn_15", "babygoodhammer_spawn_16", "babygoodhammer_spawn_17", "babygoodhammer_spawn_18", "babygoodhammer_spawn_19", "babygoodhammer_spawn_20", "babygoodhammer_spawn_21", "babygoodhammer_spawn_22", "babygoodhammer_spawn_23", "babygoodhammer_spawn_24", "babygoodhammer_spawn_25" }; foreach (string spriteName in spritePaths) { if (spriteName != "babygoodhammer_spawn_00") { SpriteBuilder.AddSpriteToCollection(expandSharedAssets1.LoadAsset <Texture2D>(spriteName), spriteComponent.Collection); } } ExpandUtility.GenerateSpriteAnimator(hammerSpawnFX); tk2dSpriteAnimator hammerAnimator = hammerSpawnFX.GetComponent <tk2dSpriteAnimator>(); List <string> spritePaths_reversed = new List <string>() { "babygoodhammer_spawn_25", "babygoodhammer_spawn_24", "babygoodhammer_spawn_23", "babygoodhammer_spawn_22", "babygoodhammer_spawn_21", "babygoodhammer_spawn_20", "babygoodhammer_spawn_19", "babygoodhammer_spawn_18", "babygoodhammer_spawn_17", "babygoodhammer_spawn_16", "babygoodhammer_spawn_15", "babygoodhammer_spawn_14", "babygoodhammer_spawn_13", "babygoodhammer_spawn_12", "babygoodhammer_spawn_11", "babygoodhammer_spawn_10", "babygoodhammer_spawn_09", "babygoodhammer_spawn_08", "babygoodhammer_spawn_07", "babygoodhammer_spawn_06", "babygoodhammer_spawn_05", "babygoodhammer_spawn_04", "babygoodhammer_spawn_03", "babygoodhammer_spawn_02", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_01", "babygoodhammer_spawn_00" }; ExpandUtility.AddAnimation(hammerAnimator, spriteComponent.Collection, spritePaths, "HammerSpawn", tk2dSpriteAnimationClip.WrapMode.Once); ExpandUtility.AddAnimation(hammerAnimator, spriteComponent.Collection, spritePaths_reversed, "HammerReturnSpawn", tk2dSpriteAnimationClip.WrapMode.Once); HammerPickupID = babyGoodHammer.PickupObjectId; }