예제 #1
0
        protected override void Update()
        {
            if (Owner)
            {
                RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom;
                for (int i = 0; i < StaticReferenceManager.AllDebris.Count; i++)
                {
                    DebrisObject alldebris = StaticReferenceManager.AllDebris[i];
                    if (alldebris && alldebris.sprite.WorldCenter.GetAbsoluteRoom() == currentRoom && alldebris.IsPickupObject && alldebris.canRotate && alldebris.sprite.IsPerpendicular && alldebris.sprite.automaticallyManagesDepth && alldebris.sprite.ignoresTiltworldDepth)
                    {
                        if (alldebris.GetComponent <PickupMover>() == null)
                        {
                            PickupMover pickupMover = alldebris.gameObject.AddComponent <PickupMover>();
                            if (pickupMover.specRigidbody)
                            {
                                pickupMover.specRigidbody.CollideWithTileMap = false;
                            }
                            pickupMover.acceleration         = 100f;
                            pickupMover.maxSpeed             = 12f;
                            pickupMover.minRadius            = 0.85f;
                            pickupMover.moveIfRoomUnclear    = true;
                            pickupMover.stopPathingOnContact = true;
                        }
                    }
                }
            }

            else
            {
                return;
            }
        }
        private void HandleReturnLikeBoomerang(DebrisObject obj)
        {
            obj.PreventFallingInPits = true;
            obj.OnGrounded           = (Action <DebrisObject>)Delegate.Remove(obj.OnGrounded, new Action <DebrisObject>(this.HandleReturnLikeBoomerang));
            PickupMover pickupMover = obj.gameObject.AddComponent <PickupMover>();

            if (pickupMover.specRigidbody)
            {
                pickupMover.specRigidbody.CollideWithTileMap = false;
            }
            pickupMover.minRadius            = 1f;
            pickupMover.moveIfRoomUnclear    = true;
            pickupMover.stopPathingOnContact = false;
        }
예제 #3
0
        public static void Init(AssetBundle expandSharedAssets1)
        {
            SonicRingObject = expandSharedAssets1.LoadAsset <GameObject>("EXSonicRing");
            SpriteSerializer.AddSpriteToObject(SonicRingObject, ExpandPrefabs.EXItemCollection, "SonicRing_Idle_05");

            List <string> m_RingFrames = new List <string>();

            for (int i = 1; i < 16; i++)
            {
                if (i < 10)
                {
                    m_RingFrames.Add("SonicRing_Idle_0" + i.ToString());
                }
                else
                {
                    m_RingFrames.Add("SonicRing_Idle_" + i.ToString());
                }
            }

            ExpandUtility.GenerateSpriteAnimator(SonicRingObject, playAutomatically: true);

            ExpandUtility.AddAnimation(SonicRingObject.GetComponent <tk2dSpriteAnimator>(), ExpandPrefabs.EXItemCollection.GetComponent <tk2dSpriteCollectionData>(), m_RingFrames, "idle", tk2dSpriteAnimationClip.WrapMode.Loop);

            ExpandUtility.GenerateOrAddToRigidBody(SonicRingObject, CollisionLayer.Pickup, PixelCollider.PixelColliderGeneration.Manual, UsesPixelsAsUnitSize: true, offset: new IntVector2(0, 1), dimensions: new IntVector2(15, 14));

            SonicRingObject.GetComponent <SpeculativeRigidbody>().PixelColliders[0].IsTrigger = true;

            PickupMover pickupMover = SonicRingObject.AddComponent <PickupMover>();

            pickupMover.pathInterval = 0.25f;
            pickupMover.acceleration = 7;
            pickupMover.maxSpeed     = 15;
            pickupMover.minRadius    = 0;

            SonicRing sonicRing = SonicRingObject.AddComponent <SonicRing>();

            string name      = "Sonic Ring";
            string shortDesc = "A Ring";
            string longDesc  = "A Simple Ring. Equilivent to one casing.";

            ItemBuilder.SetupEXItem(sonicRing, name, shortDesc, longDesc, "ex", false);
            sonicRing.quality = ItemQuality.COMMON;
            sonicRing.ItemSpansBaseQualityTiers      = false;
            sonicRing.additionalMagnificenceModifier = 0;
            sonicRing.ItemRespectsHeartMagnificence  = false;
            sonicRing.associatedItemChanceMods       = new LootModData[0];
            sonicRing.contentSource             = ContentSource.BASE;
            sonicRing.ShouldBeExcludedFromShops = false;
            sonicRing.CanBeDropped = true;
            sonicRing.PreventStartingOwnerFromDropping = false;
            sonicRing.PersistsOnDeath            = false;
            sonicRing.PersistsOnPurchase         = false;
            sonicRing.RespawnsIfPitfall          = true;
            sonicRing.PreventSaveSerialization   = false;
            sonicRing.IgnoredByRat               = false;
            sonicRing.SaveFlagToSetOnAcquisition = 0;
            sonicRing.UsesCustomCost             = false;
            sonicRing.CustomCost = 0;
            sonicRing.CanBeSold  = true;
            sonicRing.ForcedPositionInAmmonomicon = -1;
            sonicRing.currencyValue           = 1;
            sonicRing.IsMetaCurrency          = false;
            sonicRing.overrideBloopSpriteName = "SonicRing_Idle_05";

            RingID = sonicRing.PickupObjectId;
        }