public override DebrisObject Drop(PlayerController player) { DestroyCompanion(); player.OnNewFloorLoaded = (Action <PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action <PlayerController>(HandleNewFloor)); DebrisObject drop = base.Drop(player); if (drop) { SonicBox component = drop.gameObject.GetComponent <SonicBox>(); if (component) { component.m_HasDied = m_HasDied; component.m_PickedUp = true; component.m_healthRemaining = m_healthRemaining; component.m_maxHealthRemaining = m_maxHealthRemaining; if (component.m_HasDied) { component.m_pickedUpThisRun = true; component.spriteAnimator.playAutomatically = false; component.spriteAnimator.Stop(); component.sprite.SetSprite("SonicBox_Broken_01"); component.Break(); } else { component.spriteAnimator.playAutomatically = true; component.spriteAnimator.Play(); } } } return(drop); }
public static void Init(AssetBundle expandSharedAssets1) { SonicBoxObject = expandSharedAssets1.LoadAsset <GameObject>("EXSonicBox"); SpriteSerializer.AddSpriteToObject(SonicBoxObject, ExpandPrefabs.EXItemCollection, "SonicBox_Idle_02"); ExpandUtility.GenerateSpriteAnimator(SonicBoxObject, playAutomatically: true); ExpandUtility.AddAnimation(SonicBoxObject.GetComponent <tk2dSpriteAnimator>(), ExpandPrefabs.EXItemCollection.GetComponent <tk2dSpriteCollectionData>(), m_IdleFrames, "Idle", tk2dSpriteAnimationClip.WrapMode.Loop, 16); SonicBox sonicBoxItem = SonicBoxObject.AddComponent <SonicBox>(); string name = "Sonic Box"; string shortDesc = "Gotta Go Fast!"; string longDesc = "Sonic the Hedgehog has found his way to the Gungeon and loves to spin dash into the Gundead!"; ItemBuilder.SetupEXItem(sonicBoxItem, name, shortDesc, longDesc); sonicBoxItem.quality = ItemQuality.A; if (!ExpandSettings.EnableEXItems) { sonicBoxItem.quality = ItemQuality.EXCLUDED; } ; }