private void FindNearby()
        {
            Vector3 vector           = gameObject.transform.position;
            float   diameterDistance = 9 * 9;

            List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>();
            List <ProjectileController> list          = new List <ProjectileController>();

            int num3  = 0;
            int count = instancesList.Count;

            while (num3 < count)
            {
                ProjectileController enemyProjectileController = instancesList[num3];
                if (enemyProjectileController.owner == projectileController.owner && (projectileController.transform.position - vector).sqrMagnitude < diameterDistance &&
                    projectileController.gameObject.GetComponent <PoisonSplatController>())
                {
                    list.Add(projectileController);
                }
                num3++;
            }

            bool result = count > 0;

            int i      = 0;
            int count2 = list.Count;

            while (i < count2)
            {
                ProjectileController projectileController2 = list[i];
                if (projectileController2)
                {
                    PoisonSplatController poisonSplatController = projectileController2.GetComponent <PoisonSplatController>();
                    if (poisonSplatController)
                    {
                        poisonSplatController.AddStack();
                    }
                }
                i++;
            }

            if (result)
            {
                Destroy(gameObject);
            }
        }
Example #2
0
        private static void SetupProjectiles()
        {
            SetupAcidPool();
            SetupAcidPoolDrop();
            void SetupAcidPool()
            {
                acidPool = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/projectiles/CrocoLeapAcid"), "CrocoSpeedAcid");
                acidPool.transform.localScale *= acidPoolScale;
                var buffWard = acidPool.AddComponent <BuffWard>();

                buffWard.buffDef         = RoR2Content.Buffs.CloakSpeed;
                buffWard.buffDuration    = CausticSludgeBuffDuration;
                buffWard.expires         = false;
                buffWard.floorWard       = true;
                buffWard.radius          = CausticSludgeActualScale;
                buffWard.requireGrounded = true;
                buffWard.interval       *= 0.5f;

                var enemyBuffWard = acidPool.AddComponent <BuffWard>();

                enemyBuffWard.buffDef          = RoR2Content.Buffs.Slow60;
                enemyBuffWard.buffDuration     = CausticSludgeBuffDuration;
                enemyBuffWard.expires          = false;
                enemyBuffWard.floorWard        = true;
                enemyBuffWard.radius           = CausticSludgeActualScale;
                enemyBuffWard.requireGrounded  = true;
                enemyBuffWard.invertTeamFilter = true;

                ProjectileDotZone projectileDotZone = acidPool.GetComponent <ProjectileDotZone>();

                projectileDotZone.damageCoefficient      = CausticSludgeDamageCoefficient;
                projectileDotZone.lifetime               = CausticSludgeLifetime;
                projectileDotZone.overlapProcCoefficient = 0f;

                PoisonSplatController poisonSplatController = acidPool.AddComponent <PoisonSplatController>();

                poisonSplatController.destroyOnTimer       = acidPool.GetComponent <DestroyOnTimer>();
                poisonSplatController.projectileDotZone    = projectileDotZone;
                poisonSplatController.projectileController = acidPool.GetComponent <ProjectileController>();

                ProjectileAPI.Add(acidPool);

                LeapDropAcid.groundedAcid = acidPool;
            }

            void SetupAcidPoolDrop()
            {
                Debug.Log("Setting up AcidPoolDrop");
                acidPoolDrop = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/projectiles/SporeGrenadeProjectile"), "CrocoSpeedAcidDrop");

                acidPoolDrop.GetComponent <ProjectileSimple>().desiredForwardSpeed = 0;

                var atos = acidPoolDrop.AddComponent <ApplyTorqueOnStart>();

                atos.localTorque = Vector3.down * 3f;
                atos.randomize   = false;

                var projectileImpactExplosion = acidPoolDrop.GetComponent <ProjectileImpactExplosion>();

                projectileImpactExplosion.blastDamageCoefficient   = 0f;
                projectileImpactExplosion.childrenProjectilePrefab = acidPool;
                projectileImpactExplosion.impactEffect             = null;
                projectileImpactExplosion.destroyOnEnemy           = false;

                acidPoolDrop.AddComponent <PoisonFallController>();

                ProjectileAPI.Add(acidPoolDrop);
            }

            LeapDropAcid.projectilePrefab = acidPoolDrop;
        }