public static void BuildPrefab() { if (MaroonGuonStone.orbitalPrefab != null) { return; } GameObject prefab = SpriteBuilder.SpriteFromResource("NevernamedsItems/Resources/GuonStones/maroonguon_ingame"); prefab.name = "Maroon Guon Orbital"; var body = prefab.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(10, 16)); //prefab.GetComponent<tk2dSprite>().GetCurrentSpriteDef().ConstructOffsetsFromAnchor(tk2dBaseSprite.Anchor.MiddleCenter, body.GetComponent<tk2dSprite>().GetCurrentSpriteDef().position3); body.CollideWithTileMap = false; body.CollideWithOthers = true; body.UpdateCollidersOnRotation = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.BulletBlocker; orbitalPrefab = prefab.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; orbitalPrefab.perfectOrbitalFactor = 10f; orbitalPrefab.shouldRotate = true; orbitalPrefab.orbitRadius = 3.5f; orbitalPrefab.orbitDegreesPerSecond = 50f; orbitalPrefab.SetOrbitalTier(0); GameObject.DontDestroyOnLoad(prefab); FakePrefab.MarkAsFakePrefab(prefab); prefab.SetActive(false); }
public static GameObject MakeAnimatedOrbital(string name, float orbitRadius, float orbitalDegreesPerSecond, int orbitalTier, PlayerOrbital.OrbitalMotionStyle motionStyle, float perfectOrbitalFactor, List <string> idleAnimPaths, int fps, Vector2 colliderDimensions, Vector2 colliderOffsets, tk2dBaseSprite.Anchor anchorMode, tk2dSpriteAnimationClip.WrapMode wrapMode) { GameObject prefab = SpriteBuilder.SpriteFromResource(idleAnimPaths[0]); prefab.name = name; var body = prefab.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(colliderOffsets.ToIntVector2(), colliderDimensions.ToIntVector2()); body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; tk2dSpriteCollectionData spriteCollection = SpriteBuilder.ConstructCollection(prefab, $"{name}_Collection"); prefab.AddAnimationToObject(spriteCollection, "start", idleAnimPaths, fps, colliderDimensions, colliderOffsets, anchorMode, wrapMode, true); PlayerOrbital orbitalPrefab = prefab.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = motionStyle; orbitalPrefab.shouldRotate = false; orbitalPrefab.orbitRadius = orbitRadius; orbitalPrefab.perfectOrbitalFactor = perfectOrbitalFactor; orbitalPrefab.orbitDegreesPerSecond = orbitalDegreesPerSecond; orbitalPrefab.SetOrbitalTier(orbitalTier); prefab.MakeFakePrefab(); return(prefab); }
public static void BuildPrefab() { if (BrownGuonStone.orbitalPrefab != null) { return; } GameObject prefab = SpriteBuilder.SpriteFromResource("NevernamedsItems/Resources/brownguonstone_ingame"); prefab.name = "Brown Guon Orbital"; var body = prefab.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(7, 13)); body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; orbitalPrefab = prefab.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; orbitalPrefab.shouldRotate = false; orbitalPrefab.orbitRadius = 5f; orbitalPrefab.orbitDegreesPerSecond = 40f; orbitalPrefab.SetOrbitalTier(0); GameObject.DontDestroyOnLoad(prefab); FakePrefab.MarkAsFakePrefab(prefab); prefab.SetActive(false); }
public static void BuildPrefab() { string kissMyButt = "If you're digging through my code you can kiss my butt"; string.IsNullOrEmpty(kissMyButt); if (LightningGuon.orbitalPrefab != null) { return; } GameObject prefab = SpriteBuilder.SpriteFromResource("CustomItems/Resources/P1/swiftness_guon"); prefab.name = "Swiftness Guon Orbital"; var body = prefab.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(7, 13)); body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; orbitalPrefab = prefab.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; orbitalPrefab.shouldRotate = false; orbitalPrefab.orbitRadius = 2.5f; orbitalPrefab.SetOrbitalTier(0); GameObject.DontDestroyOnLoad(prefab); FakePrefab.MarkAsFakePrefab(prefab); prefab.SetActive(false); }
private void RebuildOrbitals() { if (orbitals.Any()) { foreach (GameObject obj in orbitals) { Destroy(obj); } } for (int i = 0; i < orbitalAmount; i++) { GameObject gameObject = ItemAPI.SpriteBuilder.SpriteFromResource("Items/Resources/VFX/magnorb_projectile"); SpeculativeRigidbody speculativeRigidbody = gameObject.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(9, 9)); PlayerOrbital orbitalPrefab = gameObject.AddComponent <PlayerOrbital>(); speculativeRigidbody.CollideWithTileMap = false; speculativeRigidbody.CollideWithOthers = false; orbitalPrefab.shouldRotate = true; orbitalPrefab.orbitRadius = 2f; orbitalPrefab.orbitDegreesPerSecond = 10; orbitalPrefab.SetOrbitalTier(0); UnityEngine.Object.DontDestroyOnLoad(gameObject); FakePrefab.MarkAsFakePrefab(gameObject); gameObject.SetActive(false); GameObject gameobject2 = PlayerOrbitalItem.CreateOrbital(attachedPlayer, gameObject, false); orbitals.Add(gameobject2); } }
public static void BuildSynergyPrefab() //here is where the synergy form is set up { bool flag = PrismaticGuonStone.upgradeOrbitalPrefab == null; if (flag) { GameObject prefab = ItemBuilder.AddSpriteToObject("prismatic_guon_synergy", "BleakMod/Resources/prismatic_guon_stone/prismatismer_guon_stone_001", null); prefab.name = "Prismatic Guon Orbital Synergy Form"; FakePrefab.MarkAsFakePrefab(prefab); UnityEngine.Object.DontDestroyOnLoad(prefab); tk2dSpriteAnimator animator = prefab.AddComponent <tk2dSpriteAnimator>(); tk2dSpriteAnimationClip animationClip = new tk2dSpriteAnimationClip(); animationClip.fps = 8; animationClip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop; animationClip.name = "start"; GameObject spriteObject = new GameObject("spriteObject"); ItemBuilder.AddSpriteToObject("spriteObject", $"BleakMod/Resources/prismatic_guon_stone/prismatismer_guon_stone_001", spriteObject); tk2dSpriteAnimationFrame starterFrame = new tk2dSpriteAnimationFrame(); starterFrame.spriteId = spriteObject.GetComponent <tk2dSprite>().spriteId; starterFrame.spriteCollection = spriteObject.GetComponent <tk2dSprite>().Collection; tk2dSpriteAnimationFrame[] frameArray = new tk2dSpriteAnimationFrame[] { starterFrame }; animationClip.frames = frameArray; for (int i = 2; i < 6; i++) { GameObject spriteForObject = new GameObject("spriteForObject"); ItemBuilder.AddSpriteToObject("spriteForObject", $"BleakMod/Resources/prismatic_guon_stone/prismatismer_guon_stone_00{i}", spriteForObject); tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame(); frame.spriteId = spriteForObject.GetComponent <tk2dBaseSprite>().spriteId; frame.spriteCollection = spriteForObject.GetComponent <tk2dBaseSprite>().Collection; animationClip.frames = animationClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray(); } animator.Library = animator.gameObject.AddComponent <tk2dSpriteAnimation>(); animator.Library.clips = new tk2dSpriteAnimationClip[] { animationClip }; animator.DefaultClipId = animator.GetClipIdByName("start"); animator.playAutomatically = true; GameObject gameObject = animator.gameObject; gameObject.name = "Prismatic Guon Orbital Synergy Form"; var body = gameObject.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(13, 15)); //Numbers at the end are the dimensions of the hitbox body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; upgradeOrbitalPrefab = gameObject.AddComponent <PlayerOrbital>(); upgradeOrbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; upgradeOrbitalPrefab.shouldRotate = true; upgradeOrbitalPrefab.orbitRadius = 1.5f; upgradeOrbitalPrefab.orbitDegreesPerSecond = 175f; //Guon Stats upgradeOrbitalPrefab.perfectOrbitalFactor = 1000f; upgradeOrbitalPrefab.SetOrbitalTier(0); UnityEngine.Object.DontDestroyOnLoad(gameObject); FakePrefab.MarkAsFakePrefab(gameObject); gameObject.SetActive(false); } }
public static void BuildPrefab() { if (UltraVioletGuonStone.orbitalPrefab != null) { return; } GameObject prefab = SpriteBuilder.SpriteFromResource("NevernamedsItems/Resources/GuonStones/ultravioletguon_ingame"); prefab.name = "Ultraviolet Guon Orbital"; var body = prefab.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(8, 9)); body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; orbitalPrefab = prefab.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; orbitalPrefab.shouldRotate = true; orbitalPrefab.orbitRadius = 4.1f; orbitalPrefab.orbitDegreesPerSecond = 420f; orbitalPrefab.SetOrbitalTier(0); EasyTrailMisc trail = prefab.AddComponent <EasyTrailMisc>(); trail.TrailPos = prefab.transform.position; trail.TrailPos.x += 0.2f; trail.StartWidth = 0.2f; trail.EndWidth = 0; trail.LifeTime = 0.1f; trail.BaseColor = ExtendedColours.charmPink; trail.EndColor = ExtendedColours.pink; GameObject.DontDestroyOnLoad(prefab); FakePrefab.MarkAsFakePrefab(prefab); prefab.SetActive(false); }
public static void BuildPrefab() { if (GoonStone.orbitalPrefab != null) { return; } GameObject prefab = ItemBuilder.AddSpriteToObject("goon_orbital", "BleakMod/Resources/goon_stone/bodyguard_guon_stone_001", null); FakePrefab.MarkAsFakePrefab(prefab); UnityEngine.Object.DontDestroyOnLoad(prefab); tk2dSpriteAnimator animator = prefab.AddComponent <tk2dSpriteAnimator>(); tk2dSpriteAnimationClip animationClip = new tk2dSpriteAnimationClip(); animationClip.fps = 10; animationClip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop; animationClip.name = "start"; GameObject spriteObject = new GameObject("spriteObject"); ItemBuilder.AddSpriteToObject("spriteObject", $"BleakMod/Resources/goon_stone/bodyguard_guon_stone_001", spriteObject); tk2dSpriteAnimationFrame starterFrame = new tk2dSpriteAnimationFrame(); starterFrame.spriteId = spriteObject.GetComponent <tk2dSprite>().spriteId; starterFrame.spriteCollection = spriteObject.GetComponent <tk2dSprite>().Collection; tk2dSpriteAnimationFrame[] frameArray = new tk2dSpriteAnimationFrame[] { starterFrame }; animationClip.frames = frameArray; for (int i = 2; i < 10; i++) { GameObject spriteForObject = new GameObject("spriteForObject"); ItemBuilder.AddSpriteToObject("spriteForObject", $"BleakMod/Resources/goon_stone/bodyguard_guon_stone_00{i}", spriteForObject); tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame(); frame.spriteId = spriteForObject.GetComponent <tk2dBaseSprite>().spriteId; frame.spriteCollection = spriteForObject.GetComponent <tk2dBaseSprite>().Collection; animationClip.frames = animationClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray(); } for (int i = 10; i < 29; i++) { GameObject spriteForObject = new GameObject("spriteForObject"); ItemBuilder.AddSpriteToObject("spriteForObject", $"BleakMod/Resources/goon_stone/bodyguard_guon_stone_0{i}", spriteForObject); tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame(); frame.spriteId = spriteForObject.GetComponent <tk2dBaseSprite>().spriteId; frame.spriteCollection = spriteForObject.GetComponent <tk2dBaseSprite>().Collection; animationClip.frames = animationClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray(); } animator.Library = animator.gameObject.AddComponent <tk2dSpriteAnimation>(); animator.Library.clips = new tk2dSpriteAnimationClip[] { animationClip }; animator.DefaultClipId = animator.GetClipIdByName("start"); animator.playAutomatically = true; GameObject gameObject = animator.gameObject; gameObject.name = "Goon Orbital"; var body = gameObject.GetComponent <tk2dSprite>().SetUpSpeculativeRigidbody(IntVector2.Zero, new IntVector2(15, 16)); //Numbers at the end are the dimensions of the hitbox body.CollideWithTileMap = false; body.CollideWithOthers = true; body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.EnemyBulletBlocker; orbitalPrefab = gameObject.AddComponent <PlayerOrbital>(); orbitalPrefab.motionStyle = PlayerOrbital.OrbitalMotionStyle.ORBIT_PLAYER_ALWAYS; orbitalPrefab.shouldRotate = false; orbitalPrefab.orbitRadius = 2f; orbitalPrefab.orbitDegreesPerSecond = 120; //Guon Stats orbitalPrefab.perfectOrbitalFactor = 1000f; orbitalPrefab.SetOrbitalTier(0); UnityEngine.Object.DontDestroyOnLoad(gameObject); FakePrefab.MarkAsFakePrefab(gameObject); gameObject.SetActive(false); }