Пример #1
0
            public void FixedUpdate()
            {
                if (!NetworkServer.active)
                {
                    return;
                }
                interval -= Time.fixedDeltaTime;
                if (interval <= 0f && ammo > 0)
                {
                    interval = intervalMax;
                    ammo--;

                    var characterBody = equipmentSlot.characterBody;
                    if (characterBody)
                    {
                        if (!characterBody.characterMotor || !characterBody.characterMotor.isGrounded)
                        {
                            var height = boostDistance.Value;
                            var mass   = characterBody.characterMotor ? characterBody.characterMotor.mass : (characterBody.rigidbody ? characterBody.rigidbody.mass : 1f);
                            var ySpeed = Trajectory.CalculateInitialYSpeedForHeight(height, -characterBody.acceleration);

                            var force = -ySpeed *mass *equipmentSlot.GetAimRay().direction;

                            if (characterBody.characterMotor)
                            {
                                characterBody.characterMotor.ApplyForce(force, false, false);
                            }
                            else if (characterBody.rigidbody)
                            {
                                characterBody.rigidbody.AddForce(force, ForceMode.Impulse);
                            }
                        }
                    }

                    Vector3 position = transform.position;
                    for (int i = 0; i < shotsPerCast; i++)
                    {
                        ProjectileManager.instance.FireProjectile(waveProjectilesScaled[i], position + (10f * (float)i) * aimRay.direction.normalized, Util.QuaternionSafeLookRotation(aimRay.direction), equipmentSlot.gameObject, 0f, 0f, false, DamageColorIndex.Default, null, -1f);
                    }
                    PointSoundManager.EmitSoundServer(sound.index, position);
                }
            }
Пример #2
0
        // Token: 0x06002B85 RID: 11141 RVA: 0x000B79E4 File Offset: 0x000B5BE4
        private void RootPulse()
        {
            Vector3 position = base.transform.position;

            foreach (HurtBox hurtBox in new SphereSearch
            {
                origin = position,
                radius = TreebotFlower2Projectile.radius,
                mask = LayerIndex.entityPrecise.mask
            }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.AllExcept(this.teamIndex)).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes())
            {
                CharacterBody body = hurtBox.healthComponent.body;
                if (!this.rootedBodies.Contains(body))
                {
                    this.rootedBodies.Add(body);
                    body.AddBuff(BuffIndex.Entangle);
                    body.RecalculateStats();
                    Vector3   a         = hurtBox.transform.position - position;
                    float     magnitude = a.magnitude;
                    Vector3   a2        = a / magnitude;
                    Rigidbody component = hurtBox.healthComponent.GetComponent <Rigidbody>();
                    float     num       = component ? component.mass : 1f;
                    float     num2      = magnitude - TreebotFlower2Projectile.yankIdealDistance;
                    float     num3      = TreebotFlower2Projectile.yankSuitabilityCurve.Evaluate(num);
                    Vector3   vector    = component ? component.velocity : Vector3.zero;
                    if (HGMath.IsVectorNaN(vector))
                    {
                        vector = Vector3.zero;
                    }
                    Vector3 a3 = -vector;
                    if (num2 > 0f)
                    {
                        a3 = a2 * -Trajectory.CalculateInitialYSpeedForHeight(num2, -body.acceleration);
                    }
                    Vector3    force      = a3 * (num * num3);
                    DamageInfo damageInfo = new DamageInfo
                    {
                        attacker         = this.owner,
                        inflictor        = base.gameObject,
                        crit             = this.crit,
                        damage           = this.damage,
                        damageColorIndex = DamageColorIndex.Default,
                        damageType       = this.damageType,
                        force            = force,
                        position         = hurtBox.transform.position,
                        procChainMask    = this.procChainMask,
                        procCoefficient  = this.procCoefficient
                    };
                    hurtBox.healthComponent.TakeDamage(damageInfo);
                    HurtBox      hurtBoxReference = hurtBox;
                    HurtBoxGroup hurtBoxGroup     = hurtBox.hurtBoxGroup;
                    int          num4             = 0;
                    while ((float)num4 < Mathf.Min(4f, body.radius * 2f))
                    {
                        EffectData effectData = new EffectData
                        {
                            scale        = 1f,
                            origin       = position,
                            genericFloat = Mathf.Max(0.2f, TreebotFlower2Projectile.duration - base.fixedAge)
                        };
                        effectData.SetHurtBoxReference(hurtBoxReference);
                        EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/OrbEffects/EntangleOrbEffect"), effectData, true);
                        hurtBoxReference = hurtBoxGroup.hurtBoxes[UnityEngine.Random.Range(0, hurtBoxGroup.hurtBoxes.Length)];
                        num4++;
                    }
                }
            }
        }
Пример #3
0
        // Token: 0x06002B69 RID: 11113 RVA: 0x000B6F38 File Offset: 0x000B5138
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration = this.baseDuration / this.attackSpeedStat;
            base.PlayAnimation("Gesture, Additive", "FireSonicBoom");
            Util.PlaySound(this.sound, base.gameObject);
            Ray aimRay = base.GetAimRay();

            if (!string.IsNullOrEmpty(this.muzzle))
            {
                EffectManager.SimpleMuzzleFlash(this.fireEffectPrefab, base.gameObject, this.muzzle, false);
            }
            else
            {
                EffectManager.SpawnEffect(this.fireEffectPrefab, new EffectData
                {
                    origin   = aimRay.origin,
                    rotation = Quaternion.LookRotation(aimRay.direction)
                }, false);
            }
            aimRay.origin -= aimRay.direction * this.backupDistance;
            if (NetworkServer.active)
            {
                BullseyeSearch bullseyeSearch = new BullseyeSearch();
                bullseyeSearch.teamMaskFilter    = TeamMask.AllExcept(base.GetTeam());
                bullseyeSearch.maxAngleFilter    = this.fieldOfView * 0.5f;
                bullseyeSearch.maxDistanceFilter = this.maxDistance;
                bullseyeSearch.searchOrigin      = aimRay.origin;
                bullseyeSearch.searchDirection   = aimRay.direction;
                bullseyeSearch.sortMode          = BullseyeSearch.SortMode.Distance;
                bullseyeSearch.filterByLoS       = false;
                bullseyeSearch.RefreshCandidates();
                foreach (HurtBox hurtBox in bullseyeSearch.GetResults().Where(new Func <HurtBox, bool>(Util.IsValid)).Distinct(default(HurtBox.EntityEqualityComparer)))
                {
                    Vector3       vector     = hurtBox.transform.position - aimRay.origin;
                    float         magnitude  = vector.magnitude;
                    float         magnitude2 = new Vector2(vector.x, vector.z).magnitude;
                    Vector3       vector2    = vector / magnitude;
                    float         num        = 1f;
                    CharacterBody body       = hurtBox.healthComponent.body;
                    if (body.characterMotor)
                    {
                        num = body.characterMotor.mass;
                    }
                    else if (hurtBox.healthComponent.GetComponent <Rigidbody>())
                    {
                        num = base.rigidbody.mass;
                    }
                    float num2 = FireSonicBoom.shoveSuitabilityCurve.Evaluate(num);
                    this.AddDebuff(body);
                    body.RecalculateStats();
                    float   acceleration = body.acceleration;
                    Vector3 a            = vector2;
                    float   d            = Trajectory.CalculateInitialYSpeedForHeight(Mathf.Abs(this.idealDistanceToPlaceTargets - magnitude), -acceleration) * Mathf.Sign(this.idealDistanceToPlaceTargets - magnitude);
                    a  *= d;
                    a.y = this.liftVelocity;
                    hurtBox.healthComponent.TakeDamageForce(a * (num * num2), true, true);
                    hurtBox.healthComponent.TakeDamage(new DamageInfo
                    {
                        attacker        = base.gameObject,
                        damage          = this.CalculateDamage(),
                        position        = hurtBox.transform.position,
                        procCoefficient = this.CalculateProcCoefficient()
                    });
                }
            }
            if (base.isAuthority && base.characterBody && base.characterBody.characterMotor)
            {
                float height        = base.characterBody.characterMotor.isGrounded ? this.groundKnockbackDistance : this.airKnockbackDistance;
                float num3          = base.characterBody.characterMotor ? base.characterBody.characterMotor.mass : 1f;
                float acceleration2 = base.characterBody.acceleration;
                float num4          = Trajectory.CalculateInitialYSpeedForHeight(height, -acceleration2);
                base.characterBody.characterMotor.ApplyForce(-num4 * num3 * aimRay.direction, false, false);
            }
        }