Ejemplo n.º 1
0
        private void PostProcessProjectile(Projectile SourceProjectile, float chance)
        {
            int doubles = rng.Next(1, 4);

            if (doubles == 1)
            {
                SourceProjectile.AdditionalScaleMultiplier = 1;
                ProjectileSplitController split = SourceProjectile.gameObject.GetOrAddComponent <ProjectileSplitController>();
                split.distanceBasedSplit = true;
                split.distanceTillSplit  = 2.5f;
                split.numberofsplits     = 2;
                split.dmgMultAfterSplit  = .9f;
                split.amtToSplitTo       = 1;
                split.sizeMultAfterSplit = SourceProjectile.AdditionalScaleMultiplier * 1.02f;
                split.splitAngles        = 55f;
                split.splitOnEnemy       = false;

                split.removeComponentAfterUse = false;
            }
        }
Ejemplo n.º 2
0
        // Token: 0x0600086E RID: 2158 RVA: 0x000676D4 File Offset: 0x000658D4
        private void SplitProjectile()
        {
            PlayerController player = this.parentOwner;
            float            num    = this.splitAngles / ((float)this.amtToSplitTo);
            float            num2   = this.parentProjectile.Direction.ToAngle();
            float            num3   = num2 + this.splitAngles * 0.5f;
            int num4 = 0;

            if (parentOwner.CurrentGun.Volley.projectiles.Count > 10)
            {
                // too many projectiles ajkla;sdlf;lfjksladlf
                ProjectileSplitController component2 = parentProjectile.gameObject.GetComponent <ProjectileSplitController>();
                UnityEngine.Object.Destroy(component2);
            }
            else
            {
                for (int i = 0; i < this.amtToSplitTo; i++)
                {
                    float      num5       = num3 - num * (float)num4;
                    GameObject prefab     = FakePrefab.Clone(this.parentProjectile.gameObject);
                    GameObject gameObject = SpawnManager.SpawnProjectile(prefab, this.parentProjectile.sprite.WorldCenter, Quaternion.Euler(0f, 0f, num5), true);
                    Projectile component  = gameObject.GetComponent <Projectile>();
                    bool       flag       = component != null;
                    if (flag)
                    {
                        component.Owner            = this.parentOwner;
                        component.Shooter          = this.parentOwner.specRigidbody;
                        component.baseData.damage *= this.dmgMultAfterSplit;
                        component.RuntimeUpdateScale(this.sizeMultAfterSplit);
                        ProjectileSplitController component2 = component.gameObject.GetComponent <ProjectileSplitController>();
                        bool flag2 = component2 && this.removeComponentAfterUse;
                        if (flag2)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                        if (parentProjectile.AdditionalScaleMultiplier >= 1.04f)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                    }
                    num4++;
                }
                float mirrorAngle = splitAngles * -1;
                float number      = mirrorAngle / ((float)this.amtToSplitTo);
                float number2     = this.parentProjectile.Direction.ToAngle();
                float number3     = number2 + mirrorAngle * 0.5f;
                int   number4     = 0;
                for (int i = 0; i < this.amtToSplitTo; i++)
                {
                    float      number5    = number3 - number * (float)number4;
                    GameObject prefab     = FakePrefab.Clone(this.parentProjectile.gameObject);
                    GameObject gameObject = SpawnManager.SpawnProjectile(prefab, this.parentProjectile.sprite.WorldCenter, Quaternion.Euler(0f, 0f, number5), true);
                    Projectile component  = gameObject.GetComponent <Projectile>();
                    bool       flag       = component != null;
                    if (flag)
                    {
                        component.Owner   = this.parentOwner;
                        component.Shooter = this.parentOwner.specRigidbody;
                        if (this.parentProjectile.baseData.damage < this.parentProjectile.GetCachedBaseDamage * .4)
                        {
                        }
                        else
                        {
                            component.baseData.damage *= this.dmgMultAfterSplit;
                        }

                        component.RuntimeUpdateScale(this.sizeMultAfterSplit);
                        ProjectileSplitController component2 = component.gameObject.GetComponent <ProjectileSplitController>();

                        bool flag2 = component2 && this.removeComponentAfterUse;
                        if (flag2)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                        if (parentProjectile.AdditionalScaleMultiplier >= 1.04f)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                    }
                    number4++;
                }


                UnityEngine.Object.Destroy(this.parentProjectile.gameObject);
            }
        }