Esempio n. 1
0
            public static bool Prefix(Blast __instance, ref List <Hitbox> ___cachedHitBox)
            {
                if (!__instance.OwnerCharacter || __instance.OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled)
                {
                    return(true);
                }

                Collider[] array = Physics.OverlapSphere(__instance.transform.position, __instance.Radius, Global.WeaponHittingMask);

                List <Character> list = new List <Character>();

                ___cachedHitBox.Clear();

                for (int i = 0; i < array.Length; i++)
                {
                    Hitbox component = array[i].GetComponent <Hitbox>();
                    if (component != null &&
                        component.OwnerChar != null &&
                        component.OwnerChar.UID != __instance.OwnerCharacter.UID &&
                        !component.BlockBox &&
                        !list.Contains(component.OwnerChar))
                    //&& __instance.m_targetableFactions.Contains(component.OwnerChar.Faction)
                    //&& (!__instance.IgnoreShooter || component.OwnerChar != __instance.OwnerCharacter))
                    {
                        ___cachedHitBox.Add(component);
                        list.Add(component.OwnerChar);
                    }
                }

                //__instance.AffectHit(___cachedHitBox);
                At.Call(typeof(Blast), __instance, "AffectHit", null, ___cachedHitBox);

                return(false);
            }
Esempio n. 2
0
        private void SetFreeCam(bool active)
        {
            At.Call(typeof(VideoCamera), VideoCamera.Instance, "SetCameraActive", null, active);

            if (active)
            {
                At.SetValue(true, typeof(VideoCamera), VideoCamera.Instance, "m_flyMode");
                Global.LockCursor(true);
            }
        }
Esempio n. 3
0
            public static bool Prefix(Projectile __instance, Collider _collider, Vector3 _hitPoint, Vector3 _hitDir,
                                      ref float ___m_lastHitTimer, ref float ___m_targetLightIntensity, float ___m_lightStartIntensity, ref float ___m_lightIntensityFadeSpeed,
                                      SoundPlayer ___m_shootSound, SoundPlayer ___m_travelSound,
                                      ParticleSystem ___m_explosionFX, ref object[] ___m_explodeInfos)
            {
                if (!__instance.OwnerCharacter || __instance.OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled)
                {
                    return(true);
                }

                ___m_lastHitTimer            = 5f;
                ___m_targetLightIntensity    = ___m_lightStartIntensity * 1.8f;
                ___m_lightIntensityFadeSpeed = __instance.LightIntensityFade.x * 0.5f;

                if (___m_shootSound)
                {
                    ___m_shootSound.Stop(false);
                }
                if (___m_travelSound)
                {
                    ___m_travelSound.Stop(false);
                }

                Character character = null;

                if (_collider != null)
                {
                    if (___m_explosionFX)
                    {
                        ___m_explosionFX.Play();
                    }
                    character = _collider.GetCharacterOwner();
                }

                bool blocked = false;

                if (character && __instance.OwnerCharacter != character)
                {
                    if (!__instance.Unblockable && character.ShieldEquipped)
                    {
                        Hitbox component = _collider.GetComponent <Hitbox>();
                        if (component != null && component.BlockBox && character.Blocking && !character.Countering)
                        {
                            blocked = true;
                        }
                    }
                }
                else
                {
                    character = null;
                }

                // __instance.OnProjectileHit(character, _hitPoint, _hitDir, blocked);
                At.Call(typeof(Projectile), __instance, "OnProjectileHit", null, new object[] { character, _hitPoint, _hitDir, blocked });

                ___m_explodeInfos[0] = character;
                ___m_explodeInfos[1] = _hitPoint;
                ___m_explodeInfos[2] = _hitDir;
                ___m_explodeInfos[3] = (_collider != null);

                __instance.SendMessage("OnExplodeDone", ___m_explodeInfos, SendMessageOptions.DontRequireReceiver);

                if (__instance.EndMode == Projectile.EndLifeMode.Normal ||
                    (__instance.EndMode == Projectile.EndLifeMode.EnvironmentOnly &&
                     (_collider == null || Global.FullEnvironmentMask == (Global.FullEnvironmentMask | 1 << _collider.gameObject.layer))))
                {
                    // __instance.EndLife();
                    At.Call(typeof(Projectile), __instance, "EndLife", null);
                }

                return(false);
            }