// Token: 0x060003FF RID: 1023 RVA: 0x00010694 File Offset: 0x0000E894
        public override void OnEnter()
        {
            base.OnEnter();
            Ray    aimRay = base.GetAimRay();
            string text   = "MuzzleLeft";
            string text2  = "MuzzleRight";

            this.duration = FireCannons.baseDuration / this.attackSpeedStat;
            if (FireCannons.effectPrefab)
            {
                EffectManager.instance.SimpleMuzzleFlash(FireCannons.effectPrefab, base.gameObject, text, false);
                EffectManager.instance.SimpleMuzzleFlash(FireCannons.effectPrefab, base.gameObject, text2, false);
            }
            base.PlayAnimation("Gesture", "FireCannons", "FireCannons.playbackRate", this.duration);
            if (base.isAuthority && base.modelLocator && base.modelLocator.modelTransform)
            {
                ChildLocator component = base.modelLocator.modelTransform.GetComponent <ChildLocator>();
                if (component)
                {
                    int       childIndex  = component.FindChildIndex(text);
                    int       childIndex2 = component.FindChildIndex(text2);
                    Transform transform   = component.FindChild(childIndex);
                    Transform transform2  = component.FindChild(childIndex2);
                    if (transform)
                    {
                        ProjectileManager.instance.FireProjectile(FireCannons.projectilePrefab, transform.position, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, this.damageStat * FireCannons.damageCoefficient, FireCannons.force, Util.CheckRoll(this.critStat, base.characterBody.master), DamageColorIndex.Default, null, -1f);
                    }
                    if (transform)
                    {
                        ProjectileManager.instance.FireProjectile(FireCannons.projectilePrefab, transform2.position, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, this.damageStat * FireCannons.damageCoefficient, FireCannons.force, Util.CheckRoll(this.critStat, base.characterBody.master), DamageColorIndex.Default, null, -1f);
                    }
                }
            }
        }
        // Token: 0x06000EBE RID: 3774 RVA: 0x000489C0 File Offset: 0x00046BC0
        public void SimpleMuzzleFlash(GameObject effectPrefab, GameObject obj, string muzzleName, bool transmit)
        {
            if (!obj)
            {
                return;
            }
            ModelLocator component = obj.GetComponent <ModelLocator>();

            if (component && component.modelTransform)
            {
                ChildLocator component2 = component.modelTransform.GetComponent <ChildLocator>();
                if (component2)
                {
                    int       childIndex = component2.FindChildIndex(muzzleName);
                    Transform transform  = component2.FindChild(childIndex);
                    if (transform)
                    {
                        EffectData effectData = new EffectData
                        {
                            origin = transform.position
                        };
                        effectData.SetChildLocatorTransformReference(obj, childIndex);
                        EffectManager.instance.SpawnEffect(effectPrefab, effectData, transmit);
                    }
                }
            }
        }
Beispiel #3
0
        // Token: 0x0600042E RID: 1070 RVA: 0x000111E4 File Offset: 0x0000F3E4
        public void Fire()
        {
            Vector3[] array = new Vector3[this.bulletCount];
            Vector3   up    = Vector3.up;
            Vector3   axis  = Vector3.Cross(up, this.aimVector);
            int       num   = 0;

            while ((long)num < (long)((ulong)this.bulletCount))
            {
                float   x      = UnityEngine.Random.Range(this.minSpread, this.maxSpread);
                float   z      = UnityEngine.Random.Range(0f, 360f);
                Vector3 vector = Quaternion.Euler(0f, 0f, z) * (Quaternion.Euler(x, 0f, 0f) * Vector3.forward);
                float   y      = vector.y;
                vector.y = 0f;
                float angle  = (Mathf.Atan2(vector.z, vector.x) * 57.29578f - 90f) * this.spreadYawScale;
                float angle2 = Mathf.Atan2(y, vector.magnitude) * 57.29578f * this.spreadPitchScale;
                array[num] = Quaternion.AngleAxis(angle, up) * (Quaternion.AngleAxis(angle2, axis) * this.aimVector);
                num++;
            }
            int     muzzleIndex = -1;
            Vector3 vector2     = this.origin;

            if (!this.weapon)
            {
                this.weapon = this.owner;
            }
            if (this.weapon)
            {
                ModelLocator component = this.weapon.GetComponent <ModelLocator>();
                if (component && component.modelTransform)
                {
                    ChildLocator component2 = component.modelTransform.GetComponent <ChildLocator>();
                    if (component2)
                    {
                        muzzleIndex = component2.FindChildIndex(this.muzzleName);
                    }
                }
            }
            int num2 = 0;

            while ((long)num2 < (long)((ulong)this.bulletCount))
            {
                this.FireSingle(array[num2], muzzleIndex);
                num2++;
            }
        }
            // Token: 0x06000EE2 RID: 3810 RVA: 0x000420DC File Offset: 0x000402DC
            public ParentIdentifier(Transform parent)
            {
                this.parentNetworkInstanceId          = NetworkInstanceId.Invalid;
                this.indexInParentChildLocatorPlusOne = 0;
                if (!parent)
                {
                    return;
                }
                NetworkIdentity componentInParent = parent.GetComponentInParent <NetworkIdentity>();

                if (!componentInParent)
                {
                    Debug.LogWarningFormat("NetworkParent cannot accept a non-null parent without a NetworkIdentity! parent={0}", new object[]
                    {
                        parent
                    });
                    return;
                }
                this.parentNetworkInstanceId = componentInParent.netId;
                if (componentInParent.gameObject == parent.gameObject)
                {
                    return;
                }
                ChildLocator childLocator = NetworkParent.ParentIdentifier.LookUpChildLocator(componentInParent.transform);

                if (!childLocator)
                {
                    Debug.LogWarningFormat("NetworkParent can only be parented directly to another object with a NetworkIdentity or an object registered in the ChildLocator of a a model of an object with a NetworkIdentity. parent={0}", new object[]
                    {
                        parent
                    });
                    return;
                }
                this.indexInParentChildLocator = childLocator.FindChildIndex(parent);
                if (this.indexInParentChildLocatorPlusOne == 0)
                {
                    Debug.LogWarningFormat("NetowrkParent parent={0} is not registered in a ChildLocator.", new object[]
                    {
                        parent
                    });
                    return;
                }
            }
        // Token: 0x06003060 RID: 12384 RVA: 0x000D0520 File Offset: 0x000CE720
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration                 = FireLaser.baseDuration / this.attackSpeedStat;
            this.modifiedAimRay           = base.GetAimRay();
            this.modifiedAimRay.direction = this.laserDirection;
            base.GetModelAnimator();
            Transform modelTransform = base.GetModelTransform();

            Util.PlaySound(FireLaser.attackSoundString, base.gameObject);
            string text = "MuzzleLaser";

            if (base.characterBody)
            {
                base.characterBody.SetAimTimer(2f);
            }
            base.PlayAnimation("Gesture", "FireLaser", "FireLaser.playbackRate", this.duration);
            if (FireLaser.effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(FireLaser.effectPrefab, base.gameObject, text, false);
            }
            if (base.isAuthority)
            {
                float      num    = 1000f;
                Vector3    vector = this.modifiedAimRay.origin + this.modifiedAimRay.direction * num;
                RaycastHit raycastHit;
                if (Physics.Raycast(this.modifiedAimRay, out raycastHit, num, LayerIndex.world.mask | LayerIndex.defaultLayer.mask | LayerIndex.entityPrecise.mask))
                {
                    vector = raycastHit.point;
                }
                new BlastAttack
                {
                    attacker     = base.gameObject,
                    inflictor    = base.gameObject,
                    teamIndex    = TeamComponent.GetObjectTeam(base.gameObject),
                    baseDamage   = this.damageStat * FireLaser.damageCoefficient,
                    baseForce    = FireLaser.force * 0.2f,
                    position     = vector,
                    radius       = FireLaser.blastRadius,
                    falloffModel = BlastAttack.FalloffModel.SweetSpot,
                    bonusForce   = FireLaser.force * this.modifiedAimRay.direction
                }.Fire();
                Vector3 origin = this.modifiedAimRay.origin;
                if (modelTransform)
                {
                    ChildLocator component = modelTransform.GetComponent <ChildLocator>();
                    if (component)
                    {
                        int childIndex = component.FindChildIndex(text);
                        if (FireLaser.tracerEffectPrefab)
                        {
                            EffectData effectData = new EffectData
                            {
                                origin = vector,
                                start  = this.modifiedAimRay.origin
                            };
                            effectData.SetChildLocatorTransformReference(base.gameObject, childIndex);
                            EffectManager.SpawnEffect(FireLaser.tracerEffectPrefab, effectData, true);
                            EffectManager.SpawnEffect(FireLaser.hitEffectPrefab, effectData, true);
                        }
                    }
                }
            }
        }
Beispiel #6
0
        public override void OnEnter()
        {
            attackString       = FireEmbers.attackString;
            minSpread          = FireEmbers.minSpread;
            maxSpread          = FireEmbers.maxSpread;
            bulletCount        = FireEmbers.bulletCount;
            tracerEffectPrefab = FireEmbers.tracerEffectPrefab;
            hitEffectPrefab    = FireEmbers.hitEffectPrefab;
            effectPrefab       = FireEmbers.effectPrefab;
            damageCoefficient  = FireEmbers.damageCoefficient;

            base.OnEnter();
            Ray    aimRay = GetAimRay();
            string text1  = "MuzzleLeft";
            string text2  = "MuzzleRight";

            duration = baseDuration / attackSpeedStat;
            Util.PlayAttackSpeedSound(attackString, base.gameObject, attackSpeedStat);
            StartAimMode(aimRay);
            if ((bool)effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, text1, transmit: false);
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, text2, transmit: false);
            }
            PlayAnimation("Gesture", "FireCannons", "FireCannons.playbackRate", duration);
            if (!base.isAuthority || !base.modelLocator || !base.modelLocator.modelTransform)
            {
                return;
            }
            ChildLocator component = base.modelLocator.modelTransform.GetComponent <ChildLocator>();

            if ((bool)component)
            {
                int       childIndex  = component.FindChildIndex(text1);
                int       childIndex2 = component.FindChildIndex(text2);
                Transform transform   = component.FindChild(childIndex);
                Transform transform2  = component.FindChild(childIndex2);
                if ((bool)transform)
                {
                    BulletAttack bulletAttack = new BulletAttack();
                    bulletAttack.owner              = base.gameObject;
                    bulletAttack.weapon             = base.gameObject;
                    bulletAttack.origin             = aimRay.origin;
                    bulletAttack.aimVector          = aimRay.direction;
                    bulletAttack.minSpread          = minSpread;
                    bulletAttack.maxSpread          = maxSpread;
                    bulletAttack.bulletCount        = (uint)((bulletCount > 0) ? bulletCount : 0);
                    bulletAttack.damage             = damageCoefficient * damageStat;
                    bulletAttack.force              = force;
                    bulletAttack.tracerEffectPrefab = tracerEffectPrefab;
                    bulletAttack.muzzleName         = text1;
                    bulletAttack.hitEffectPrefab    = hitEffectPrefab;
                    bulletAttack.isCrit             = Util.CheckRoll(critStat, base.characterBody.master);
                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                    bulletAttack.HitEffectNormal    = false;
                    bulletAttack.radius             = 0.5f;
                    bulletAttack.procCoefficient    = 1f / (float)bulletCount;
                    bulletAttack.Fire();
                }
                if ((bool)transform2)
                {
                    BulletAttack bulletAttack = new BulletAttack();
                    bulletAttack.owner              = base.gameObject;
                    bulletAttack.weapon             = base.gameObject;
                    bulletAttack.origin             = aimRay.origin;
                    bulletAttack.aimVector          = aimRay.direction;
                    bulletAttack.minSpread          = minSpread;
                    bulletAttack.maxSpread          = maxSpread;
                    bulletAttack.bulletCount        = (uint)((bulletCount > 0) ? bulletCount : 0);
                    bulletAttack.damage             = damageCoefficient * damageStat;
                    bulletAttack.force              = force;
                    bulletAttack.tracerEffectPrefab = tracerEffectPrefab;
                    bulletAttack.muzzleName         = text2;
                    bulletAttack.hitEffectPrefab    = hitEffectPrefab;
                    bulletAttack.isCrit             = Util.CheckRoll(critStat, base.characterBody.master);
                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                    bulletAttack.HitEffectNormal    = false;
                    bulletAttack.radius             = 0.5f;
                    bulletAttack.procCoefficient    = 1f / (float)bulletCount;
                    bulletAttack.Fire();
                }
            }
        }
Beispiel #7
0
        public override void OnEnter()
        {
            base.OnEnter();
            Ray aimRay = base.GetAimRay();

            this.duration = this.baseDuration / this.attackSpeedStat;
            if (this.effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(this.effectPrefab, base.gameObject, muzzleLeft, false);
                EffectManager.SimpleMuzzleFlash(this.effectPrefab, base.gameObject, muzzleRight, false);
            }
            base.PlayAnimation("Gesture", "FireCannons", "FireCannons.playbackRate", this.duration);
            if (base.isAuthority && base.modelLocator && base.modelLocator.modelTransform)
            {
                if (base.modelLocator.modelTransform.GetComponent <ChildLocator>())
                {
                    ChildLocator childLocator = base.modelLocator.modelTransform.GetComponent <ChildLocator>();
                    //literally compiler names but who will look at this code anyways?
                    int       muzzleLeftShildIndex  = childLocator.FindChildIndex(muzzleLeft);
                    int       muzzleRightChildIndex = childLocator.FindChildIndex(muzzleRight);
                    Transform muzzleLeftTransform   = childLocator.FindChild(muzzleLeftShildIndex);
                    Transform muzzleRightTransform  = childLocator.FindChild(muzzleRightChildIndex);
                    if (muzzleLeftTransform)
                    {
                        CharacterMaster characterMaster;
                        characterMaster = new MasterSummon
                        {
                            masterPrefab          = MasterCatalog.FindMasterPrefab("WispMaster"),
                            position              = muzzleLeftTransform.position,
                            rotation              = muzzleLeftTransform.rotation,
                            summonerBodyObject    = null,
                            ignoreTeamMemberLimit = true,
                            teamIndexOverride     = TeamIndex.Monster
                        }.Perform();


                        AIOwnership component4 = characterMaster.gameObject.GetComponent <AIOwnership>();
                        BaseAI      component5 = characterMaster.gameObject.GetComponent <BaseAI>();

                        if (component4 && characterBody.master)
                        {
                            component4.ownerMaster = base.characterBody.master;
                        }
                        if (component5 && characterBody.master.gameObject)
                        {
                            component5.leader.gameObject = base.characterBody.master.gameObject;
                            component5.isHealer          = false;
                            component5.fullVision        = true;
                        }
                    }
                    if (muzzleRightTransform)
                    {
                        CharacterMaster characterMaster;
                        characterMaster = new MasterSummon
                        {
                            masterPrefab          = MasterCatalog.FindMasterPrefab("WispMaster"),
                            position              = muzzleRightTransform.position,
                            rotation              = muzzleRightTransform.rotation,
                            summonerBodyObject    = null,
                            ignoreTeamMemberLimit = true,
                            teamIndexOverride     = TeamIndex.Monster
                        }.Perform();


                        AIOwnership component4 = characterMaster.gameObject.GetComponent <AIOwnership>();
                        BaseAI      component5 = characterMaster.gameObject.GetComponent <BaseAI>();

                        if (component4 && characterBody.master)
                        {
                            component4.ownerMaster = base.characterBody.master;
                        }
                        if (component5 && characterBody.master.gameObject)
                        {
                            component5.leader.gameObject = base.characterBody.master.gameObject;
                            component5.isHealer          = false;
                            component5.fullVision        = true;
                        }
                    }
                }
            }
        }
Beispiel #8
0
        public override void OnEnter()
        {
            effectPrefab       = FireLaser.effectPrefab;
            hitEffectPrefab    = FireLaser.hitEffectPrefab;
            tracerEffectPrefab = FireLaser.tracerEffectPrefab;
            damageCoefficient  = FireLaser.damageCoefficient;
            blastRadius        = FireLaser.blastRadius;
            force             = FireLaser.force;
            minSpread         = FireLaser.minSpread;
            maxSpread         = FireLaser.maxSpread;
            bulletCount       = FireLaser.bulletCount;
            attackSoundString = FireLaser.attackSoundString;
            base.OnEnter();
            duration                      = baseDuration / attackSpeedStat;
            leftModifiedAimRay            = GetAimRay();
            leftModifiedAimRay.direction  = leftLaserDirection;
            rightModifiedAimRay           = GetAimRay();
            rightModifiedAimRay.direction = leftLaserDirection;
            GetModelAnimator();
            Transform modelTransform = GetModelTransform();

            Util.PlaySound(attackSoundString, base.gameObject);
            string leftHandMuzzle  = "MuzzleLeft";
            string rightHandMuzzle = "MuzzleRight";

            if ((bool)base.characterBody)
            {
                base.characterBody.SetAimTimer(2f);
            }
            PlayAnimation("Gesture", "FireCannons", "FireCannons.playbackRate", duration);
            if ((bool)effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, leftHandMuzzle, transmit: false);
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, rightHandMuzzle, transmit: false);
            }
            if (!base.isAuthority)
            {
                return;
            }
            float num = 1000f;
            //Left Hand
            {
                Vector3 leftVector = leftModifiedAimRay.origin + leftModifiedAimRay.direction * num;
                if (Physics.Raycast(leftModifiedAimRay, out var hitInfo, num, (int)LayerIndex.world.mask | (int)LayerIndex.defaultLayer.mask | (int)LayerIndex.entityPrecise.mask))
                {
                    leftVector = hitInfo.point;
                }
                BlastAttack leftBlastAttack = new BlastAttack();
                leftBlastAttack.attacker     = base.gameObject;
                leftBlastAttack.inflictor    = base.gameObject;
                leftBlastAttack.teamIndex    = TeamComponent.GetObjectTeam(base.gameObject);
                leftBlastAttack.baseDamage   = damageStat * damageCoefficient;
                leftBlastAttack.baseForce    = force * 0.2f;
                leftBlastAttack.position     = leftVector;
                leftBlastAttack.radius       = blastRadius;
                leftBlastAttack.falloffModel = BlastAttack.FalloffModel.SweetSpot;
                leftBlastAttack.bonusForce   = force * leftModifiedAimRay.direction;
                leftBlastAttack.Fire();
                _ = leftModifiedAimRay.origin;
                if (!modelTransform)
                {
                    return;
                }
                ChildLocator component = modelTransform.GetComponent <ChildLocator>();
                if ((bool)component)
                {
                    int childIndex = component.FindChildIndex(leftHandMuzzle);
                    if ((bool)tracerEffectPrefab)
                    {
                        EffectData effectData = new EffectData
                        {
                            origin = leftVector,
                            start  = leftModifiedAimRay.origin
                        };
                        effectData.SetChildLocatorTransformReference(base.gameObject, childIndex);
                        EffectManager.SpawnEffect(tracerEffectPrefab, effectData, transmit: true);
                        EffectManager.SpawnEffect(hitEffectPrefab, effectData, transmit: true);
                    }
                }
            }
            //Right Hand
            {
                Vector3 rightVector = rightModifiedAimRay.origin + rightModifiedAimRay.direction * num;
                if (Physics.Raycast(rightModifiedAimRay, out var hitInfo, num, (int)LayerIndex.world.mask | (int)LayerIndex.defaultLayer.mask | (int)LayerIndex.entityPrecise.mask))
                {
                    rightVector = hitInfo.point;
                }
                BlastAttack blastAttack = new BlastAttack();
                blastAttack.attacker     = base.gameObject;
                blastAttack.inflictor    = base.gameObject;
                blastAttack.teamIndex    = TeamComponent.GetObjectTeam(base.gameObject);
                blastAttack.baseDamage   = damageStat * damageCoefficient;
                blastAttack.baseForce    = force * 0.2f;
                blastAttack.position     = rightVector;
                blastAttack.radius       = blastRadius;
                blastAttack.falloffModel = BlastAttack.FalloffModel.SweetSpot;
                blastAttack.bonusForce   = force * rightModifiedAimRay.direction;
                blastAttack.Fire();
                _ = rightModifiedAimRay.origin;
                if (!modelTransform)
                {
                    return;
                }
                ChildLocator component = modelTransform.GetComponent <ChildLocator>();
                if ((bool)component)
                {
                    int childIndex = component.FindChildIndex(rightHandMuzzle);
                    if ((bool)tracerEffectPrefab)
                    {
                        EffectData effectData = new EffectData
                        {
                            origin = rightVector,
                            start  = rightModifiedAimRay.origin
                        };
                        effectData.SetChildLocatorTransformReference(base.gameObject, childIndex);
                        EffectManager.SpawnEffect(tracerEffectPrefab, effectData, transmit: true);
                        EffectManager.SpawnEffect(hitEffectPrefab, effectData, transmit: true);
                    }
                }
            }
        }