void SceneLoader_OnSceneLoaded(On.SceneLoader.orig_OnSceneLoaded orig, UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode loadSceneMode)
        {
            orig(scene, loadSceneMode);

            if (scene.name.Equals(ELevel.Level_06_A_BambooCreek.ToString() + "_Build"))
            {
                try {
                    spawner = UnityEngine.Object.Instantiate(Resources.FindObjectsOfTypeAll <TurtleManRangedSpawner>()[0]);
                    Vector3 newPos = new Vector3(475f, -90.5f);
                    spawner.transform.position = newPos;
                    Manager <Level> .Instance.LevelRooms["460492-92-76"].roomObjects.Add(spawner.gameObject);

                    SpawnZone zone = UnityEngine.Object.Instantiate(Resources.FindObjectsOfTypeAll <SkeloutSpawner>()[0].transform.parent.parent.gameObject).GetComponent <SpawnZone>();
                    zone.transform.position = newPos;
                    Manager <Level> .Instance.LevelRooms["460492-92-76"].roomObjects.Add(zone.spawners[0].gameObject);
                    zone.spawnZoneRect     = new Rect(new Vector2(460, -92), new Vector2(32, 16));
                    zone.spawnLaneCount    = 3;
                    zone.spawnInterval     = .5f;
                    zone.maxSpawnedObjects = 30;

                    CourierLogger.Log("HarderBosses", "All bamboo creek spawners placed");
                } catch (Exception e) {
                    Console.WriteLine("Exception while placing bamboo creek spawners");
                    CourierLogger.LogDetailed(e, "HarderBosses");
                }
            }
        }
Beispiel #2
0
        IEnumerator NecromancerCastArrowsState_CastArrows(On.NecromancerCastArrowsState.orig_CastArrows orig, NecromancerCastArrowsState self)
        {
            DynData <NecromancerCastArrowsState> selfData = new DynData <NecromancerCastArrowsState>(self);
            NecromancerBoss boss = selfData.Get <NecromancerBoss>("boss");

            try {
                SkeloutonSpawner spawner = Resources.FindObjectsOfTypeAll <SkeloutonSpawner>()[0];
                for (int i = 0; i < 5; i++)
                {
                    Vector3 spawnPos = Vector3.Lerp(boss.castingPosLeft.position, boss.castingPosRight.position, 0.25f * i);
                    if (Vector3.Distance(spawnPos, Manager <PlayerManager> .Instance.Player.transform.position) > 5)
                    {
                        spawner.Spawn(spawnPos);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Exception while spawning skeloutons");
                CourierLogger.LogDetailed(e, "HarderBosses");
            }
            for (int wavesDone = 0; wavesDone < self.waveCount; wavesDone++)
            {
                List <Transform> arrowPattern = (List <Transform>)CastArrowsStateGetRandomArrowPatternInfo.Invoke(self, new object[] { wavesDone });
                int numProjectiles            = arrowPattern.Count;

                while (arrowPattern.Count > 0)
                {
                    try {
                        GameObject projectile = Manager <PoolManager> .Instance.GetObjectInstance(boss.arrowProjectilePrefab);

                        projectile.transform.position = arrowPattern[0].position;
                        projectile.GetComponent <PoisonArrow>().SetNecromancerRef(boss);
                        projectile.GetComponent <PoisonArrow>().OverrideDir(Vector2.down);
                        PoisonArrow           arrow     = projectile.GetComponent <PoisonArrow>();
                        DynData <PoisonArrow> arrowData = new DynData <PoisonArrow>(arrow);
                        arrow.GetComponent <SpriteRenderer>().color = Color.cyan;
                        arrow.damageTypeImmunity = (EDamageType)255;
                        arrowData.Set("bounceAtWall", false);
                        arrowPattern.RemoveAt(0);
                    } catch (Exception e) {
                        CourierLogger.LogDetailed(e, "HarderBosses");
                    }
                    yield return(new WaitForSeconds(self.projectileCD));
                }

                yield return(new WaitForSeconds(self.waveCD / 2f));
            }
            boss.GotoNextAttackState();
        }
Beispiel #3
0
        void PoisonArrow_Update(On.PoisonArrow.orig_Update orig, PoisonArrow self)
        {
            DynData <PoisonArrow> selfData = new DynData <PoisonArrow>(self);

            if (selfData.Get <bool>("movementStarted"))
            {
                int          layerMask    = LayerMaskConstants.GROUND_8_AND_16 | LayerMaskConstants.HITTABLE | LayerMaskConstants.MOVING_COLLISION_8_AND_16;
                RaycastHit2D raycastHit2D = Manager <DimensionManager> .Instance.MultiDimensionRaycast(self.transform.position + new Vector3(selfData.Get <Vector2>("dir").x, selfData.Get <Vector2>("dir").y) * 1.25f, selfData.Get <Vector2>("dir"), selfData.Get <float>("speed") *TimeVars.GetDeltaTime(), layerMask, false, false, true);

                if (raycastHit2D.transform != null && (raycastHit2D.transform.gameObject.layer != LayerConstants.HITTABLE || raycastHit2D.transform.gameObject.tag == "SkullMount"))
                {
                    try {
                        if (selfData.Get <bool>("bounceAtWall"))
                        {
                            self.OverrideDir(new Vector2(selfData.Get <NecromancerBoss>("necromancerRef").transform.localScale.x, 0f));
                            selfData.Set("bounceAtWall", false);
                        }
                    } catch (Exception e) {
                        CourierLogger.LogDetailed(e);
                    }
                }
            }
            orig(self);
        }