Exemplo n.º 1
0
        public void FireChildOnEnemy(ProjectileImpactInfo impactInfo)
        {
            HurtBox hurtBox = impactInfo.collider.GetComponent <HurtBox>();

            if (hurtBox)
            {
                this.FireChildInternal(hurtBox.gameObject.transform.position, false);
            }
        }
        public void OnChildImpact(Collider other)
        {
            HurtBox component = other.GetComponent <HurtBox>();

            if (component)
            {
                ProjectileImpactInfo impactInfo = new ProjectileImpactInfo();
                impactInfo.collider = other.GetComponent <Collider>();
                impactInfo.estimatedPointOfImpact = other.gameObject.GetComponent <Collider>().ClosestPointOnBounds(transform.position);
                impactInfo.estimatedImpactNormal  = new Vector3(0f, 0f, 0f);

                OnProjectileImpact(impactInfo);
            }
        }
Exemplo n.º 3
0
            public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
            {
                if (!enabled)
                {
                    return;
                }
                HurtBox component = impactInfo.collider.GetComponent <HurtBox>();

                if (!component)
                {
                    Activate();
                    projectileImpactExplosion.CancelInvoke("OnProjectileImpact");
                }
            }
        public void OnProjectileImpact(ProjectileImpactInfo info)
        {
            if (info.collider)
            {
                LogCore.LogW("Yes, it collided with collider");
                LogCore.LogW("HurtBox: " + info.collider.GetComponent <HurtBox>());
            }
            else
            {
                LogCore.LogW("Did not collide.");
            }
            LogCore.LogW("Point of collision: " + info.estimatedPointOfImpact);
            LogCore.LogW("Who gives a shit about this thing: " + info.estimatedImpactNormal);

            LogCore.LogW("component rotation :" + transform.eulerAngles);
        }
Exemplo n.º 5
0
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            if (this.attached || !this.alive)
            {
                return;
            }

            hitCollider = impactInfo.collider;
            if (hitCollider)
            {
                HurtBox hurtbox = hitCollider.GetComponent <HurtBox>();
                if (hurtbox)
                {
                    this.AttachToHurtBox(hurtbox);
                }
            }
        }
            void IProjectileImpactBehavior.OnProjectileImpact(ProjectileImpactInfo impactInfo)
            {
                var hitEnemy = impactInfo.collider.gameObject.GetComponent <CharacterBody>();

                if (hitEnemy)
                {
                    if (!hasHit)
                    {
                        Chat.AddMessage("Cleaver hit!");
                        hasHit = true;
                        if (stopWatch >= maxTime)
                        {
                            var skillLocator = projectileController.owner.GetComponent <CharacterBody>()?.masterObject.GetComponent <SkillLocator>();
                            if (skillLocator)
                            {
                                skillLocator.utility.rechargeStopwatch += 1f;
                            }
                        }
                    }
                }
            }
Exemplo n.º 7
0
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            if (!this.alive)
            {
                return;
            }

            BullseyeSearch search = new BullseyeSearch
            {
                teamMaskFilter    = TeamMask.all,
                filterByLoS       = false,
                searchOrigin      = this.transform.position,
                searchDirection   = Random.onUnitSphere,
                sortMode          = BullseyeSearch.SortMode.Distance,
                maxDistanceFilter = 24f,
                maxAngleFilter    = 360f
            };

            search.RefreshCandidates();
            search.FilterOutGameObject(base.gameObject);

            HurtBox target = search.GetResults().FirstOrDefault <HurtBox>();

            if (target)
            {
                if (target.healthComponent && target.healthComponent.body)
                {
                    if (target.healthComponent.body.baseNameToken == "PALADIN_NAME")
                    {
                        PaladinSwordController swordController = target.healthComponent.body.GetComponent <PaladinSwordController>();
                        if (swordController)
                        {
                            swordController.ApplyLightningBuff();
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            if (!this.alive)
            {
                return;
            }

            Collider collider = impactInfo.collider;

            if (collider)
            {
                DamageInfo damageInfo = new DamageInfo();
                if (this.projectileDamage)
                {
                    damageInfo.damage           = this.projectileDamage.damage;
                    damageInfo.crit             = this.projectileDamage.crit;
                    damageInfo.attacker         = this.projectileController.owner;
                    damageInfo.inflictor        = base.gameObject;
                    damageInfo.position         = impactInfo.estimatedPointOfImpact;
                    damageInfo.force            = this.projectileDamage.force * base.transform.forward;
                    damageInfo.procChainMask    = this.projectileController.procChainMask;
                    damageInfo.procCoefficient  = this.projectileController.procCoefficient;
                    damageInfo.damageColorIndex = this.projectileDamage.damageColorIndex;
                    damageInfo.damageType       = this.projectileDamage.damageType;
                }
                else
                {
                    Debug.Log(ManipulatorPlugin.MODNAME + ": No projectile damage component on: " + this + "!");
                }
                HurtBox hurtBox = collider.GetComponent <HurtBox>();
                if (hurtBox)
                {
                    HealthComponent healthComponent = hurtBox.healthComponent;
                    if (healthComponent)
                    {
                        if (!this.attack.ignoredHealthComponentList.Contains(healthComponent))
                        {
                            this.attack.ignoredHealthComponentList.Add(healthComponent);
                            if (healthComponent.gameObject == this.projectileController.owner)
                            {
                                return;
                            }
                            if (FriendlyFireManager.ShouldDirectHitProceed(healthComponent, this.projectileController.teamFilter.teamIndex))
                            {
                                Util.PlaySound(this.enemyHitSoundString, base.gameObject);
                                if (NetworkServer.active)
                                {
                                    damageInfo.ModifyDamageInfo(hurtBox.damageModifier);
                                    healthComponent.TakeDamage(damageInfo);
                                    GlobalEventManager.instance.OnHitEnemy(damageInfo, hurtBox.healthComponent.gameObject);
                                }
                            }
                            this.HitEnemyEvent();
                        }
                    }
                }
                else if (this.destroyOnWorld)
                {
                    this.alive = false;
                }
                damageInfo.position = base.transform.position;
                if (NetworkServer.active)
                {
                    GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                }
            }
            if (!this.alive)
            {
                if (NetworkServer.active && this.impactEffect)
                {
                    EffectManager.SimpleImpactEffect(this.impactEffect, impactInfo.estimatedPointOfImpact, -base.transform.forward, !this.projectileController.isPrediction);
                }
                Util.PlaySound(this.hitSoundString, base.gameObject);
            }
        }
        // Token: 0x06000C13 RID: 3091 RVA: 0x0003BF50 File Offset: 0x0003A150
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            if (!this.alive)
            {
                return;
            }
            Collider collider = impactInfo.collider;

            if (collider)
            {
                DamageInfo damageInfo = new DamageInfo();
                if (this.projectileDamage)
                {
                    damageInfo.damage           = this.projectileDamage.damage;
                    damageInfo.crit             = this.projectileDamage.crit;
                    damageInfo.attacker         = (this.projectileController.owner ? this.projectileController.owner.gameObject : null);
                    damageInfo.inflictor        = base.gameObject;
                    damageInfo.position         = impactInfo.estimatedPointOfImpact;
                    damageInfo.force            = this.projectileDamage.force * this.transform.forward;
                    damageInfo.procChainMask    = this.projectileController.procChainMask;
                    damageInfo.procCoefficient  = this.projectileController.procCoefficient;
                    damageInfo.damageColorIndex = this.projectileDamage.damageColorIndex;
                }
                HurtBox component = collider.GetComponent <HurtBox>();
                if (component)
                {
                    HealthComponent healthComponent = component.healthComponent;
                    if (healthComponent)
                    {
                        Transform transform = healthComponent.gameObject.transform;
                        if (healthComponent.gameObject == this.projectileController.owner)
                        {
                            return;
                        }
                        if ((!this.pastTargetList.Contains(transform) || (this.canBounceToSameTarget && transform != this.lastTarget)) && (transform == this.currentTarget || this.canHitNonTarget || !this.currentTarget))
                        {
                            this.pastTargetList.Add(transform);
                            if (this.currentTarget)
                            {
                                this.lastTarget = this.currentTarget;
                            }
                            else
                            {
                                this.lastTarget = transform;
                            }
                            this.currentTarget = this.FindTarget();
                            this.bounceCount++;
                            healthComponent.TakeDamage(damageInfo);
                            GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                            GlobalEventManager.instance.OnHitEnemy(damageInfo, component.healthComponent.gameObject);
                            if (this.projectileDamage)
                            {
                                this.projectileDamage.damage *= this.damageMultiplier;
                            }
                            if (this.impactEffect)
                            {
                                EffectManager.instance.SimpleImpactEffect(this.impactEffect, this.transform.position, -this.transform.forward, !this.projectileController.isPrediction);
                            }
                            if (this.bounceCount >= this.maxBounceCount)
                            {
                                this.alive = false;
                            }
                        }
                    }
                }
                else if (this.destroyOnWorldIfNoTarget && this.currentTarget == null)
                {
                    damageInfo.position = this.transform.position;
                    GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                    if (this.impactEffect)
                    {
                        EffectManager.instance.SimpleImpactEffect(this.impactEffect, this.transform.position, -this.transform.forward, !this.projectileController.isPrediction);
                    }
                    this.alive = false;
                }
            }
            if (!this.alive)
            {
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            Debug.LogWarning($"stopwatch: {this.stopwatch}");
            Debug.LogWarning($"stopwatch divided: {this.stopwatch / this.maxCoefficient}");
            Debug.LogWarning($"damage: {this.projectileDamage.damage * (this.stopwatch / this.maxCoefficient)}");
            if (!this.alive)
            {
                return;
            }
            Collider collider = impactInfo.collider;

            hitEnemyInfo     = impactInfo;
            hitEnemyCollider = collider;
            if (collider)
            {
                DamageInfo damageInfo = new DamageInfo();
                if (this.projectileDamage)
                {
                    damageInfo.damage           = this.projectileDamage.damage * (this.stopwatch / this.maxCoefficient);
                    damageInfo.crit             = this.projectileDamage.crit;
                    damageInfo.attacker         = this.projectileController.owner;
                    damageInfo.inflictor        = base.gameObject;
                    damageInfo.position         = impactInfo.estimatedPointOfImpact;
                    damageInfo.force            = this.projectileDamage.force * base.transform.forward;
                    damageInfo.procChainMask    = this.projectileController.procChainMask;
                    damageInfo.procCoefficient  = this.projectileController.procCoefficient;
                    damageInfo.damageColorIndex = this.projectileDamage.damageColorIndex;
                    damageInfo.damageType       = this.projectileDamage.damageType;
                }
                else
                {
                    Debug.Log("No projectile damage component!");
                }
                HurtBox component = collider.GetComponent <HurtBox>();
                if (component)
                {
                    HealthComponent healthComponent = component.healthComponent;
                    if (healthComponent)
                    {
                        if (healthComponent.gameObject == this.projectileController.owner)
                        {
                            return;
                        }
                        if (FriendlyFireManager.ShouldDirectHitProceed(healthComponent, this.projectileController.teamFilter.teamIndex))
                        {
                            Util.PlaySound(this.enemyHitSoundString, base.gameObject);
                            if (NetworkServer.active)
                            {
                                damageInfo.ModifyDamageInfo(component.damageModifier);
                                healthComponent.TakeDamage(damageInfo);
                                this.ApplyIceDebuff(healthComponent);
                                GlobalEventManager.instance.OnHitEnemy(damageInfo, component.healthComponent.gameObject);
                            }
                        }
                        this.alive = false;
                    }
                }
                else if (this.destroyOnWorld)
                {
                    this.alive = false;
                }
                damageInfo.position = base.transform.position;
                if (NetworkServer.active)
                {
                    GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                }
            }
            if (this.fireChildren)
            {
                for (int i = 0; i < this.childrenCount; i++)
                {
                    Vector3 vector = new Vector3(UnityEngine.Random.Range(this.minAngleOffset.x, this.maxAngleOffset.x), UnityEngine.Random.Range(this.minAngleOffset.z, this.maxAngleOffset.z), UnityEngine.Random.Range(this.minAngleOffset.z, this.maxAngleOffset.z));
                    switch (this.transformSpace)
                    {
                    case ProjectileImpactExplosion.TransformSpace.World:
                        this.FireChild(vector);
                        break;

                    case ProjectileImpactExplosion.TransformSpace.Local:
                        this.FireChild(base.transform.forward + base.transform.TransformDirection(vector));
                        break;

                    case ProjectileImpactExplosion.TransformSpace.Normal:
                        this.FireChild(this.impactNormal + vector);
                        break;
                    }
                }
            }
            if (!this.alive)
            {
                if (NetworkServer.active && this.impactEffect)
                {
                    EffectManager.SimpleImpactEffect(this.impactEffect, impactInfo.estimatedPointOfImpact, -base.transform.forward, !this.projectileController.isPrediction);
                }
                Util.PlaySound(this.hitSoundString, base.gameObject);
                if (this.destroyWhenNotAlive)
                {
                    UnityEngine.Object.Destroy(base.gameObject);
                }
            }
        }
 // Token: 0x06002BBF RID: 11199 RVA: 0x000B90F9 File Offset: 0x000B72F9
 private void OnImpact(ProjectileImpactInfo projectileImpactInfo)
 {
     this.Advance();
 }