public IEnumerator generateExplosion(Exploder exploder) {
		for (int i = 0; i < count; i++) {
			GameObject explosion = (GameObject) GameObject.Instantiate(volumetricExplosion, Random.insideUnitSphere * scale * randomness + transform.position, Random.rotation);
			explosion.transform.localScale *= scale * (Random.Range(0.5f, 1) * randomness + 1);
			((PseudoVolumetricExplosion) explosion.GetComponent<PseudoVolumetricExplosion>()).timeScale = duration * Random.Range(1 - 0.35f * randomness, 1);
			yield return new WaitForSeconds(Random.Range(0, duration * 0.5f * randomness));
		}
	}
 void Awake()
 {
     if (!exploder)
     {
         exploder = Resources.Load<Exploder>("Exploder");
         exploder.BuildPools();
     }
 }
Example #3
0
 public static GameObject GetConnection(Exploder x)
 {
     switch(x){
     case Exploder.Sparkles:
         return Instance.SparkleExplode;
     default:
         return null;
     }
 }
	public override void onExplosionStarted(Exploder exploder)
	{
		GameObject container = (GameObject)GameObject.Instantiate(explosionEffectsContainer, transform.position, Quaternion.identity);
		ParticleSystem[] systems = container.GetComponentsInChildren<ParticleSystem>();
		foreach (ParticleSystem system in systems) {
			system.startSpeed *= scale;
			system.startSize *= scale;
			system.transform.localScale *= scale;
			system.playbackSpeed = playbackSpeed;
		}
	}
	IEnumerator lightUp(Exploder exploder) {
		Light light = (Light) GameObject.Instantiate(lightning, transform.position, transform.rotation);
		light.transform.parent = transform;
		light.range = radius;
		float startIntencity = light.intensity;
		float startTime = Time.time;
		while (exploder.explodeDuration > Time.time - startTime) {
			light.intensity = Mathf.Lerp(startIntencity, 0, (Time.time - startTime) / exploder.explodeDuration); 
			yield return new WaitForEndOfFrame();
		}
		GameObject.Destroy(light);
		yield return null;
	}
Example #6
0
    public void Init(Object owner, Vector3 position, Vector3 velocity, float life)
    {
        exploder = GetComponent<Exploder>();
        detector = GetComponent<CollisionDetector>();

        detector.ClearEvents();
        detector.Collided += detector_Collided;

        Owner = owner;
        transform.position = position;
        Velocity = velocity;
        Lifetime = life;

        gameObject.SetActive(true);
    }
	public override void onExplosionStarted(Exploder exploder) {
		particles = new ParticleSystem.Particle[maxParticles];
		directions = new Vector2[maxParticles];
		hitCount = new int[maxParticles];
		
		if (GetComponent<ParticleSystem>() == null) {
			gameObject.AddComponent<ParticleSystem>();
		}
		this.exploder = exploder;
		if (radius < 0.0001f) {
			radius = exploder.radius;
		}
		speed = radius / duration;
		
		initParticleSystem();
		
		StartCoroutine("emulate");
	}
Example #8
0
	void Start ()
	{
        // Find this car's Exploder so we can destroy some voxels when it hits something
	    exploder = transform.FindChild("Exploder").GetComponent<Exploder>();

	    rigidBody = GetComponent<Rigidbody>();
	    StartCoroutine(InitPhysics());

        // Set the car's tint color!
        Material m = new Material(transform.FindChild("Body").GetComponent<Volume>().Material);
        m.SetColor("_Tint", Color);
	    transform.FindChild("Body").GetComponent<Volume>().Material = m;
        transform.FindChild("Body").GetComponent<Volume>().UpdateAllChunks();

        // If this car is player controllerd, it should have a camera attached
	    if (IsPlayerControlled)
	    {
	        mainCamera = transform.FindChild("Main Camera").GetComponent<Camera>();
	        cameraStartPosition = mainCamera.transform.localPosition;
	    }
	}
Example #9
0
    void Start()
    {
        // Setting the gravity manually because the demo games are shared in one project
        Physics.gravity = new Vector3(0f,-50f,0f);

        // Find this car's Exploder so we can destroy some voxels when it hits something
        exploder = transform.FindChild("Exploder").GetComponent<Exploder>();

        rigidBody = GetComponent<Rigidbody>();

        // Set the car's tint color!
        Material m = new Material(transform.FindChild("Body").GetComponent<Volume>().Material);
        m.SetColor("_Tint", Color);
        transform.FindChild("Body").GetComponent<Volume>().Material = m;
        transform.FindChild("Body").GetComponent<Volume>().UpdateAllChunks();

        // If this car is player controllerd, it should have a camera attached
        if (IsPlayerControlled)
        {
            mainCamera = transform.FindChild("Main Camera").GetComponent<Camera>();
            cameraStartPosition = mainCamera.transform.localPosition;
        }
    }
Example #10
0
 public abstract void onExplosionStarted(Exploder exploder);
Example #11
0
    /* This function is called once upon game scene loading, and upon menu scene loading.
     *  It's not efficient and is pretty bulky, but it's only called once per game load
     *  Note: "GameObject.Find" calls are necessary since scene references can't be set before scene exists
     *
     *  Game load sets all settings.
     *  Menu load tells menu to go to unlocks screen, but only if the menu has been visited once already (game start).
     */
    void ApplyGameModeSettings(Scene scene, LoadSceneMode mode)
    {
        //music obj is same in both scenes


        if (scene.name.Equals("Game"))
        {
            Debug.Log("Persistent settings are applying to the current scene...");

            GameObject gameMaster = GameObject.Find("GameMaster");

            GamePattern gamePattern = gameMaster.GetComponent <GamePattern>();

            gamePattern.fireMode          = fireMode;           // firemode
            gamePattern.rotateBy45Degrees = rotate45;           // roation
            gamePattern.minWaitTime       = minWaitTime;        // min time between block throws
            gamePattern.maxWaitTime       = maxWaitTime;        // max time between block throws

            //apply a palette - based on player options or gamemode
            if (optionOverridePalette != null && !impossibleMode)
            {
                gamePattern.currentPalette = optionOverridePalette; //use player selection instead if there is one (only exception is impossible mode!)
            }
            else
            {
                gamePattern.currentPalette = settingPalette;        // the colour palette object to pull from - passes through Pattern into throw()
            }
            ScoreData scoreData = gameMaster.GetComponent <ScoreData>();
            scoreData.makeScoreNegative = makeScoreNegative;
            scoreData.currentMode       = currentModeName;

            GameObject cameraMain     = GameObject.Find("Main Camera");
            GameObject cameraKillLine = GameObject.Find("KillLine Camera");
            if (flipCamera)
            {
                cameraMain.transform.eulerAngles = new Vector3(0, 0, 180);
            }
            else
            {
                cameraMain.transform.eulerAngles = new Vector3(0, 0, 0);    //need this line to reset when changing between gamemodes in same session
            }
            if (flipCamera)
            {
                cameraKillLine.transform.eulerAngles = new Vector3(0, 0, 180);
            }
            else
            {
                cameraKillLine.transform.eulerAngles = new Vector3(0, 0, 0);    //need this line to reset when changing between gamemodes in same session
            }
            Player player = GameObject.Find("Player").GetComponent <Player>();
            player.slipperyJumpAllowed = slipperyJumpAllowed;
            Boost boost = GameObject.Find("Player").GetComponent <Boost>();
            boost.cooldownLength = boostCooldown;
            Exploder exploder = GameObject.Find("Player").GetComponent <Exploder>();
            exploder.immuneToCrush = immuneToCrush;

            AudioSource sceneMusic = GameObject.Find("Music").GetComponent <AudioSource>();
            sceneMusic.mute = musicMuted;

            Debug.Log("Persistent settings application complete.");
        }

        //ensures menu loads into the unlocks screen
        else if (scene.name.Equals("MainMenu"))
        {
            MainMenu menuNav = GameObject.Find("MenuNavigator").GetComponent <MainMenu>();

            if (mainMenuVisitedOnGameStartFlag && unlockMessageQueue.Count > 0)
            {
                Debug.Log("PersistentSettings is notifying MenuNavigator that a game has been played. Menu should load into unlock screen.");
                menuNav.userHasPlayedARound = true;
                //there's no need to set the unlock messages; they are collected automatically then wiped by the UnlockCanvas
            }

            if (musicMuted)
            {
                Debug.Log("Attempting to mute music on main menu");
                menuNav.needToApplyPersistentMusicMute = true;
            }
        }

        mainMenuVisitedOnGameStartFlag = true; //flag to mark that the main menu has been visited
    }
	public override void onExplosionStarted(Exploder exploder) {
		if (radius < 0.0001f) {
			radius = exploder.radius;
		}
		StartCoroutine("lightUp", exploder);
	}
	public override void onExplosionStarted (Exploder exploder) {
		StartCoroutine("generateExplosion", exploder);
	}
Example #14
0
            public override void OnEffect(GameObject obj)
            {
                float         radius        = UnityEngine.Random.Range(2f, 5f);
                float         force         = UnityEngine.Random.Range(25f, 50f);
                ExplosionData explosionData = new ExplosionData
                {
                    useDefaultExplosion = false,
                    doDamage            = true,
                    forceUseThisRadius  = false,
                    damageRadius        = radius,
                    damageToPlayer      = 0,
                    damage                       = UnityEngine.Random.Range(10f, 50f),
                    breakSecretWalls             = UnityEngine.Random.value <= 0.5f,
                    secretWallsRadius            = radius,
                    forcePreventSecretWallDamage = false,
                    doDestroyProjectiles         = true,
                    doForce                      = true,
                    pushRadius                   = UnityEngine.Random.Range(3f, 10f),
                    force                  = force,
                    debrisForce            = force,
                    preventPlayerForce     = false,
                    explosionDelay         = 0f,
                    usesComprehensiveDelay = false,
                    comprehensiveDelay     = 0,
                    playDefaultSFX         = false,

                    doScreenShake = true,
                    ss            = new ScreenShakeSettings
                    {
                        magnitude               = UnityEngine.Random.Range(1f, 3f),
                        speed                   = 6.5f,
                        time                    = 0.22f,
                        falloff                 = 0,
                        direction               = new Vector2(0, 0),
                        vibrationType           = ScreenShakeSettings.VibrationType.Auto,
                        simpleVibrationStrength = Vibration.Strength.Medium,
                        simpleVibrationTime     = Vibration.Time.Normal
                    },
                    doStickyFriction             = true,
                    doExplosionRing              = true,
                    isFreezeExplosion            = false,
                    freezeRadius                 = 5,
                    IsChandelierExplosion        = false,
                    rotateEffectToNormal         = false,
                    ignoreList                   = new List <SpeculativeRigidbody>(),
                    overrideRangeIndicatorEffect = null,
                    effect       = radius > 3.5f ? StaticExplosionDatas.genericLargeExplosion.effect : StaticExplosionDatas.explosiveRoundsExplosion.effect,
                    freezeEffect = null,
                };

                if (obj.GetComponent <CustomThrowableObject>().SpawningPlayer.PlayerHasActiveSynergy("Roll With Advantage"))
                {
                    DeadlyDeadlyGoopManager goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(BraveUtility.RandomElement(new List <GoopDefinition>()
                    {
                        EasyGoopDefinitions.BlobulonGoopDef,
                        EasyGoopDefinitions.CharmGoopDef,
                        EasyGoopDefinitions.CheeseDef,
                        EasyGoopDefinitions.FireDef,
                        EasyGoopDefinitions.GreenFireDef,
                        EasyGoopDefinitions.HoneyGoop,
                        EasyGoopDefinitions.OilDef,
                        EasyGoopDefinitions.PitGoop,
                        EasyGoopDefinitions.PlagueGoop,
                        EasyGoopDefinitions.PlayerFriendlyWebGoop,
                        EasyGoopDefinitions.WaterGoop
                    }));
                    goop.TimedAddGoopCircle(obj.transform.position, 4, 0.75f, true);
                }
                Exploder.Explode(obj.GetComponent <tk2dSprite>().WorldCenter, explosionData, Vector2.zero);
                StartCoroutine(Kill(obj));
            }
	public abstract void onExplosionStarted(Exploder exploder);
Example #16
0
        public static void CurseRoomRewardMethod(Action <RoomHandler> orig, RoomHandler self)
        {
            bool harderlotj = JammedSquire.NoHarderLotJ;

            if (harderlotj)
            {
                orig(self);
            }
            else
            {
                orig(self);
                FloorRewardData         currentRewardData = GameManager.Instance.RewardManager.CurrentRewardData;
                LootEngine.AmmoDropType ammoDropType      = LootEngine.AmmoDropType.DEFAULT_AMMO;
                bool   flag  = LootEngine.DoAmmoClipCheck(currentRewardData, out ammoDropType);
                string path  = (ammoDropType != LootEngine.AmmoDropType.SPREAD_AMMO) ? "Ammo_Pickup" : "Ammo_Pickup_Spread";
                float  value = UnityEngine.Random.value;
                float  num   = currentRewardData.ChestSystem_ChestChanceLowerBound;
                //float num2 = GameManager.Instance.PrimaryPlayer.stats.GetStatValue(PlayerStats.StatType.Coolness) / 100f;
                float num3 = (GameManager.Instance.PrimaryPlayer.stats.GetStatValue(PlayerStats.StatType.Curse) / 250f);
                if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER)
                {
                    num3 += GameManager.Instance.SecondaryPlayer.stats.GetStatValue(PlayerStats.StatType.Curse) / 250f;
                }
                if (PassiveItem.IsFlagSetAtAll(typeof(ChamberOfEvilItem)))
                {
                    num3 *= 1.25f;
                }
                num = Mathf.Clamp(num + GameManager.Instance.PrimaryPlayer.AdditionalChestSpawnChance, currentRewardData.ChestSystem_ChestChanceLowerBound, currentRewardData.ChestSystem_ChestChanceUpperBound) + num3;
                bool  flag2 = currentRewardData.SingleItemRewardTable != null;
                bool  flag3 = false;
                float num4  = 0.1f;
                if (!RoomHandler.HasGivenRoomChestRewardThisRun && MetaInjectionData.ForceEarlyChest)
                {
                    flag3 = true;
                }
                if (flag3)
                {
                    if (!RoomHandler.HasGivenRoomChestRewardThisRun && (GameManager.Instance.CurrentFloor == 1 || GameManager.Instance.CurrentFloor == -1))
                    {
                        flag2 = false;
                        num  += num4;
                        if (GameManager.Instance.PrimaryPlayer && GameManager.Instance.PrimaryPlayer.NumRoomsCleared > 4)
                        {
                            num = 1f;
                        }
                    }
                    if (!RoomHandler.HasGivenRoomChestRewardThisRun && self.distanceFromEntrance < RoomHandler.NumberOfRoomsToPreventChestSpawning)
                    {
                        GameManager.Instance.Dungeon.InformRoomCleared(false, false);
                        return;
                    }
                }
                BraveUtility.Log("Current chest spawn chance: " + num, Color.yellow, BraveUtility.LogVerbosity.IMPORTANT);
                if (value > num)
                {
                    if (flag)
                    {
                        IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                        LootEngine.SpawnItem((GameObject)BraveResources.Load(path, ".prefab"), bestRewardLocation.ToVector3(), Vector2.up, 1f, true, true, false);
                    }
                    GameManager.Instance.Dungeon.InformRoomCleared(false, false);
                    return;
                }
                if (flag2)
                {
                    float num5 = currentRewardData.PercentOfRoomClearRewardsThatAreChests;
                    if (PassiveItem.IsFlagSetAtAll(typeof(AmazingChestAheadItem)))
                    {
                        num5 *= 2f;
                        num5  = Mathf.Max(0.5f, num5);
                    }
                    flag2 = (UnityEngine.Random.value > num5);
                }
                if (flag2)
                {
                    float      num6 = (GameManager.Instance.CurrentGameType != GameManager.GameType.COOP_2_PLAYER) ? GameManager.Instance.RewardManager.SinglePlayerPickupIncrementModifier : GameManager.Instance.RewardManager.CoopPickupIncrementModifier;
                    GameObject gameObject;
                    if (UnityEngine.Random.value < 1f / num6)
                    {
                        gameObject = currentRewardData.SingleItemRewardTable.SelectByWeight(false);
                    }
                    else
                    {
                        gameObject = ((UnityEngine.Random.value >= 0.9f) ? GameManager.Instance.RewardManager.FullHeartPrefab.gameObject : GameManager.Instance.RewardManager.HalfHeartPrefab.gameObject);
                    }
                    UnityEngine.Debug.Log(gameObject.name + "SPAWNED");
                    DebrisObject debrisObject = LootEngine.SpawnItem(gameObject, self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true).ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
                    Exploder.DoRadialPush(debrisObject.sprite.WorldCenter.ToVector3ZUp(debrisObject.sprite.WorldCenter.y), 8f, 3f);
                    AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", debrisObject.gameObject);
                    GameManager.Instance.Dungeon.InformRoomCleared(true, false);
                }
                else
                {
                    IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(2, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                    bool       isRainbowRun       = GameStatsManager.Instance.IsRainbowRun;
                    if (isRainbowRun)
                    {
                        LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, bestRewardLocation.ToCenterVector2(), self, true);
                        RoomHandler.HasGivenRoomChestRewardThisRun = true;
                    }
                    else
                    {
                        Chest exists = self.SpawnRoomRewardChest(null, bestRewardLocation);
                        if (exists)
                        {
                            RoomHandler.HasGivenRoomChestRewardThisRun = true;
                        }
                    }
                    GameManager.Instance.Dungeon.InformRoomCleared(true, true);
                }
                if (flag)
                {
                    IntVector2 bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), RoomHandler.RewardLocationStyle.CameraCenter, true);
                    LootEngine.DelayedSpawnItem(1f, (GameObject)BraveResources.Load(path, ".prefab"), bestRewardLocation.ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
                }
            }
        }
Example #17
0
    public void Ability()
    {
        abilityused = true;
        string str;

        if (MOV.job == Job.Engineer)
        {
            if (team == "Enemy")
            {
                str = "T1ts";
                GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

                Exploder e = proj.GetComponent <Exploder>();

                if (e)
                {
                    e.shootername = playername;
                    e.team        = team;
                }
            }

            if (team == "Ally")
            {
                str = "T2ts";
                GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

                Exploder e = proj.GetComponent <Exploder>();

                if (e)
                {
                    e.shootername = playername;
                    e.team        = team;
                }
            }


            Invoke(nameof(Resetability), 60);
        }

        if (MOV.job == Job.Grenadier)
        {
            str = "FRG";

            GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

            Transform pt  = proj.transform;
            Rigidbody prb = proj.GetComponent <Rigidbody>();
            Grenade   g   = proj.GetComponent <Grenade>();
            Exploder  e   = proj.GetComponent <Exploder>();

            if (g)
            {
                e.shootername = playername;
                e.team        = team;
                g.speed       = 200;
            }

            Invoke(nameof(Resetability), 30);
        }

        if (MOV.job == Job.Smoker)
        {
            str = "SMK";

            GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

            Transform pt  = proj.transform;
            Rigidbody prb = proj.GetComponent <Rigidbody>();
            Grenade   g   = proj.GetComponent <Grenade>();
            Exploder  e   = proj.GetComponent <Exploder>();

            if (g)
            {
                e.shootername = playername;
                e.team        = team;
                g.speed       = 200;
            }

            Invoke(nameof(Resetability), 90);
        }

        if (MOV.job == Job.Landminer)
        {
            str = "LDM";

            GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

            Transform pt  = proj.transform;
            Rigidbody prb = proj.GetComponent <Rigidbody>();
            Grenade   g   = proj.GetComponent <Grenade>();
            Exploder  e   = proj.GetComponent <Exploder>();

            if (g)
            {
                e.shootername = playername;
                e.team        = team;


                if (team == "Enemy")
                {
                    g.seekTag = "Team2";
                }

                if (team == "Ally")
                {
                    g.seekTag = "Enemy";
                }
                g.speed = 60;
            }

            Invoke(nameof(Resetability), 45);
        }

        if (MOV.job == Job.Inhibitor)
        {
            str = "INH";

            GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);

            Transform pt  = proj.transform;
            Rigidbody prb = proj.GetComponent <Rigidbody>();
            Grenade   g   = proj.GetComponent <Grenade>();

            if (g)
            {
                g.speed = 30;
            }

            Invoke(nameof(Resetability), 40);
        }

        if (MOV.job == Job.Assault)
        {
            str = "MDK";

            GameObject proj = OP.SpawnFromPool(str, throwspot.position, throwspot.rotation);
            Invoke(nameof(Resetability), 35);
        }
    }
 protected override void DoEffect(PlayerController user)
 {
     if (user.HasPickupID(Gungeon.Game.Items["space_friend"].PickupObjectId))
     {
         goUp = true;
     }
     else
     {
         if (UnityEngine.Random.value > .05)
         {
             goUp = false;
         }
         else
         {
             goUp = true;
         }
     }
     if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CASTLEGEON)
     {
         GameManager.Instance.LoadCustomLevel("tt5");
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.SEWERGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt5");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_castle");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.JUNGLEGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt5");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_castle");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.BELLYGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_mines");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt5");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.GUNGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_mines");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_castle");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATHEDRALGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_mines");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt5");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.MINEGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_catacombs");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt5");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.RATGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_catacombs");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_mines");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.CATACOMBGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_forge");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_mines");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.OFFICEGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_forge");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_catacombs");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.FORGEGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_bullethell");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_catacombs");
         }
     }
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.WESTGEON)
     {
         if (goUp == false)
         {
             GameManager.Instance.LoadCustomLevel("tt_bullethell");
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_catacombs");
         }
     }//Apache's glitch floor
     else if (GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.HELLGEON)
     {
         if (goUp == false)
         {
             Exploder.DoDefaultExplosion(LastOwner.specRigidbody.UnitCenter, new Vector2());
         }
         else
         {
             GameManager.Instance.LoadCustomLevel("tt_forge");
         }
     }
     else
     {
         IntVector2 bestRewardLocation = user.CurrentRoom.GetBestRewardLocation(IntVector2.One * 3, RoomHandler.RewardLocationStyle.PlayerCenter, true);
         Chest      rainbow_Chest      = GameManager.Instance.RewardManager.Rainbow_Chest;
         rainbow_Chest.IsLocked = false;
         Chest.Spawn(rainbow_Chest, bestRewardLocation);
     }
 }
Example #19
0
        private IEnumerator BecomeMimic()
        {
            PlayerController player  = GameManager.Instance.PrimaryPlayer;
            PlayerController player2 = GameManager.Instance.SecondaryPlayer;

            if (!SpawnEnemyMode)
            {
                if (player)
                {
                    if (player.HasPassiveItem(293) && player.HasPassiveItem(CursedBrick.CursedBrickID))
                    {
                        SpawnEnemyMode = true;
                    }
                }
                if (player2)
                {
                    if (player2.HasPassiveItem(293) && player2.HasPassiveItem(CursedBrick.CursedBrickID))
                    {
                        SpawnEnemyMode = true;
                    }
                }
            }

            if (m_hands == null)
            {
                StartCoroutine(DoIntro());
            }

            if (SpawnEnemyMode)
            {
                m_ItemDropOdds += 0.1f;
            }

            m_isHidden = false;
            SpeculativeRigidbody specRigidbody = this.specRigidbody;

            specRigidbody.OnRigidbodyCollision = (SpeculativeRigidbody.OnRigidbodyCollisionDelegate)Delegate.Remove(specRigidbody.OnRigidbodyCollision, new SpeculativeRigidbody.OnRigidbodyCollisionDelegate(HandleRigidbodyCollision));
            SpeculativeRigidbody specRigidbody2 = this.specRigidbody;

            specRigidbody2.OnBeamCollision = (SpeculativeRigidbody.OnBeamCollisionDelegate)Delegate.Remove(specRigidbody2.OnBeamCollision, new SpeculativeRigidbody.OnBeamCollisionDelegate(HandleBeamCollision));
            AIAnimator tongueAnimator = aiAnimator.ChildAnimator;

            tongueAnimator.renderer.enabled       = true;
            tongueAnimator.spriteAnimator.enabled = true;
            AIAnimator spitAnimator = tongueAnimator.ChildAnimator;

            spitAnimator.renderer.enabled       = true;
            spitAnimator.spriteAnimator.enabled = true;
            tongueAnimator.PlayUntilFinished("spawn", false, null, -1f, false);
            float delay        = tongueAnimator.CurrentClipLength;
            float timer        = 0f;
            bool  hasPlayedVFX = false;

            while (timer < delay)
            {
                yield return(null);

                timer += BraveTime.DeltaTime;
                if (!hasPlayedVFX && delay - timer < 0.1f)
                {
                    hasPlayedVFX = true;
                    if (WallDisappearVFX)
                    {
                        Vector2 zero  = Vector2.zero;
                        Vector2 zero2 = Vector2.zero;
                        DungeonData.Direction facingDirection = m_facingDirection;
                        if (facingDirection != DungeonData.Direction.SOUTH)
                        {
                            if (facingDirection != DungeonData.Direction.EAST)
                            {
                                if (facingDirection == DungeonData.Direction.WEST)
                                {
                                    zero  = new Vector2(0f, -1f);
                                    zero2 = new Vector2(0f, 1f);
                                }
                            }
                            else
                            {
                                zero  = new Vector2(0f, -1f);
                                zero2 = new Vector2(0f, 1f);
                            }
                        }
                        else
                        {
                            zero  = new Vector2(0f, -1f);
                            zero2 = new Vector2(0f, 1f);
                        }
                        Vector2 min = Vector2.Min(pos1.ToVector2(), pos2.ToVector2()) + zero;
                        Vector2 max = Vector2.Max(pos1.ToVector2(), pos2.ToVector2()) + new Vector2(1f, 1f) + zero2;
                        for (int i = 0; i < 5; i++)
                        {
                            Vector2        v              = BraveUtility.RandomVector2(min, max, new Vector2(0.25f, 0.25f)) + new Vector2(0f, 1f);
                            GameObject     gameObject     = SpawnManager.SpawnVFX(WallDisappearVFX, v, Quaternion.identity);
                            tk2dBaseSprite tk2dBaseSprite = (!gameObject) ? null : gameObject.GetComponent <tk2dBaseSprite>();
                            if (tk2dBaseSprite)
                            {
                                tk2dBaseSprite.HeightOffGround = 8f;
                                tk2dBaseSprite.UpdateZDepth();
                            }
                        }
                    }
                }
            }
            if (!m_failedWallConfigure && SpawnEnemyMode)
            {
                if (aiActor.ParentRoom != null && SpawnEnemyList != null && SpawnEnemyList.Count > 0 && UnityEngine.Random.value <= m_spawnEnemyOdds)
                {
                    int count2 = this.specRigidbody.PixelColliders.Count;
                    this.specRigidbody.PixelColliders.RemoveAt(count2 - 1);
                    this.specRigidbody.PixelColliders.RemoveAt(count2 - 2);
                    StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform);
                    Destroy(m_fakeWall);
                    Destroy(m_fakeCeiling);

                    Vector3 targetPosForSpawn = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3();
                    while (timer < delay)
                    {
                        aiAnimator.LockFacingDirection = true;
                        aiAnimator.FacingDirection     = DungeonData.GetAngleFromDirection(m_facingDirection);
                        yield return(null);

                        timer += BraveTime.DeltaTime;
                        transform.position = Vector3.Lerp(m_startingPos, targetPosForSpawn, Mathf.InverseLerp(0.42f, 0.58f, timer));
                        this.specRigidbody.Reinitialize();
                    }
                    yield return(null);

                    Vector3 FinalSpawnLocation             = transform.position;
                    Vector3 VFXExplosionLocation           = transform.position;
                    Vector2 VFXExplosionSource             = Vector2.zero;
                    DungeonData.Direction CurrentDirection = m_facingDirection;
                    if (CurrentDirection == DungeonData.Direction.WEST)
                    {
                        FinalSpawnLocation   += new Vector3(2.5f, 3.5f);
                        VFXExplosionLocation += new Vector3(3.5f, 3.5f);
                        VFXExplosionSource    = new Vector2(1, 0);
                    }
                    else if (CurrentDirection == DungeonData.Direction.EAST)
                    {
                        FinalSpawnLocation   += new Vector3(4f, 3.5f);
                        VFXExplosionLocation += new Vector3(3f, 3.5f);
                    }
                    else if (CurrentDirection == DungeonData.Direction.NORTH)
                    {
                        FinalSpawnLocation   += new Vector3(3.5f, 4f);
                        VFXExplosionLocation += new Vector3(3.5f, 3f);
                        VFXExplosionSource    = new Vector2(0, 1);
                    }
                    else if (CurrentDirection == DungeonData.Direction.SOUTH)
                    {
                        FinalSpawnLocation   += new Vector3(3.5f, 1.5f);
                        VFXExplosionLocation += new Vector3(3.5f, 2.5f);
                    }
                    yield return(null);

                    string        SelectedEnemy          = BraveUtility.RandomElement(SpawnEnemyList);
                    ExplosionData wallMimicExplosionData = new ExplosionData();
                    wallMimicExplosionData.CopyFrom(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData);
                    wallMimicExplosionData.damage = 0f;
                    wallMimicExplosionData.force /= 1.6f;

                    if (SelectedEnemy != "RATCORPSE")
                    {
                        Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None);
                        GameObject SpawnVFXObject = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"));

                        if (SpawnVFXObject)
                        {
                            tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>();
                            SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter);
                            SpawnVFXObjectComponent.HeightOffGround = 1f;
                            SpawnVFXObjectComponent.UpdateZDepth();
                        }

                        AIActor glitchActor = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(SelectedEnemy), FinalSpawnLocation, aiActor.ParentRoom, true, AIActor.AwakenAnimationType.Awaken, true);

                        if (glitchActor)
                        {
                            PickupObject.ItemQuality targetGlitchEnemyItemQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B;
                            GenericLootTable         glitchEnemyLootTable         = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable;
                            PickupObject             glitchEnemyItem = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetGlitchEnemyItemQuality, glitchEnemyLootTable, false);

                            // if (BraveUtility.RandomBool()) { ChaosUtility.MakeCompanion(glitchActor); }

                            if (glitchEnemyItem)
                            {
                                glitchActor.AdditionalSafeItemDrops.Add(glitchEnemyItem);
                            }

                            if (m_isGlitched)
                            {
                                float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
                                float RandomDispFloat           = UnityEngine.Random.Range(0.1f, 0.16f);
                                float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.1f, 0.4f);
                                float RandomColorProbFloat      = UnityEngine.Random.Range(0.05f, 0.2f);
                                float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f);

                                targetGlitchEnemyItemQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.B : PickupObject.ItemQuality.C) : PickupObject.ItemQuality.A;
                                glitchEnemyLootTable         = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable;
                                glitchEnemyItem = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetGlitchEnemyItemQuality, glitchEnemyLootTable, false);
                                if (glitchEnemyItem)
                                {
                                    aiActor.AdditionalSafeItemDrops.Add(glitchEnemyItem);
                                }

                                ExpandShaders.Instance.ApplyGlitchShader(glitchActor.sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                            }

                            if (glitchActor.ParentRoom != null && !glitchActor.ParentRoom.IsSealed)
                            {
                                glitchActor.IgnoreForRoomClear = true;
                            }
                        }
                        else
                        {
                            // AIActor is null! Time to bail out of this and continue as normal wall mimic!
                            goto IL_ESCAPE;
                        }
                    }
                    else
                    {
                        Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None);
                        GameObject     SpawnVFXObject          = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"));
                        tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>();
                        SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter);
                        SpawnVFXObjectComponent.HeightOffGround = 1f;
                        SpawnVFXObjectComponent.UpdateZDepth();
                        GameObject   spawnedRatCorpseObject = Instantiate(ExpandPrefabs.RatCorpseNPC, FinalSpawnLocation, Quaternion.identity);
                        TalkDoerLite talkdoerComponent      = spawnedRatCorpseObject.GetComponent <TalkDoerLite>();
                        talkdoerComponent.transform.position.XY().GetAbsoluteRoom().RegisterInteractable(talkdoerComponent);
                        talkdoerComponent.transform.position.XY().GetAbsoluteRoom().TransferInteractableOwnershipToDungeon(talkdoerComponent);
                        talkdoerComponent.playmakerFsm.SetState("Set Mode");
                        ExpandUtility.AddHealthHaver(talkdoerComponent.gameObject, 60, flashesOnDamage: false, exploderSpawnsItem: true);
                    }
                    yield return(null);

                    Destroy(gameObject);
                    yield break;
                }
            }
IL_ESCAPE:
            PickupObject.ItemQuality targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B;
            GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable;
            PickupObject     item      = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false);

            if (item)
            {
                if (CursedBrickMode)
                {
                    if (UnityEngine.Random.value <= m_ItemDropOdds | m_isGlitched)
                    {
                        aiActor.AdditionalSafeItemDrops.Add(item);
                    }
                    else
                    {
                        aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70));
                        if (BraveUtility.RandomBool())
                        {
                            aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70));
                        }
                        if (SpawnEnemyMode)
                        {
                            aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70));
                        }
                    }
                    if (SpawnEnemyMode && UnityEngine.Random.value <= m_FriendlyMimicOdds)
                    {
                        m_isFriendlyMimic = true;
                    }
                    if (m_isGlitched)
                    {
                        float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
                        float RandomDispFloat           = UnityEngine.Random.Range(0.1f, 0.16f);
                        float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.1f, 0.4f);
                        float RandomColorProbFloat      = UnityEngine.Random.Range(0.05f, 0.2f);
                        float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f);

                        targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.B : PickupObject.ItemQuality.C) : PickupObject.ItemQuality.A;
                        lootTable     = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable;
                        item          = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false);
                        if (item)
                        {
                            aiActor.AdditionalSafeItemDrops.Add(item);
                        }

                        ExpandShaders.Instance.ApplyGlitchShader(sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                    }
                }
                else
                {
                    aiActor.AdditionalSafeItemDrops.Add(item);
                }
            }
            if (CursedBrickMode && SpawnEnemyMode && UnityEngine.Random.value <= m_FriendlyMimicOdds)
            {
                m_isFriendlyMimic = true;
            }
            aiActor.enabled            = true;
            behaviorSpeculator.enabled = true;
            if (aiActor.ParentRoom != null && aiActor.ParentRoom.IsSealed && !m_isFriendlyMimic)
            {
                aiActor.IgnoreForRoomClear = false;
            }
            // if (m_isFriendlyMimic) { ExpandUtility.MakeCompanion(aiActor); }
            if (m_isFriendlyMimic)
            {
                aiActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null);
            }
            if (!m_failedWallConfigure)
            {
                int count = this.specRigidbody.PixelColliders.Count;
                for (int j = 0; j < count - 2; j++)
                {
                    this.specRigidbody.PixelColliders[j].Enabled = true;
                }
                this.specRigidbody.PixelColliders.RemoveAt(count - 1);
                this.specRigidbody.PixelColliders.RemoveAt(count - 2);
                StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform);
                Destroy(m_fakeWall);
                Destroy(m_fakeCeiling);
            }
            else
            {
                int count = this.specRigidbody.PixelColliders.Count;
                for (int j = 0; j < count; j++)
                {
                    this.specRigidbody.PixelColliders[j].Enabled = true;
                }
            }
            for (int k = 0; k < m_hands.Length; k++)
            {
                m_hands[k].gameObject.SetActive(true);
            }
            aiActor.ToggleRenderers(true);
            if (aiShooter)
            {
                aiShooter.ToggleGunAndHandRenderers(true, "ExpandWallMimicManager");
            }
            aiActor.IsGone           = false;
            healthHaver.IsVulnerable = true;
            aiActor.State            = AIActor.ActorState.Normal;
            for (int l = 0; l < m_hands.Length; l++)
            {
                m_hands[l].gameObject.SetActive(false);
            }
            m_isFinished = true;
            delay        = 0.58f;
            timer        = 0f;
            Vector3 targetPos = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3();

            while (timer < delay)
            {
                aiAnimator.LockFacingDirection = true;
                aiAnimator.FacingDirection     = DungeonData.GetAngleFromDirection(m_facingDirection);
                yield return(null);

                timer += BraveTime.DeltaTime;
                transform.position = Vector3.Lerp(m_startingPos, targetPos, Mathf.InverseLerp(0.42f, 0.58f, timer));
                this.specRigidbody.Reinitialize();
            }
            aiAnimator.LockFacingDirection = false;
            knockbackDoer.SetImmobile(false, "ExpandWallMimicManager");
            aiActor.CollisionDamage            = 0.5f;
            aiActor.CollisionKnockbackStrength = m_collisionKnockbackStrength;
            yield break;
        }
Example #20
0
 void Start()
 {
     GetComponent<CollisionDetector>().Collided += ShmupChopper_Collided;
     grassExploder = transform.FindChild("GrassExploder").GetComponent<Exploder>();
     explodeParticleSystem = GameObject.Find("Explode Particles").GetComponent<ParticleSystem>();
 }
Example #21
0
        public IEnumerator HandleAttack(AIActor enemyToStartWith, RoomHandler room)
        {
            this.m_isCurrentlyActive = true;
            AIActor         currentEnemy    = enemyToStartWith;
            KillPillarState currentState    = KillPillarState.Falling;
            Vector2         targetPoint     = currentEnemy.sprite.WorldBottomCenter;
            Vector2         velocity        = default(Vector2);
            float           cooldownTime    = 0f;
            float           chaseTime       = 0f;
            Vector2         lastTargetPoint = Vector2.zero;

            while (true)
            {
                if (!this.m_pickedUp || this.LastOwner == null)
                {
                    break;
                }
                if (currentState == KillPillarState.Falling)
                {
                    if (this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter.y > targetPoint.y)
                    {
                        this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter + new Vector2(0, -(30f * BraveTime.DeltaTime)), tk2dBaseSprite.Anchor.LowerCenter);
                    }
                    else
                    {
                        Exploder.DoDefaultExplosion(this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter, new Vector2());
                        Projectile projectile  = ((Gun)ETGMod.Databases.Items[22]).DefaultModule.projectiles[0];
                        Projectile projectile2 = ((Gun)ETGMod.Databases.Items[337]).DefaultModule.projectiles[0];
                        for (int i = 0; i < 16; i++)
                        {
                            GameObject obj3  = SpawnManager.SpawnProjectile(projectile.gameObject, this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldCenter, Quaternion.Euler(0f, 0f, (base.LastOwner.CurrentGun == null) ? 0f : i * 22.5f), true);
                            Projectile proj3 = obj3.GetComponent <Projectile>();
                            if (proj3 != null)
                            {
                                proj3.Owner                   = base.LastOwner;
                                proj3.Shooter                 = base.LastOwner.specRigidbody;
                                proj3.baseData.speed         *= 0.66f;
                                proj3.ImmuneToBlanks          = true;
                                proj3.ImmuneToSustainedBlanks = true;
                            }
                            if (i % 2 == 0)
                            {
                                GameObject obj4  = SpawnManager.SpawnProjectile(projectile2.gameObject, this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldCenter + BraveMathCollege.DegreesToVector(i * 22.5f, 0.5f), Quaternion.Euler(0f, 0f, (base.LastOwner.CurrentGun == null) ? 0f : i * 22.5f), true);
                                Projectile proj4 = obj4.GetComponent <Projectile>();
                                if (proj4 != null)
                                {
                                    proj4.Owner                   = base.LastOwner;
                                    proj4.Shooter                 = base.LastOwner.specRigidbody;
                                    proj4.baseData.speed         *= 0.66f;
                                    proj4.ImmuneToBlanks          = true;
                                    proj4.ImmuneToSustainedBlanks = true;
                                }
                            }
                        }
                        currentState = KillPillarState.CoolingDown;
                        cooldownTime = 1f;
                    }
                }
                else if (currentState == KillPillarState.CoolingDown)
                {
                    if (cooldownTime > 0)
                    {
                        cooldownTime -= BraveTime.DeltaTime;
                    }
                    else
                    {
                        if (room.HasActiveEnemies(RoomHandler.ActiveEnemyType.All))
                        {
                            currentState = KillPillarState.Chasing;
                            this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().SetSprite(spriteIds[0]);
                            chaseTime = 2f;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else if (currentState == KillPillarState.Chasing)
                {
                    if (room.HasActiveEnemies(RoomHandler.ActiveEnemyType.All))
                    {
                        if (currentEnemy == null || currentEnemy.sprite == null || (currentEnemy.healthHaver != null && currentEnemy.healthHaver.IsDead))
                        {
                            currentEnemy = room.GetRandomActiveEnemy(true);
                        }
                        Vector2 a = (currentEnemy.sprite.WorldTopCenter + new Vector2(0, 1) - this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter);
                        a.Normalize();
                        bool flag5 = Vector2.Distance((currentEnemy.sprite.WorldTopCenter + new Vector2(0, 1)), base.sprite.WorldBottomCenter) < 0.2f;
                        if (flag5)
                        {
                            velocity = Vector2.Lerp(velocity, Vector2.zero, 0.5f);
                        }
                        else
                        {
                            velocity = Vector2.Lerp(velocity, a * 10, 0.1f);
                        }
                        this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter + (BraveTime.DeltaTime * velocity), tk2dBaseSprite.Anchor.LowerCenter);
                        lastTargetPoint = (this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter + new Vector2(0, -1f - currentEnemy.sprite.GetRelativePositionFromAnchor(tk2dBaseSprite.Anchor.UpperCenter).y));
                        if (chaseTime > 0)
                        {
                            chaseTime -= BraveTime.DeltaTime;
                        }
                        else
                        {
                            targetPoint = (this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter + new Vector2(0, -1f - currentEnemy.sprite.GetRelativePositionFromAnchor(tk2dBaseSprite.Anchor.UpperCenter).y));
                            this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().SetSprite(spriteIds[1]);
                            currentState = KillPillarState.Falling;
                        }
                    }
                    else
                    {
                        targetPoint = lastTargetPoint;
                        this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().SetSprite(spriteIds[1]);
                        currentState = KillPillarState.Falling;
                    }
                }
                yield return(null);
            }
            this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().SetSprite(spriteIds[0]);
            float ela = 0f;

            while (ela < 2f)
            {
                this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(this.m_extantKillPillar.GetComponent <tk2dBaseSprite>().WorldBottomCenter + new Vector2(0, (30f * BraveTime.DeltaTime)), tk2dBaseSprite.Anchor.LowerCenter);
                ela += BraveTime.DeltaTime;
                yield return(null);
            }
            Destroy(this.m_extantKillPillar);
            this.m_isCurrentlyActive = false;
            yield break;
        }