Esempio n. 1
0
        private bool ItemIsValid(PickupObject item)
        {
            CompanionItem        companion      = item.GetComponent <CompanionItem>();
            MulticompanionItem   multiCompanion = item.GetComponent <MulticompanionItem>();
            BankMaskItem         clownCompanion = item.GetComponent <BankMaskItem>();
            PlayerOrbitalItem    orbitalItem    = item.GetComponent <PlayerOrbitalItem>();
            IounStoneOrbitalItem GuonStone      = item.GetComponent <IounStoneOrbitalItem>();

            if ((companion != null) || (multiCompanion != null) || (clownCompanion != null) || (orbitalItem != null && GuonStone == null) || OverridePossibleItems.Contains(item.PickupObjectId))
            {
                if (!BannedItems.Contains(item.PickupObjectId))
                {
                    if (item.DisplayName != "Magic Lamp")
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                //ETGModConsole.Log("Companion Component: " + (companion != null) + "\nMultiCompanionItem Component: " + (multiCompanion != null) + "\nOrbitalItem Component: " + (orbitalItem != null) + "\nIsGuonStone: " + (GuonStone != null) + " (Should be false)" + "\nOverrideItem: " + (OverridePossibleItems.Contains(item.PickupObjectId)));
                return(false);
            }
        }
Esempio n. 2
0
 public static void HandleEncounterableHook(Action <PickupObject, PlayerController> orig, PickupObject po, PlayerController player)
 {
     orig(po, player);
     if (po != null && po.GetComponent <SpecialPickupObject>() != null && po.GetComponent <SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition != CustomDungeonFlags.NONE)
     {
         AdvancedGameStatsManager.Instance.SetFlag(po.GetComponent <SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition, true);
     }
 }
        private void OnEnemyKilled(PlayerController player, HealthHaver enemy)
        {
            bool flag = enemy.specRigidbody != null && enemy.aiActor != null && base.Owner != null;

            if (flag && UnityEngine.Random.value <= 0.66f)
            {
                PickupObject byId  = PickupObjectDatabase.GetById(310);
                bool         flag2 = byId == null;
                if (!flag2)
                {
                    WingsItem      component      = byId.GetComponent <WingsItem>();
                    GoopDefinition goopDefinition = (component != null) ? component.RollGoop : null;
                }
                float duration = 0.75f;
                DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(Bleaker.goopDefs[UnityEngine.Random.Range(0, 3)]).TimedAddGoopCircle(enemy.specRigidbody.UnitCenter, 4f, duration, false);
            }
        }
Esempio n. 4
0
 // Token: 0x0600028D RID: 653 RVA: 0x0001666C File Offset: 0x0001486C
 public override void PostProcessProjectile(Projectile projectile)
 {
     base.PostProcessProjectile(projectile);
     {
         base.PostProcessProjectile(projectile);
         PickupObject   byId = PickupObjectDatabase.GetById(310);
         GoopDefinition Goop;
         WingsItem      component = byId.GetComponent <WingsItem>();
         Goop = component.RollGoop;
         int goopRadius = 1;
         if (this.m_lastGoopPosition != null)
         {
             DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(Goop).AddGoopLine(this.m_lastGoopPosition.Value, projectile.sprite.WorldCenter, goopRadius);
         }
         this.m_lastGoopPosition = new Vector2?(projectile.sprite.WorldCenter);
     }
 }
        // Token: 0x0600026C RID: 620 RVA: 0x00015F84 File Offset: 0x00014184
        // Note: this type is marked as 'beforefieldinit'.
        static EasyGoopDefinitions()
        {
            PickupObject   byId = PickupObjectDatabase.GetById(310);
            GoopDefinition charmGoopDef;

            if (byId == null)
            {
                charmGoopDef = null;
            }
            else
            {
                WingsItem component = byId.GetComponent <WingsItem>();
                charmGoopDef = ((component != null) ? component.RollGoop : null);
            }
            EasyGoopDefinitions.CharmGoopDef         = charmGoopDef;
            EasyGoopDefinitions.GreenFireDef         = (PickupObjectDatabase.GetById(698) as Gun).DefaultModule.projectiles[0].GetComponent <GoopModifier>().goopDefinition;
            EasyGoopDefinitions.CheeseDef            = (PickupObjectDatabase.GetById(808) as Gun).DefaultModule.projectiles[0].GetComponent <GoopModifier>().goopDefinition;
            EasyGoopDefinitions.TripleCrossbow       = (ETGMod.Databases.Items["triple_crossbow"] as Gun);
            EasyGoopDefinitions.TripleCrossbowEffect = EasyGoopDefinitions.TripleCrossbow.DefaultModule.projectiles[0].speedEffect;
        }
Esempio n. 6
0
    public void UpdateOpacity()
    {
        OpacityTimer += Time.deltaTime;
        if (OpacityTimer > OpacityLastChangeTime + OpacityChangeInterval)
        {
            OpacityLastChangeTime = OpacityTimer;

            if (CurrentAlphaValue >= 1.0f)
            {
                AlphaChangeValue *= -1;
            }

            CurrentAlphaValue += AlphaChangeValue;
            PickupObject.GetComponent <SpriteRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, CurrentAlphaValue);

            if (CurrentAlphaValue <= 0.0f)
            {
                IsActive = false;
            }
        }
    }
Esempio n. 7
0
            // Token: 0x06000758 RID: 1880 RVA: 0x0003EC88 File Offset: 0x0003CE88
            private void Start()
            {
                AssetBundle assetBundle = ResourceManager.LoadAssetBundle("shared_auto_001");

                BabyGoodLovebulon.goopDefs = new List <GoopDefinition>();
                foreach (string text in BabyGoodLovebulon.goops)
                {
                    GoopDefinition goopDefinition;
                    try
                    {
                        GameObject gameObject = assetBundle.LoadAsset(text) as GameObject;
                        goopDefinition = gameObject.GetComponent <GoopDefinition>();
                    }
                    catch
                    {
                        goopDefinition = (assetBundle.LoadAsset(text) as GoopDefinition);
                    }
                    goopDefinition.name = text.Replace("assets/data/goops/", "").Replace(".asset", "");
                    BabyGoodLovebulon.goopDefs.Add(goopDefinition);
                }
                List <GoopDefinition> goopDefs = BabyGoodLovebulon.goopDefs;
                PickupObject          byId     = PickupObjectDatabase.GetById(310);
                GoopDefinition        item;

                if (byId == null)
                {
                    item = null;
                }
                else
                {
                    WingsItem component = byId.GetComponent <WingsItem>();
                    item = ((component != null) ? component.RollGoop : null);
                }
                goopDefs.Add(item);
                this.SetGoopIndex(0);
                base.spriteAnimator.Play("idle");
            }
Esempio n. 8
0
    public static string getDisplayName(this PickupObject item)
    {
        var component = item.GetComponent <EncounterTrackable>();

        return(component == null ? item.DisplayName : component.journalData.GetPrimaryDisplayName());
    }
        public void InitializeInternal(PickupObject i)
        {
            this.item = i;
            if (this.item && this.item.encounterTrackable)
            {
                GameStatsManager.Instance.SingleIncrementDifferentiator(this.item.encounterTrackable);
            }

            this.CurrentPrice = this.item.PurchasePrice;
            if (this.m_baseParentShop != null && this.CurrencyType == ShopCurrencyType.KEYS)
            {
                this.CurrentPrice = 1;
                if (this.item.quality == PickupObject.ItemQuality.A)
                {
                    this.CurrentPrice = 2;
                }
                if (this.item.quality == PickupObject.ItemQuality.S)
                {
                    this.CurrentPrice = 3;
                }
            }
            if (this.m_baseParentShop != null && this.CurrencyType == ShopCurrencyType.BLANKS)
            {
                this.CurrentPrice = 1;
                if (this.item.quality == PickupObject.ItemQuality.A || this.item.quality == PickupObject.ItemQuality.S)
                {
                    this.CurrentPrice = 2;
                }
            }
            if (this.m_baseParentShop != null && this.CurrencyType == ShopCurrencyType.CUSTOM)
            {
                this.CurrentPrice = 1;
                if (customPrice != null)
                {
                    this.CurrentPrice = customPrice(this.m_baseParentShop, this, this.item);
                }
                else
                {
                    ETGModConsole.Log("CustomPrice is sadly null please look into this!");
                }
            }

            base.gameObject.AddComponent <tk2dSprite>();
            tk2dSprite tk2dSprite = i.GetComponent <tk2dSprite>();

            if (tk2dSprite == null)
            {
                tk2dSprite = i.GetComponentInChildren <tk2dSprite>();
            }
            base.sprite.SetSprite(tk2dSprite.Collection, tk2dSprite.spriteId);
            base.sprite.IsPerpendicular = true;
            if (this.UseOmnidirectionalItemFacing)
            {
                base.sprite.IsPerpendicular = false;
            }
            base.sprite.HeightOffGround       = 1f;
            this.UseOmnidirectionalItemFacing = true;
            base.sprite.PlaceAtPositionByAnchor(base.transform.parent.position, tk2dBaseSprite.Anchor.MiddleCenter);
            base.sprite.transform.position = base.sprite.transform.position.Quantize(0.0625f);
            DepthLookupManager.ProcessRenderer(base.sprite.renderer);
            tk2dSprite componentInParent = base.transform.parent.gameObject.GetComponentInParent <tk2dSprite>();

            if (componentInParent != null)
            {
                componentInParent.AttachRenderer(base.sprite);
            }
            SpriteOutlineManager.AddOutlineToSprite(base.sprite, Color.black, 0.1f, 0.05f, SpriteOutlineManager.OutlineType.NORMAL);
            GameObject gameObject = null;

            if (this.m_parentShop != null && this.m_parentShop.shopItemShadowPrefab != null)
            {
                gameObject = this.m_parentShop.shopItemShadowPrefab;
            }
            if (this.m_baseParentShop != null && this.m_baseParentShop.shopItemShadowPrefab != null)
            {
                gameObject = this.m_baseParentShop.shopItemShadowPrefab;
            }
            if (gameObject != null)
            {
                if (!this.m_shadowObject)
                {
                    this.m_shadowObject = UnityEngine.Object.Instantiate <GameObject>(gameObject);
                }
                tk2dBaseSprite component = this.m_shadowObject.GetComponent <tk2dBaseSprite>();
                component.PlaceAtPositionByAnchor(base.sprite.WorldBottomCenter, tk2dBaseSprite.Anchor.MiddleCenter);
                component.transform.position = component.transform.position.Quantize(0.0625f);
                base.sprite.AttachRenderer(component);
                component.transform.parent = base.sprite.transform;
                component.HeightOffGround  = -0.5f;
            }
            base.sprite.UpdateZDepth();
            SpeculativeRigidbody orAddComponent = base.gameObject.GetOrAddComponent <SpeculativeRigidbody>();

            orAddComponent.PixelColliders = new List <PixelCollider>();
            PixelCollider pixelCollider = new PixelCollider
            {
                ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Circle,
                CollisionLayer         = CollisionLayer.HighObstacle,
                ManualDiameter         = 14
            };
            Vector2 vector = base.sprite.WorldCenter - base.transform.position.XY();

            pixelCollider.ManualOffsetX = PhysicsEngine.UnitToPixel(vector.x) - 7;
            pixelCollider.ManualOffsetY = PhysicsEngine.UnitToPixel(vector.y) - 7;
            orAddComponent.PixelColliders.Add(pixelCollider);
            orAddComponent.Initialize();
            orAddComponent.OnPreRigidbodyCollision = null;
            SpeculativeRigidbody speculativeRigidbody = orAddComponent;

            speculativeRigidbody.OnPreRigidbodyCollision = (SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate)Delegate.Combine(speculativeRigidbody.OnPreRigidbodyCollision, new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate(this.ItemOnPreRigidbodyCollision));
            base.RegenerateCache();
            if (!GameManager.Instance.IsFoyer && this.item is Gun && GameManager.Instance.PrimaryPlayer.CharacterUsesRandomGuns)
            {
                this.ForceOutOfStock();
            }
        }
Esempio n. 10
0
    void PickUp()
    {
        weapon = nearbyPickup.GetComponent<PickupObject> ();
        moveCont.anim.SetBool ("Holding", true);
        weapon.PickUp (this.transform);

        armLSR.sprite = armHoldRes;
        armRSR.sprite = armHoldRes;

        Vector3 theScale 	 	  = armR.transform.localScale;
        theScale.x 				 *= -1;
        armR.transform.localScale = theScale;
        arms.transform.position   = armHoldPos.transform.position;

        if(weapon.objName.Equals("rocketlauncher")){
            weaponCurAmmo = weapon.GetComponent<RocketLauncher> ().ammoAmount;
            weaponMaxAmmo = weaponCurAmmo;
        } else if(weapon.objName.Equals("ak47")){
            weaponCurAmmo = weapon.GetComponent<AK47> ().ammoAmount;
            weaponMaxAmmo = weaponCurAmmo;
        } else {
            weaponCurAmmo = 0;
            weaponMaxAmmo = weaponCurAmmo;
        }
    }
Esempio n. 11
0
        // Token: 0x06000172 RID: 370 RVA: 0x00013060 File Offset: 0x00011260
        public static void Init()
        {
            AssetBundle    assetBundle = ResourceManager.LoadAssetBundle("shared_auto_001");
            string         text        = "assets/data/goops/water goop.asset";
            GoopDefinition goopDefinition;

            try
            {
                GameObject gameObject = assetBundle.LoadAsset(text) as GameObject;
                goopDefinition = gameObject.GetComponent <GoopDefinition>();
            }
            catch
            {
                goopDefinition = (assetBundle.LoadAsset(text) as GoopDefinition);
            }
            goopDefinition.name    = text.Replace("assets/data/goops/", "").Replace(".asset", "");
            tools.DefaultWaterGoop = goopDefinition;
            text = "assets/data/goops/poison goop.asset";
            GoopDefinition goopDefinition2;

            try
            {
                GameObject gameObject2 = assetBundle.LoadAsset(text) as GameObject;
                goopDefinition2 = gameObject2.GetComponent <GoopDefinition>();
            }
            catch
            {
                goopDefinition2 = (assetBundle.LoadAsset(text) as GoopDefinition);
            }
            goopDefinition2.name    = text.Replace("assets/data/goops/", "").Replace(".asset", "");
            tools.DefaultPoisonGoop = goopDefinition2;
            text = "assets/data/goops/napalmgoopquickignite.asset";
            GoopDefinition goopDefinition3;

            try
            {
                GameObject gameObject3 = assetBundle.LoadAsset(text) as GameObject;
                goopDefinition3 = gameObject3.GetComponent <GoopDefinition>();
            }
            catch
            {
                goopDefinition3 = (assetBundle.LoadAsset(text) as GoopDefinition);
            }
            goopDefinition3.name  = text.Replace("assets/data/goops/", "").Replace(".asset", "");
            tools.DefaultFireGoop = goopDefinition3;
            PickupObject   byId = PickupObjectDatabase.GetById(310);
            bool           flag = byId == null;
            GoopDefinition defaultCharmGoop;

            if (flag)
            {
                defaultCharmGoop = null;
            }
            else
            {
                WingsItem component = byId.GetComponent <WingsItem>();
                defaultCharmGoop = ((component != null) ? component.RollGoop : null);
            }
            tools.DefaultCharmGoop    = defaultCharmGoop;
            tools.DefaultCheeseGoop   = (PickupObjectDatabase.GetById(626) as Gun).DefaultModule.projectiles[0].cheeseEffect.CheeseGoop;
            tools.DefaultBlobulonGoop = EnemyDatabase.GetOrLoadByGuid("0239c0680f9f467dbe5c4aab7dd1eca6").GetComponent <GoopDoer>().goopDefinition;
            tools.DefaultPoopulonGoop = EnemyDatabase.GetOrLoadByGuid("116d09c26e624bca8cca09fc69c714b3").GetComponent <GoopDoer>().goopDefinition;
        }
Esempio n. 12
0
        // Token: 0x060000C7 RID: 199 RVA: 0x00009464 File Offset: 0x00007664
        public static AdvancedSynergyEntry Add(string name, List <string> mandatoryConsoleIDs, List <string> optionalConsoleIDs = null, bool ignoreLichEyeBullets = true)
        {
            bool flag = mandatoryConsoleIDs == null || mandatoryConsoleIDs.Count == 0;
            AdvancedSynergyEntry result;

            if (flag)
            {
                ETGModConsole.Log("Synergy " + name + " has no mandatory items/guns.", false);
                result = null;
            }
            else
            {
                List <int> list  = new List <int>();
                List <int> list2 = new List <int>();
                List <int> list3 = new List <int>();
                List <int> list4 = new List <int>();
                foreach (string text in mandatoryConsoleIDs)
                {
                    PickupObject pickupObject = Game.Items[text];
                    bool         flag2        = pickupObject && pickupObject.GetComponent <Gun>();
                    if (flag2)
                    {
                        list2.Add(pickupObject.PickupObjectId);
                    }
                    else
                    {
                        bool flag3 = pickupObject && (pickupObject.GetComponent <PlayerItem>() || pickupObject.GetComponent <PassiveItem>());
                        if (flag3)
                        {
                            list.Add(pickupObject.PickupObjectId);
                        }
                    }
                }
                bool flag4 = optionalConsoleIDs != null;
                if (flag4)
                {
                    foreach (string text2 in optionalConsoleIDs)
                    {
                        PickupObject pickupObject = Game.Items[text2];
                        bool         flag5        = pickupObject && pickupObject.GetComponent <Gun>();
                        if (flag5)
                        {
                            list4.Add(pickupObject.PickupObjectId);
                        }
                        else
                        {
                            bool flag6 = pickupObject && (pickupObject.GetComponent <PlayerItem>() || pickupObject.GetComponent <PassiveItem>());
                            if (flag6)
                            {
                                list3.Add(pickupObject.PickupObjectId);
                            }
                        }
                    }
                }
                AdvancedSynergyEntry advancedSynergyEntry = new AdvancedSynergyEntry
                {
                    NameKey          = name,
                    MandatoryItemIDs = list,
                    MandatoryGunIDs  = list2,
                    OptionalItemIDs  = list3,
                    OptionalGunIDs   = list4,
                    bonusSynergies   = new List <CustomSynergyType>(),
                    statModifiers    = new List <StatModifier>()
                };
                CustomSynergies.Add(advancedSynergyEntry);
                result = advancedSynergyEntry;
            }
            return(result);
        }
Esempio n. 13
0
        // Token: 0x0600028C RID: 652 RVA: 0x000162F8 File Offset: 0x000144F8
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("HONK", "horn");

            Game.Items.Rename("outdated_gun_mods:honk", "cak:honk");
            GunExt.SetShortDescription(gun, "Prince Charming");
            GunExt.SetLongDescription(gun, "Wielded by a legendary ringmaster at one point, it was lost in the gungeon and it's magicks shifted into a violate weapon.");
            GunExt.SetupSprite(gun, null, "horn_idle_001", 8);
            GunExt.SetAnimationFPS(gun, gun.shootAnimation, 16);
            GunExt.SetAnimationFPS(gun, gun.chargeAnimation, 6);
            GunExt.AddProjectileModuleFrom(gun, PickupObjectDatabase.GetById(124) as Gun, true, false);



            foreach (ProjectileModule projectileModule in gun.Volley.projectiles)
            {
                projectileModule.ammoCost            = 1;
                projectileModule.shootStyle          = ProjectileModule.ShootStyle.Charged;
                projectileModule.sequenceStyle       = ProjectileModule.ProjectileSequenceStyle.Random;
                projectileModule.cooldownTime        = 1f;
                projectileModule.angleVariance       = 20f;
                projectileModule.numberOfShotsInClip = 1;
                Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(projectileModule.projectiles[0]);
                projectileModule.projectiles[0] = projectile;
                projectile.gameObject.SetActive(false);
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                UnityEngine.Object.DontDestroyOnLoad(projectile);
                projectile.baseData.damage           *= 10f;
                projectile.AdditionalScaleMultiplier *= 2f;
                projectile.baseData.range            *= 0.5f;
                GoopModifier   goop  = projectile.gameObject.AddComponent <GoopModifier>();
                PickupObject   byId  = PickupObjectDatabase.GetById(310);
                bool           flagf = byId == null;
                GoopDefinition defaultCharmGoop;
                if (flagf)
                {
                    defaultCharmGoop = null;
                }
                else
                {
                    WingsItem component = byId.GetComponent <WingsItem>();
                    defaultCharmGoop = ((component != null) ? component.RollGoop : null);
                }
                goop.SpawnGoopInFlight                       = true;
                goop.goopDefinition                          = UnityEngine.Object.Instantiate <GoopDefinition>(defaultCharmGoop);
                goop.goopDefinition.CanBeIgnited             = true;
                goop.goopDefinition.CanBeFrozen              = true;
                goop.goopDefinition.CanBeElectrified         = true;
                goop.goopDefinition.damagePerSecondtoEnemies = 1f;
                goop.InFlightSpawnRadius                     = 2f;
                goop.goopDefinition.damagesEnemies           = true;
                bool flag = projectileModule != gun.DefaultModule;
                if (flag)
                {
                    projectileModule.ammoCost = 0;
                }
                projectile.transform.parent = gun.barrelOffset;
                ProjectileModule.ChargeProjectile item = new ProjectileModule.ChargeProjectile
                {
                    Projectile = projectile,
                    ChargeTime = 1f
                };
                PierceProjModifier orAddComponent = projectile.gameObject.GetOrAddComponent <PierceProjModifier>();
                orAddComponent.penetratesBreakables = true;
                orAddComponent.penetration++;
                projectileModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile>
                {
                    item
                };
            }
            gun.reloadTime = 1f;
            gun.SetBaseMaxAmmo(100);
            gun.DefaultModule.angleVariance = 0.2f;
            gun.quality = PickupObject.ItemQuality.B;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 3;
            gun.encounterTrackable.EncounterGuid = "HONKERWONK";
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.barrelOffset.transform.localPosition = new Vector3(1.37f, 0.37f, 0f);
            Horn.HornID = gun.PickupObjectId;
        }
Esempio n. 14
0
        IEnumerator RespawnCoroutine()
        {
            // Despawn cube
            MaterializeObject cubeMaterialize = cubeFollowing.GetComponent <MaterializeObject>();

            cubeMaterialize.destroyObjectOnDematerialize = false;
            cubeMaterialize.Dematerialize();

            yield return(new WaitForSeconds(respawnDelay));

            // Move cube
            float timeElapsed = 0f;

            cubeFollowing.transform.position = receptacleToRespawnIn.transform.position + receptacleToRespawnIn.transform.up * 1f;
            cubeFollowing.transform.rotation = Quaternion.Euler(0, 0, 0);

            // Turn on outer/inner particles
            CalmParticleSystem(outerParticles);
            CalmParticleSystem(innerParticles);
            // Track to the cube's new position
            while (timeElapsed < respawnTrackDuration)
            {
                timeElapsed += Time.deltaTime;

                TrackCube(respawnTrackSlerpSpeed);

                yield return(null);
            }

            // Turn on the laser particles
            CalmParticleSystem(laserToCubeCone);
            CalmParticleSystem(laserToCube);
            yield return(new WaitForSeconds(cameraShakeDelay));

            CameraShake.instance.Shake(laserToRespawnDelay + respawnLaserTime - cameraShakeDelay + 0.15f, 0f, cameraShakeIntensityOnCubeRespawn);
            yield return(new WaitForSeconds(respawnLaserTime - cameraShakeDelay));

            laserToCubeCone.Stop();
            laserToCube.Stop();

            yield return(new WaitForSeconds(laserToRespawnDelay));

            // Respawn cube
            cubeMaterialize.Materialize();
            cubeMaterialize.GetComponent <Collider>().enabled = false;

            yield return(new WaitForSeconds(respawnEndDelay));

            cubeMaterialize.GetComponent <Collider>().enabled = true;
            float speedBefore = powerTrailHorizontalBlue.speed;

            powerTrailHorizontalBlue.speed  = 2 * speedBefore;
            powerTrailHorizontalGreen.speed = 2 * speedBefore;
            powerTrailVerticalBlue.speed    = 2 * speedBefore;
            powerTrailVerticalGreen.speed   = 2 * speedBefore;
            cubeFollowing.interactable      = false;

            yield return(new WaitForSeconds(powerTrailHorizontalBlue.duration));

            powerTrailHorizontalBlue.speed  = speedBefore;
            powerTrailHorizontalGreen.speed = speedBefore;
            powerTrailVerticalBlue.speed    = speedBefore;
            powerTrailVerticalGreen.speed   = speedBefore;
            cubeFollowing.interactable      = true;
            Debug.LogError($"After {cubeFollowing.interactable}");

            StartCalm();
        }
Esempio n. 15
0
        protected override void DoSetup()
        {
            base.m_shopItems = new List <GameObject>();
            List <int> list = new List <int>();
            Func <GameObject, float, float> weightModifier = null;

            if (SecretHandshakeItem.NumActive > 0)
            {
                weightModifier = delegate(GameObject prefabObject, float sourceWeight)
                {
                    PickupObject component10 = prefabObject.GetComponent <PickupObject>();
                    float        num7        = sourceWeight;
                    if (component10 != null)
                    {
                        int quality = (int)component10.quality;
                        num7 *= 1f + (float)quality / 10f;
                    }
                    return(num7);
                };
            }
            bool flag = GameStatsManager.Instance.IsRainbowRun;

            for (int i = 0; i < base.spawnPositions.Length; i++)
            {
                if (flag)
                {
                    base.m_shopItems.Add(null);
                }
                else
                {
                    GameObject gameObject5 = this.shopItems.SubshopSelectByWeightWithoutDuplicatesFullPrereqs(this.m_shopItems, weightModifier, 1, GameManager.Instance.IsSeeded);
                    this.m_shopItems.Add(gameObject5);
                }
            }
            m_itemControllers = new List <ShopItemController>();
            for (int m = 0; m < base.spawnPositions.Length; m++)
            {
                Transform transform = base.spawnPositions[m];
                if (!flag && !(base.m_shopItems[m] == null))
                {
                    PickupObject component4 = base.m_shopItems[m].GetComponent <PickupObject>();
                    if (!(component4 == null))
                    {
                        GameObject gameObject6 = new GameObject("Shop item " + m.ToString());
                        Transform  transform2  = gameObject6.transform;
                        transform2.parent        = transform;
                        transform2.localPosition = Vector3.zero;
                        EncounterTrackable component5 = component4.GetComponent <EncounterTrackable>();
                        if (component5 != null)
                        {
                            GameManager.Instance.ExtantShopTrackableGuids.Add(component5.EncounterGuid);
                        }
                        CustomShopItemController shopItemController = gameObject6.AddComponent <CustomShopItemController>();


                        this.AssignItemFacing(transform, shopItemController);
                        if (!base.m_room.IsRegistered(shopItemController))
                        {
                            base.m_room.RegisterInteractable(shopItemController);
                        }

                        shopItemController.CurrencyType = currencyType;


                        shopItemController.customCanBuy   += CustomCanBuyMethod;
                        shopItemController.customPrice    += CustomPriceMethod;
                        shopItemController.removeCurrency += RemoveCurrencyMethod;

                        shopItemController.OnPurchase += OnPurchaseMethod;
                        shopItemController.OnSteal    += OnStealMethod;

                        shopItemController.customPriceSprite = this.customPriceSprite;

                        shopItemController.Initialize(component4, this);
                        m_itemControllers.Add(shopItemController);
                    }
                }
            }
            bool flag3 = false;

            if (base.shopItemsGroup2 != null && base.spawnPositionsGroup2.Length > 0)
            {
                int count = base.m_shopItems.Count;
                for (int num2 = 0; num2 < base.spawnPositionsGroup2.Length; num2++)
                {
                    if (flag)
                    {
                        base.m_shopItems.Add(null);
                    }
                    else
                    {
                        float num3 = base.spawnGroupTwoItem1Chance;
                        if (num2 == 1)
                        {
                            num3 = base.spawnGroupTwoItem2Chance;
                        }
                        else if (num2 == 2)
                        {
                            num3 = base.spawnGroupTwoItem3Chance;
                        }
                        bool isSeeded = GameManager.Instance.IsSeeded;
                        if (((!isSeeded) ? UnityEngine.Random.value : BraveRandom.GenerationRandomValue()) < num3)
                        {
                            float replaceFirstRewardWithPickup = GameManager.Instance.RewardManager.CurrentRewardData.ReplaceFirstRewardWithPickup;
                            if (!flag3 && ((!isSeeded) ? UnityEngine.Random.value : BraveRandom.GenerationRandomValue()) < replaceFirstRewardWithPickup)
                            {
                                flag3 = true;
                                GameObject item2 = base.shopItems.SelectByWeightWithoutDuplicatesFullPrereqs(base.m_shopItems, weightModifier, GameManager.Instance.IsSeeded);
                                base.m_shopItems.Add(item2);
                            }
                            else if (!GameStatsManager.Instance.IsRainbowRun)
                            {
                                GameObject rewardObjectShopStyle2 = GameManager.Instance.RewardManager.GetRewardObjectShopStyle(GameManager.Instance.PrimaryPlayer, false, false, base.m_shopItems);
                                base.m_shopItems.Add(rewardObjectShopStyle2);
                            }
                            else
                            {
                                base.m_shopItems.Add(null);
                            }
                        }
                        else
                        {
                            base.m_shopItems.Add(null);
                        }
                    }
                }
                for (int num4 = 0; num4 < base.spawnPositionsGroup2.Length; num4++)
                {
                    Transform transform3 = base.spawnPositionsGroup2[num4];
                    if (!flag && !(base.m_shopItems[count + num4] == null))
                    {
                        PickupObject component8 = base.m_shopItems[count + num4].GetComponent <PickupObject>();
                        if (!(component8 == null))
                        {
                            GameObject gameObject8 = new GameObject("Shop 2 item " + num4.ToString());
                            Transform  transform4  = gameObject8.transform;
                            transform4.parent        = transform3;
                            transform4.localPosition = Vector3.zero;
                            EncounterTrackable component9 = component8.GetComponent <EncounterTrackable>();
                            if (component9 != null)
                            {
                                GameManager.Instance.ExtantShopTrackableGuids.Add(component9.EncounterGuid);
                            }
                            CustomShopItemController shopItemController2 = gameObject8.AddComponent <CustomShopItemController>();
                            this.AssignItemFacing(transform3, shopItemController2);
                            if (!base.m_room.IsRegistered(shopItemController2))
                            {
                                base.m_room.RegisterInteractable(shopItemController2);
                            }
                            shopItemController2.Initialize(component8, this);
                            m_itemControllers.Add(shopItemController2);
                        }
                    }
                }
            }

            /*for (int num6 = 0; num6 < m_customShopItemControllers.Count; num6++)
             * {
             *
             *      m_customShopItemControllers[num6].CurrencyType = currencyType;
             *
             *      m_customShopItemControllers[num6].CustomCanBuy += Balls.CustomCanBuy;
             *      m_customShopItemControllers[num6].CustomPrice += Balls.CustomPrice;
             *      m_customShopItemControllers[num6].RemoveCurrency += Balls.RemoveCurrency;
             *      m_customShopItemControllers[num6].customPriceSprite = this.customPriceSprite;
             * }*/
        }