public override void UpdateState(List <UnturnedPlayer> players) { if (ZombieManager.regions == null) { return; } if (!GetValueSafe()) { return; } foreach (ZombieRegion t in ZombieManager.regions.Where(t => t.zombies != null)) { // ReSharper disable once MergeSequentialChecks foreach (var zombie in t.zombies.Where(z => z != null && z.transform?.position != null)) { if (zombie.isDead) { continue; } Region region = RegionsPlugin.Instance?.GetRegionAt(zombie.transform.position); if (region == null) { continue; } zombie.gear = 0; zombie.isDead = true; Vector3 ragdoll = (Vector3)typeof(Zombie).GetField("ragdoll", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(zombie); ZombieManager.sendZombieDead(zombie, ragdoll); } } }
void CmdTakeDamage(GameObject player, int gunDamage) { ZombieManager zombieManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <ZombieManager>(); if (health <= 0 && !checkDead) { if (player.GetComponent <PlayerController>().hasAuthority&& !checkDead) { gameManager.server_Score += gameManager.score; } else { gameManager.p2_Score += gameManager.score; } normalZombieAI.IsDead = true; zombieManager.deadZombieCountOncurrentLevel++; zombieManager.deadZombieCount++; RpcChangeAnimation("IsDead", true); audioController.RpcMakeSomeNoise(gameObject.name[0] + "D" + Random.Range(1, 2).ToString()); audioController.audioSource.Play(); Invoke("CmdDestroy", 1.2f); checkDead = true; } else { health -= gunDamage; audioController.RpcMakeSomeNoise(gameObject.name[0] + "T" + Random.Range(1, 2).ToString()); audioController.audioSource.Play(); } }
// Token: 0x060033BF RID: 13247 RVA: 0x0014FA48 File Offset: 0x0014DE48 public static void alert(Vector3 position, float radius) { float sqrRadius = radius * radius; if (LevelNavigation.checkNavigation(position)) { AlertTool.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(position, sqrRadius, AlertTool.zombiesInRadius); for (int i = 0; i < AlertTool.zombiesInRadius.Count; i++) { Zombie zombie = AlertTool.zombiesInRadius[i]; if (!zombie.isDead) { zombie.alert(position, true); } } } AlertTool.animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(position, sqrRadius, AlertTool.animalsInRadius); for (int j = 0; j < AlertTool.animalsInRadius.Count; j++) { Animal animal = AlertTool.animalsInRadius[j]; if (!animal.isDead) { if (animal.asset != null) { if (animal.asset.behaviour != EAnimalBehaviour.IGNORE) { animal.alertPoint(position, true); } } } } }
// Use this for initialization void Start() { if (!zManager) { zManager = FindObjectOfType <ZombieManager>(); } }
public override void ViewDidLoad() { var mapView = new MKMapView(); mapView.Delegate = new MyDelegate(); View = mapView; base.ViewDidLoad(); // ios7 layout if (RespondsToSelector(new Selector("edgesForExtendedLayout"))) { EdgesForExtendedLayout = UIRectEdge.None; } var thirdViewModel = (ThirdViewModel)ViewModel; _zombieManager = new ZombieManager(mapView); mapView.SetRegion(MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D(51.4, 0.4), 50000, 50000), true); var set = this.CreateBindingSet <ThirdView, Core.ViewModels.ThirdViewModel>(); set.Bind(_zombieManager).For(z => z.ItemsSource).To(vm => vm.Yarp); set.Apply(); }
public override void Execute(PointBlankPlayer executor, string[] args) { ZombieManager.tickingZombies.ForEach((zombie) => { ZombieManager.sendZombieDead(zombie, Vector3.zero); }); UnturnedChat.SendMessage(executor, Translate("KillZombies_Success"), ConsoleColor.Green); }
public override void OnCreated(IThreading threading) { _helper = MonitorHelper.Instance; _zombieManager = ZombieManager.instance; _initialized = false; _terminated = false; base.OnCreated(threading); }
private void Start() { position = GetComponent <Transform>(); inputHandler = GetComponent <Player_Input_Handler>(); zombManager = GameObject.FindGameObjectWithTag("ZombieManager").GetComponent <ZombieManager>(); health = 100; iFrames = 2; money = 10000; }
private void Start() { PV = GetComponent <PhotonView>(); zombManager = GameObject.Find("ZombieManager").GetComponent <ZombieManager>(); agent = GetComponent <NavMeshAgent>(); damage = 25; Physics.IgnoreLayerCollision(9, 10); }
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) { var killedCount = 0; UWorld.Zombies.Where(zombie => !zombie.isDead).ForEach(zombie => { ZombieManager.sendZombieDead(zombie, Vector3.zero); killedCount++; }); EssLang.Send(src, "KILLED_ZOMBIES", killedCount); return CommandResult.Success(); }
public void SetZombieType(ZombieType type) { // go query the zombie type manager for our stats stats = ZombieManager.GetStatsForType((int)type); zombieType = type; // query the zombie manager for the material this.GetComponent <MeshRenderer> ().sharedMaterial = ZombieManager.GetMaterialForType((int)type); // get the scale too thisTransform.localScale = ZombieManager.GetScaleForType((int)type); // set the nucleus multiplier speed nucleus.multiplier = stats.speed; }
// Start is called before the first frame update void Start() { if (!isServer) { return; } rb = GetComponent <Rigidbody2D>(); zombieManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <ZombieManager>(); gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); health = zombieManager.zombieHealt; damage = zombieManager.zombieDamage; }
public override void Execute(ICommandContext context) { var killedCount = 0; var zombies = Object.FindObjectsOfType <Zombie>(); zombies.Where(zombie => !zombie.isDead).ForEach(zombie => { ZombieManager.sendZombieDead(zombie, Vector3.zero); killedCount++; }); context.User.SendLocalizedMessage(Translations, "KILLED_ZOMBIES", killedCount); }
void Start() { if (ZombieManager.zombieManager == null) { ZombieManager.zombieManager = this; } else { if (ZombieManager.zombieManager != this) { Destroy(ZombieManager.zombieManager.gameObject); ZombieManager.zombieManager = this; } } PV = GetComponent <PhotonView>(); alivePlayers = new List <Transform>(); zombies = new List <ZombieController>(); for (int i = 0; i < transform.childCount; i++) { activeSpawns.Add(transform.GetChild(i)); } roundNum = 0; zombiesInRound = 10; zombiesKilled = 0; zombiesInRoom = 0; zombieHealth = 20; zombieSpeed = 1; canSpawn = true; Debug.Log(lobbySpawns.transform.childCount); for (int i = 0; i < lobbySpawns.transform.childCount; i++) { activeSpawns.Add(lobbySpawns.transform.GetChild(i)); } StartCoroutine(WaitForNextRound()); }
void KillZombies() { try { if (ZombieManager.tickingZombies.Count > GetAllowedZombies()) { randomValue = rand.Next(ZombieManager.tickingZombies.Count); Zombie zom = ZombieManager.tickingZombies[randomValue]; ZombieManager.sendZombieDead(zom, UnityEngine.Vector3.zero); //zom.tellDead(UnityEngine.Vector3.zero); if (Configuration.Instance.LogKills) { Logger.Log("Killed a zombie, current ticked zombie count: " + ZombieManager.tickingZombies.Count); } } } catch { } }
public override void ViewDidLoad() { var mapView = new MKMapView(); mapView.Delegate = new MyDelegate(); View = mapView; base.ViewDidLoad(); var thirdViewModel = (ThirdViewModel)ViewModel; _zombieManager = new ZombieManager(mapView); mapView.SetRegion(MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D(51.4, 0.4), 50000, 50000), true); var set = this.CreateBindingSet<ThirdView, Core.ViewModels.ThirdViewModel>(); set.Bind(_zombieManager).For(z => z.ItemsSource).To(vm => vm.Yarp); set.Apply(); }
void CmdFindStats() { if (!isServer) { return; } GameManager gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); ZombieManager zombieManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <ZombieManager>(); if (GameObject.FindGameObjectsWithTag("Player").Length != 1) { RpcGiveClientsInformation(gameManager.server_Score, gameManager.p2_Score, 0, zombieManager.zombieCount - zombieManager.deadZombieCount, gameManager.level); } else { RpcGiveClientsInformation(gameManager.server_Score, gameManager.p2_Score, 0f, zombieManager.zombieCount - zombieManager.deadZombieCountOncurrentLevel, gameManager.level); } }
public void Execute(IRocketPlayer caller, string[] command) { // Try to spawn the zombie just like ZombieManager does // In a finished version, this would also need to be configurable UnturnedPlayer untPlayer = (UnturnedPlayer)caller; EZombieSpeciality speciality = EZombieSpeciality.NORMAL; byte type = 1; byte shirt = (byte)Random.Range(0, 1); byte pants = (byte)Random.Range(0, 1); byte hat = (byte)Random.Range(0, 1); byte gear = (byte)Random.Range(0, 1); byte move = (byte)Random.Range(0, 4); byte idle = (byte)Random.Range(0, 3); Vector3 point = untPlayer.Position; point.y += 0.1f; byte bound = untPlayer.Player.movement.bound; // The newewst zombie will have this id ushort zombieId = (ushort)ZombieManager.regions[bound].zombies.Count; // Add the zombie ZombieManager.instance.addZombie(bound, type, (byte)speciality, shirt, pants, hat, gear, move, idle, point, Random.Range(0f, 360f), false); // Get the Zombie by it's new id Zombie zombie = ZombieManager.getZombie(point, zombieId); /*zombie.sendRevive * ( * type, * (byte)speciality, * shirt, * pants, * hat, * gear, * untPlayer.Position, * 0 * );*/ UnturnedChat.Say("Spawned zombie with id " + zombieId); }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedChat.Say(caller, "This command is not working properly, request denied.", Color.red); return; Zombie myZombie = new Zombie(); UnturnedPlayer pCaller = (UnturnedPlayer)caller; // Vector3 test = new Vector3(0, 0, 0); // myZombie.isHunting = true; // Logger.Log("Flag1" + myZombie.isActiveAndEnabled); // myZombie.move = 100; myZombie.askAttack(100); // myZombie.enabled = true; myZombie.askThrow(); myZombie.tellSpeciality(EZombieSpeciality.ACID); // myZombie.idle = 0; ZombieManager.sendZombieAlive(myZombie, myZombie.type, (byte)myZombie.speciality, myZombie.shirt, myZombie.pants, myZombie.hat, myZombie.gear, pCaller.Position, 0); ZombieManager.Instance.addZombie(0, myZombie.type, (byte)myZombie.speciality, myZombie.shirt, myZombie.pants, myZombie.hat, myZombie.gear, myZombie.move, myZombie.idle, pCaller.Position, pCaller.Rotation, false); }
void Start() { GameObject findObj = GameObject.FindGameObjectWithTag("ZombieManager"); if (findObj != null) { zombieManager = findObj.GetComponent <ZombieManager>(); } spriteRenderer = GetComponent <SpriteRenderer>(); dicZombieState[ZombieState.None] = None; dicZombieState[ZombieState.Idle] = Idle; dicZombieState[ZombieState.Move] = Move; dicZombieState[ZombieState.Follow] = Follow; dicZombieState[ZombieState.Attack] = Attack; dicZombieState[ZombieState.Damage] = Damage; dicZombieState[ZombieState.Dead] = Dead; FindTarget(); roadManager = GameObject.Find("RoadManager").GetComponent <RoadManager>(); }
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) { var count = 0; UWorld.Zombies.Where(z => z.isDead).ForEach(zombie => { ZombieManager.sendZombieAlive( zombie, zombie.type, (byte)zombie.speciality, zombie.shirt, zombie.pants, zombie.hat, zombie.gear, zombie.transform.position, 0 ); count++; }); EssLang.Send(src, "RESPAWNED_ZOMBIES", count); return(CommandResult.Success()); }
public override void Execute(ICommandContext context) { var count = 0; var zombies = Object.FindObjectsOfType <Zombie>(); zombies.Where(z => z.isDead).ForEach(zombie => { ZombieManager.sendZombieAlive( zombie, zombie.type, (byte)zombie.speciality, zombie.shirt, zombie.pants, zombie.hat, zombie.gear, zombie.transform.position, 0 ); count++; }); context.User.SendLocalizedMessage(Translations, "RESPAWNED_ZOMBIES", count); }
public override void ViewDidLoad() { var mapView = new MKMapView(); mapView.Delegate = new MyDelegate(); View = mapView; base.ViewDidLoad(); // ios7 layout if (RespondsToSelector(new Selector("edgesForExtendedLayout"))) EdgesForExtendedLayout = UIRectEdge.None; var thirdViewModel = (ThirdViewModel)ViewModel; _zombieManager = new ZombieManager(mapView); mapView.SetRegion(MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D(51.4, 0.4), 50000, 50000), true); var set = this.CreateBindingSet<ThirdView, Core.ViewModels.ThirdViewModel>(); set.Bind(_zombieManager).For(z => z.ItemsSource).To(vm => vm.Yarp); set.Apply(); }
// Token: 0x060033BE RID: 13246 RVA: 0x0014F69C File Offset: 0x0014DA9C public static void alert(Player player, Vector3 position, float radius, bool sneak, Vector3 spotDir, bool isSpotOn) { radius *= Provider.modeConfigData.Players.Detect_Radius_Multiplier; radius = Mathf.Clamp(radius, 0f, 64f); if (player == null) { return; } float sqrRadius = radius * radius; if (player.movement.nav != 255) { if (ZombieManager.regions[(int)player.movement.nav].hasBeacon) { for (int i = 0; i < ZombieManager.regions[(int)player.movement.nav].zombies.Count; i++) { Zombie zombie = ZombieManager.regions[(int)player.movement.nav].zombies[i]; if (!zombie.isDead) { if (zombie.checkAlert(player)) { zombie.alert(player); } } } } AlertTool.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(position, sqrRadius, AlertTool.zombiesInRadius); for (int j = 0; j < AlertTool.zombiesInRadius.Count; j++) { Zombie zombie2 = AlertTool.zombiesInRadius[j]; if (!zombie2.isDead) { if (zombie2.checkAlert(player)) { Vector3 vector = zombie2.transform.position - position; if (AlertTool.check(zombie2.transform.forward, vector, sqrRadius, sneak, spotDir, isSpotOn)) { RaycastHit raycastHit; Physics.Raycast(zombie2.transform.position + Vector3.up, -vector, out raycastHit, vector.magnitude * 0.95f, RayMasks.BLOCK_VISION); if (!(raycastHit.transform != null)) { zombie2.alert(player); } } } } } } AlertTool.animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(position, sqrRadius, AlertTool.animalsInRadius); for (int k = 0; k < AlertTool.animalsInRadius.Count; k++) { Animal animal = AlertTool.animalsInRadius[k]; if (!animal.isDead) { if (animal.asset != null) { if (animal.asset.behaviour == EAnimalBehaviour.DEFENSE) { if (!animal.isFleeing) { Vector3 vector2 = animal.transform.position - position; if (!AlertTool.check(animal.transform.forward, vector2, sqrRadius, sneak, spotDir, isSpotOn)) { goto IL_385; } RaycastHit raycastHit; Physics.Raycast(animal.transform.position + Vector3.up, -vector2, out raycastHit, vector2.magnitude * 0.95f, RayMasks.BLOCK_VISION); if (raycastHit.transform != null) { goto IL_385; } } animal.alertPoint(player.transform.position, true); } else if (animal.asset.behaviour == EAnimalBehaviour.OFFENSE) { if (animal.checkAlert(player)) { Vector3 vector3 = animal.transform.position - position; if (AlertTool.check(animal.transform.forward, vector3, sqrRadius, sneak, spotDir, isSpotOn)) { RaycastHit raycastHit; Physics.Raycast(animal.transform.position + Vector3.up, -vector3, out raycastHit, vector3.magnitude * 0.95f, RayMasks.BLOCK_VISION); if (!(raycastHit.transform != null)) { animal.alertPlayer(player, true); } } } } } } IL_385 :; } }
public void Init(ContentManager content) { isRunning = false; soundMgr = DayGameEngineImp.getGameEngine().getSoundManager(); uiMgr = new NightUiManagerImpl(); menuMgr = DayGameEngineImp.getGameEngine().getMenuManager(); mapMgr = DayGameEngineImp.getGameEngine().getMapManager(); zombieMgr = new ZombieManagerImplementation(); effectsMgr = new EffectsManagerImp(); survivorMgr = new SurvivorManagerIMP(); nightSimMgr = new NightSimMgrImpl(); nightSimMgr.init(); effectsMgr.Init(content); //uiMgr.init(); //menuMgr.Init(content); // gets init in the daygameengine //mapMgr.Init(); zombieMgr.init(content); survivorMgr.init(content); nightview = content.Load<Texture2D>("Images//nightclouds"); }
void Awake() { singleton = this; }
public void Reset() { ZombieManager.GetZombieData(this); }
// Token: 0x06000011 RID: 17 RVA: 0x00002CB4 File Offset: 0x00000EB4 private void OnGUI() { if (Menu.MenuOpened != 1) { return; } GUI.skin = Menu.Skin; GUILayout.BeginArea(new Rect((float)(UnityEngine.Screen.width / 2 - 250), (float)(UnityEngine.Screen.height / 2 - 250), 700f, 700f), "Hake", GUI.skin.GetStyle("window")); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[0]); MainMenu.NoRecoil = GUILayout.Toggle(MainMenu.NoRecoil, "No recoil", new GUILayoutOption[0]); MainMenu.NoShake = GUILayout.Toggle(MainMenu.NoShake, "No shake", new GUILayoutOption[0]); MainMenu.NoSpread = GUILayout.Toggle(MainMenu.NoSpread, "No spread", new GUILayoutOption[0]); this._zoom = GUILayout.Toggle(this._zoom, "Enable FOV", new GUILayoutOption[0]); GUILayout.Space(50f); MainMenu.Aimbot_Enable = GUILayout.Toggle(MainMenu.Aimbot_Enable, "Enable Aimbot", new GUILayoutOption[0]); MainMenu.Aimbot_Players = GUILayout.Toggle(MainMenu.Aimbot_Players, "At Players", new GUILayoutOption[0]); MainMenu.Aimbot_Zombies = GUILayout.Toggle(MainMenu.Aimbot_Zombies, "At Zombies", new GUILayoutOption[0]); MainMenu.Aimbot_Animals = GUILayout.Toggle(MainMenu.Aimbot_Animals, "At Animals", new GUILayoutOption[0]); GUILayout.Label(MainMenu.WebText, new GUILayoutOption[0]); GUILayout.Label("Unturned Hake", new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); if (GUILayout.Button("Ballistic Force off", new GUILayoutOption[0])) { DisableBallistic(); } if (GUILayout.Button("Set day", new GUILayoutOption[0])) { LightingManager.time = (uint)(LightingManager.cycle * LevelLighting.transition); } if (GUILayout.Button("Night vision: " + this._nightVision, new GUILayoutOption[0])) { this._nightVision++; if (this._nightVision > 3) { this._nightVision = 0; } LevelLighting.vision = (ELightingVision)this._nightVision; LevelLighting.updateLighting(); LevelLighting.updateLocal(); PlayerLifeUI.updateGrayscale(); } if (GUILayout.Button("No Respawn Timer", new GUILayoutOption[0])) { this.DisableTimers(); } if (GUILayout.Button("No Fog" + Menu.GetToggleText(RenderSettings.fog), new GUILayoutOption[0])) { RenderSettings.fog = !RenderSettings.fog; } if (GUILayout.Button("No Rain", new GUILayoutOption[0])) { LevelLighting.rainyness = 0; } if (GUILayout.Button("Kill All Zombies", new GUILayoutOption[0])) { foreach (Zombie zombie in FindObjectsOfType <Zombie>()) { ZombieManager.sendZombieDead(zombie, new Vector3(0, 0, 0)); } } GUILayout.Space(50f); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect((float)((UnityEngine.Screen.width / 2 - 250) + 720), (float)(UnityEngine.Screen.height / 2 - 250), 200f, 800f), "Friend Menu", GUI.skin.GetStyle("window")); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label(FriendList, new GUILayoutOption[0]); if (GUILayout.Button("Refresh Friends List", new GUILayoutOption[0])) { CreateFriendButtons(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); }
public static bool Prefix(InteractableSentry __instance) { RocketPlayer ownerPlayer = new RocketPlayer(__instance.owner.ToString()); bool hasWeapon = (bool)hasWeaponField.GetValue(__instance); bool isFiring = (bool)isFiringField.GetValue(__instance); bool isAiming = (bool)isAimingField.GetValue(__instance); float lastScan = (float)lastScanField.GetValue(__instance); float lastFire = (float)lastFireField.GetValue(__instance); float fireTime = (float)fireTimeField.GetValue(__instance); float lastAim = (float)lastAimField.GetValue(__instance); ItemWeaponAsset displayAsset = displayAssetField.GetValue(__instance) as ItemWeaponAsset; Attachments attachments = attachmentsField.GetValue(__instance) as Attachments; bool interact = (bool)interactField.GetValue(__instance); var playersInRadius = (List <Player>)playersInRadiusField.GetValue(null); var zombiesInRadius = (List <Zombie>)zombiesInRadiusField.GetValue(null); var animalsInRadius = (List <Animal>)animalsInRadiusField.GetValue(null); var targetPlayer = targetPlayerField.GetValue(__instance) as Player; var targetZombie = targetZombieField.GetValue(__instance) as Zombie; var targetAnimal = targetAnimalField.GetValue(__instance) as Animal; var aimTransform = aimTransformField.GetValue(__instance) as Transform; if (__instance.isPowered) { Vector3 vector3_1 = __instance.transform.position + new Vector3(0.0f, 0.65f, 0.0f); Vector3 vector3_2; if ((double)Time.realtimeSinceStartup - (double)lastScan > 0.100000001490116) { lastScanField.SetValue(__instance, Time.realtimeSinceStartup); float a = 48f; if (hasWeapon) { a = Mathf.Min(a, ((ItemWeaponAsset)displayAsset).range); } float sqrRadius = a * a; float num = sqrRadius; Player player = (Player)null; Zombie zombie = (Zombie)null; Animal animal = (Animal)null; if (Provider.isPvP) { playersInRadius.Clear(); PlayerTool.getPlayersInRadius(vector3_1, sqrRadius, playersInRadius); for (int index = 0; index < playersInRadius.Count; ++index) { Player playersInRadiu = playersInRadius[index]; var currentRocketPlayer = new RocketPlayer(playersInRadiu.channel.owner.playerID.steamID.ToString()); if (currentRocketPlayer.HasPermission(GodPermission)) { continue; } if (!(playersInRadiu.channel.owner.playerID.steamID == __instance.owner) && !playersInRadiu.quests.isMemberOfGroup(__instance.group) && (!playersInRadiu.life.isDead && playersInRadiu.animator.gesture != EPlayerGesture.ARREST_START) && ((!playersInRadiu.movement.isSafe || !playersInRadiu.movement.isSafeInfo.noWeapons) && playersInRadiu.movement.canAddSimulationResultsToUpdates) && (!((UnityEngine.Object)player != (UnityEngine.Object)null) || playersInRadiu.animator.gesture != EPlayerGesture.SURRENDER_START) && (__instance.sentryMode != ESentryMode.FRIENDLY || (double)Time.realtimeSinceStartup - (double)playersInRadiu.equipment.lastPunching < 2.0 || playersInRadiu.equipment.isSelected && playersInRadiu.equipment.asset != null && playersInRadiu.equipment.asset.shouldFriendlySentryTargetUser)) { vector3_2 = playersInRadiu.look.aim.position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = playersInRadiu.look.aim.position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)playersInRadiu != (UnityEngine.Object)targetPlayer) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = playersInRadiu; } } } } } zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(vector3_1, sqrRadius, zombiesInRadius); for (int index = 0; index < zombiesInRadius.Count; ++index) { Zombie zombiesInRadiu = zombiesInRadius[index]; if (!zombiesInRadiu.isDead && zombiesInRadiu.isHunting) { Vector3 position = zombiesInRadiu.transform.position; switch (zombiesInRadiu.speciality) { case EZombieSpeciality.NORMAL: position += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: position += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: position += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: position += new Vector3(0.0f, 1f, 0.0f); break; } vector3_2 = position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)zombiesInRadiu != (UnityEngine.Object)targetZombie) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = (Player)null; zombie = zombiesInRadiu; } } } } animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(vector3_1, sqrRadius, animalsInRadius); for (int index = 0; index < animalsInRadius.Count; ++index) { Animal animalsInRadiu = animalsInRadius[index]; if (!animalsInRadiu.isDead) { Vector3 position = animalsInRadiu.transform.position; vector3_2 = position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)animalsInRadiu != (UnityEngine.Object)targetAnimal) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = (Player)null; zombie = (Zombie)null; animal = animalsInRadiu; } } } } if ((UnityEngine.Object)player != (UnityEngine.Object)targetPlayer || (UnityEngine.Object)zombie != (UnityEngine.Object)targetZombie || (UnityEngine.Object)animal != (UnityEngine.Object)targetAnimal) { targetPlayerField.SetValue(__instance, player); targetZombieField.SetValue(__instance, zombie); targetAnimalField.SetValue(__instance, animal); lastFireField.SetValue(__instance, Time.realtimeSinceStartup + 0.1f); } } if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { switch (__instance.sentryMode) { case ESentryMode.NEUTRAL: case ESentryMode.FRIENDLY: isFiringField.SetValue(__instance, targetPlayer.animator.gesture != EPlayerGesture.SURRENDER_START); break; case ESentryMode.HOSTILE: isFiringField.SetValue(__instance, true); break; } isAimingField.SetValue(__instance, true); } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { isFiringField.SetValue(__instance, true); isAimingField.SetValue(__instance, true); } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { switch (__instance.sentryMode) { case ESentryMode.NEUTRAL: case ESentryMode.FRIENDLY: isFiringField.SetValue(__instance, targetAnimal.isHunting); break; case ESentryMode.HOSTILE: isFiringField.SetValue(__instance, true); break; } isAimingField.SetValue(__instance, true); } else { isFiringField.SetValue(__instance, false); isAimingField.SetValue(__instance, false); } if (isAiming && (double)Time.realtimeSinceStartup - (double)lastAim > (double)Provider.UPDATE_TIME) { lastAimField.SetValue(__instance, Time.realtimeSinceStartup); Transform transform = (Transform)null; Vector3 vector3_3 = Vector3.zero; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { transform = targetPlayer.transform; vector3_3 = targetPlayer.look.aim.position; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { transform = targetZombie.transform; vector3_3 = targetZombie.transform.position; switch (targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector3_3 += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: vector3_3 += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: vector3_3 += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: vector3_3 += new Vector3(0.0f, 1f, 0.0f); break; } } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { transform = targetAnimal.transform; vector3_3 = targetAnimal.transform.position + Vector3.up; } if ((UnityEngine.Object)transform != (UnityEngine.Object)null) { float yaw = Mathf.Atan2(vector3_3.x - vector3_1.x, vector3_3.z - vector3_1.z) * 57.29578f; double num = (double)vector3_3.y - (double)vector3_1.y; vector3_2 = vector3_3 - vector3_1; double magnitude = (double)vector3_2.magnitude; float pitch = Mathf.Sin((float)(num / magnitude)) * 57.29578f; BarricadeManager.sendAlertSentry(__instance.transform, yaw, pitch); } } if (isFiring && hasWeapon && (__instance.displayItem.state[10] > (byte)0 && !__instance.isOpen) && (double)Time.realtimeSinceStartup - (double)lastFire > (double)fireTime) { lastFireField.SetValue(__instance, lastFire + fireTime); if ((double)Time.realtimeSinceStartup - (double)lastFire > (double)fireTime) { lastFire = Time.realtimeSinceStartup; } float num1 = (float)__instance.displayItem.quality / 100f; if (attachments.magazineAsset == null) { return(false); } if (!ownerPlayer.HasPermission(IgnoreAmmoPermission)) { Console.WriteLine("Ammo reduction"); if ((__instance.sentryAsset.infiniteAmmo ? 1 : (((ItemGunAsset)displayAsset).infiniteAmmo ? 1 : 0)) == 0) { --__instance.displayItem.state[10]; } if (!__instance.sentryAsset.infiniteQuality && Provider.modeConfigData.Items.Has_Durability && (__instance.displayItem.quality > (byte)0 && (double)UnityEngine.Random.value < (double)((ItemWeaponAsset)displayAsset).durability)) { if ((int)__instance.displayItem.quality > (int)((ItemWeaponAsset)displayAsset).wear) { __instance.displayItem.quality -= ((ItemWeaponAsset)displayAsset).wear; } else { __instance.displayItem.quality = (byte)0; } } } if (attachments.barrelAsset == null || !attachments.barrelAsset.isSilenced || __instance.displayItem.state[16] == (byte)0) { AlertTool.alert(__instance.transform.position, 48f); } float num2 = ((ItemGunAsset)displayAsset).spreadAim * ((double)num1 < 0.5 ? (float)(1.0 + (1.0 - (double)num1 * 2.0)) : 1f); if (attachments.tacticalAsset != null && interact) { num2 *= attachments.tacticalAsset.spread; } if (attachments.gripAsset != null) { num2 *= attachments.gripAsset.spread; } if (attachments.barrelAsset != null) { num2 *= attachments.barrelAsset.spread; } if (attachments.magazineAsset != null) { num2 *= attachments.magazineAsset.spread; } if ((UnityEngine.Object)((ItemGunAsset)displayAsset).projectile == (UnityEngine.Object)null) { BarricadeManager.sendShootSentry(__instance.transform); byte pellets = attachments.magazineAsset.pellets; for (byte index1 = 0; (int)index1 < (int)pellets; ++index1) { EPlayerKill kill = EPlayerKill.NONE; uint xp = 0; float times = (float)(1.0 * ((double)num1 < 0.5 ? 0.5 + (double)num1 : 1.0)); Transform transform = (Transform)null; float num3 = 0.0f; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { transform = targetPlayer.transform; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { transform = __instance.transform; } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { transform = targetAnimal.transform; } if ((UnityEngine.Object)transform != (UnityEngine.Object)null) { vector3_2 = transform.position - __instance.transform.position; num3 = vector3_2.magnitude; } float num4 = (1f - num3 / ((ItemWeaponAsset)displayAsset).range) * (1f - ((ItemGunAsset)displayAsset).spreadHip) * 0.75f; if ((UnityEngine.Object)transform == (UnityEngine.Object)null || (double)UnityEngine.Random.value > (double)num4) { Vector3 forward = aimTransform.forward; forward += aimTransform.right * UnityEngine.Random.Range(-((ItemGunAsset)displayAsset).spreadHip, ((ItemGunAsset)displayAsset).spreadHip) * num2; forward += aimTransform.up * UnityEngine.Random.Range(-((ItemGunAsset)displayAsset).spreadHip, ((ItemGunAsset)displayAsset).spreadHip) * num2; forward.Normalize(); RaycastInfo raycastInfo = DamageTool.raycast(new Ray(aimTransform.position, forward), ((ItemWeaponAsset)displayAsset).range, RayMasks.DAMAGE_SERVER); if (!((UnityEngine.Object)raycastInfo.transform == (UnityEngine.Object)null)) { DamageTool.impact(raycastInfo.point, raycastInfo.normal, raycastInfo.material, (UnityEngine.Object)raycastInfo.vehicle != (UnityEngine.Object)null || raycastInfo.transform.CompareTag("Barricade") || raycastInfo.transform.CompareTag("Structure") || raycastInfo.transform.CompareTag("Resource")); if ((UnityEngine.Object)raycastInfo.vehicle != (UnityEngine.Object)null) { DamageTool.damage(raycastInfo.vehicle, false, Vector3.zero, false, ((ItemWeaponAsset)displayAsset).vehicleDamage, times, true, out kill, new CSteamID(), EDamageOrigin.Sentry); } else if ((UnityEngine.Object)raycastInfo.transform != (UnityEngine.Object)null) { if (raycastInfo.transform.CompareTag("Barricade")) { ushort result; if (ushort.TryParse(raycastInfo.transform.name, NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out result)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, result); if (itemBarricadeAsset != null && (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, ((ItemWeaponAsset)displayAsset).barricadeDamage, times, out kill, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.transform.CompareTag("Structure")) { ushort result; if (ushort.TryParse(raycastInfo.transform.name, NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out result)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, result); if (itemStructureAsset != null && (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, raycastInfo.direction * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f), ((ItemWeaponAsset)displayAsset).structureDamage, times, out kill, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.transform.CompareTag("Resource")) { byte x; byte y; ushort index2; if (ResourceManager.tryGetRegion(raycastInfo.transform, out x, out y, out index2)) { ResourceSpawnpoint resourceSpawnpoint = ResourceManager.getResourceSpawnpoint(x, y, index2); if (resourceSpawnpoint != null && !resourceSpawnpoint.isDead && (int)resourceSpawnpoint.asset.bladeID == (int)((ItemWeaponAsset)displayAsset).bladeID) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f), ((ItemWeaponAsset)displayAsset).resourceDamage, times, 1f, out kill, out xp, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.section < byte.MaxValue) { InteractableObjectRubble componentInParent = raycastInfo.transform.GetComponentInParent <InteractableObjectRubble>(); if ((UnityEngine.Object)componentInParent != (UnityEngine.Object)null && !componentInParent.isSectionDead(raycastInfo.section) && (componentInParent.asset.rubbleIsVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(componentInParent.transform, raycastInfo.direction, raycastInfo.section, ((ItemWeaponAsset)displayAsset).objectDamage, times, out kill, out xp, new CSteamID(), EDamageOrigin.Sentry); } } } } } else { Vector3 point = Vector3.zero; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { point = targetPlayer.look.aim.position; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { point = targetZombie.transform.position; switch (targetZombie.speciality) { case EZombieSpeciality.NORMAL: point += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: point += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: point += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: point += new Vector3(0.0f, 1f, 0.0f); break; } } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { point = targetAnimal.transform.position + Vector3.up; } DamageTool.impact(point, -aimTransform.forward, EPhysicsMaterial.FLESH_DYNAMIC, true); Vector3 direction = aimTransform.forward * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f); if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { DamageTool.damage(targetPlayer, EDeathCause.SENTRY, ELimb.SPINE, __instance.owner, direction, (IDamageMultiplier)((ItemWeaponAsset)displayAsset).playerDamageMultiplier, times, true, out kill, true, ERagdollEffect.NONE); } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { IDamageMultiplier damageMultiplier = ((ItemWeaponAsset)displayAsset).zombieOrPlayerDamageMultiplier; DamageZombieParameters parameters = DamageZombieParameters.make(targetZombie, direction, damageMultiplier, ELimb.SPINE); parameters.times = times; parameters.legacyArmor = true; parameters.instigator = (object)__instance; DamageTool.damageZombie(parameters, out kill, out xp); } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { IDamageMultiplier damageMultiplier = ((ItemWeaponAsset)displayAsset).animalOrPlayerDamageMultiplier; DamageAnimalParameters parameters = DamageAnimalParameters.make(targetAnimal, direction, damageMultiplier, ELimb.SPINE); parameters.times = times; parameters.instigator = (object)__instance; DamageTool.damageAnimal(parameters, out kill, out xp); } } } } __instance.rebuildState(); } } return(false); }
private void Update() { if (Provider.isServer && this.power != null && this.power.isWired) { Vector3 vector = base.transform.position + new Vector3(0f, 0.65f, 0f); if (Time.realtimeSinceStartup - this.lastScan > 0.1f) { this.lastScan = Time.realtimeSinceStartup; float num = 48f; if (this.hasWeapon) { num = Mathf.Min(num, ((ItemWeaponAsset)this.displayAsset).range); } float num2 = num * num; float num3 = num2; Player player = null; Zombie zombie = null; if (Provider.isPvP) { InteractableSentry.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(vector, num2, InteractableSentry.playersInRadius); for (int i = 0; i < InteractableSentry.playersInRadius.Count; i++) { Player player2 = InteractableSentry.playersInRadius[i]; if (!(player2.channel.owner.playerID.steamID == base.owner) && !player2.quests.isMemberOfGroup(base.group)) { if (!player2.life.isDead && player2.animator.gesture != EPlayerGesture.ARREST_START) { if ((!player2.movement.isSafe || !player2.movement.isSafeInfo.noWeapons) && player2.movement.canAddSimulationResultsToUpdates) { if (!(player != null) || player2.animator.gesture != EPlayerGesture.SURRENDER_START) { if (this.sentryMode != ESentryMode.FRIENDLY || Time.realtimeSinceStartup - player2.equipment.lastPunching <= 2f || (player2.equipment.isSelected && player2.equipment.asset != null && player2.equipment.asset.isDangerous)) { float sqrMagnitude = (player2.look.aim.position - vector).sqrMagnitude; if (sqrMagnitude <= num3) { Vector3 vector2 = player2.look.aim.position - vector; float magnitude = vector2.magnitude; Vector3 vector3 = vector2 / magnitude; if (!(player2 != this.targetPlayer) || Vector3.Dot(vector3, this.aimTransform.forward) >= 0.5f) { if (magnitude > 0.025f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(vector, vector3), out raycastHit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } PhysicsUtility.raycast(new Ray(vector + vector3 * (magnitude - 0.025f), -vector3), out raycastHit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } } num3 = sqrMagnitude; player = player2; } } } } } } } IL_35F :; } } InteractableSentry.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(vector, num2, InteractableSentry.zombiesInRadius); for (int j = 0; j < InteractableSentry.zombiesInRadius.Count; j++) { Zombie zombie2 = InteractableSentry.zombiesInRadius[j]; if (!zombie2.isDead && zombie2.isHunting) { Vector3 vector4 = zombie2.transform.position; switch (zombie2.speciality) { case EZombieSpeciality.NORMAL: vector4 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector4 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector4 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector4 += new Vector3(0f, 1f, 0f); break; } float sqrMagnitude2 = (vector4 - vector).sqrMagnitude; if (sqrMagnitude2 <= num3) { Vector3 vector5 = vector4 - vector; float magnitude2 = vector5.magnitude; Vector3 vector6 = vector5 / magnitude2; if (!(zombie2 != this.targetZombie) || Vector3.Dot(vector6, this.aimTransform.forward) >= 0.5f) { if (magnitude2 > 0.025f) { RaycastHit raycastHit2; PhysicsUtility.raycast(new Ray(vector, vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } PhysicsUtility.raycast(new Ray(vector + vector6 * (magnitude2 - 0.025f), -vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } } num3 = sqrMagnitude2; player = null; zombie = zombie2; } } } IL_5B4 :; } if (player != this.targetPlayer || zombie != this.targetZombie) { this.targetPlayer = player; this.targetZombie = zombie; this.lastFire = Time.realtimeSinceStartup + 0.1f; } } if (this.targetPlayer != null) { ESentryMode esentryMode = this.sentryMode; if (esentryMode != ESentryMode.FRIENDLY && esentryMode != ESentryMode.NEUTRAL) { if (esentryMode == ESentryMode.HOSTILE) { this.isFiring = true; } } else { this.isFiring = (this.targetPlayer.animator.gesture != EPlayerGesture.SURRENDER_START); } this.isAiming = true; } else if (this.targetZombie != null) { this.isFiring = true; this.isAiming = true; } else { this.isFiring = false; this.isAiming = false; } if (this.isAiming && Time.realtimeSinceStartup - this.lastAim > Provider.UPDATE_TIME) { this.lastAim = Time.realtimeSinceStartup; Transform transform = null; Vector3 vector7 = Vector3.zero; if (this.targetPlayer != null) { transform = this.targetPlayer.transform; vector7 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { transform = this.targetZombie.transform; vector7 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector7 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector7 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector7 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector7 += new Vector3(0f, 1f, 0f); break; } } if (transform != null) { float num4 = Mathf.Atan2(vector7.x - vector.x, vector7.z - vector.z) * 57.29578f; float num5 = Mathf.Sin((vector7.y - vector.y) / (vector7 - vector).magnitude) * 57.29578f; BarricadeManager.sendAlertSentry(base.transform, num4, num5); } } if (this.isFiring && this.hasWeapon && this.displayItem.state[10] > 0 && !this.isOpen && Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire += this.fireTime; if (Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire = Time.realtimeSinceStartup; } float num6 = (float)this.displayItem.quality / 100f; if (this.attachments.magazineAsset == null) { return; } byte[] state = this.displayItem.state; int num7 = 10; state[num7] -= 1; if (this.attachments.barrelAsset == null || !this.attachments.barrelAsset.isSilenced || this.displayItem.state[16] == 0) { AlertTool.alert(base.transform.position, 48f); } if (Provider.modeConfigData.Items.Has_Durability && this.displayItem.quality > 0 && Random.value < ((ItemWeaponAsset)this.displayAsset).durability) { if (this.displayItem.quality > ((ItemWeaponAsset)this.displayAsset).wear) { Item displayItem = this.displayItem; displayItem.quality -= ((ItemWeaponAsset)this.displayAsset).wear; } else { this.displayItem.quality = 0; } } float num8 = ((ItemGunAsset)this.displayAsset).spreadAim * ((num6 >= 0.5f) ? 1f : (1f + (1f - num6 * 2f))); if (this.attachments.tacticalAsset != null && this.interact) { num8 *= this.attachments.tacticalAsset.spread; } if (this.attachments.gripAsset != null) { num8 *= this.attachments.gripAsset.spread; } if (this.attachments.barrelAsset != null) { num8 *= this.attachments.barrelAsset.spread; } if (this.attachments.magazineAsset != null) { num8 *= this.attachments.magazineAsset.spread; } if (((ItemGunAsset)this.displayAsset).projectile == null) { BarricadeManager.sendShootSentry(base.transform); byte pellets = this.attachments.magazineAsset.pellets; for (byte b = 0; b < pellets; b += 1) { EPlayerKill eplayerKill = EPlayerKill.NONE; uint num9 = 0u; float num10 = 1f; num10 *= ((num6 >= 0.5f) ? 1f : (0.5f + num6)); Transform transform2; float magnitude3; if (this.targetPlayer != null) { transform2 = this.targetPlayer.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } else { transform2 = this.targetZombie.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } float num11 = magnitude3 / ((ItemWeaponAsset)this.displayAsset).range; num11 = 1f - num11; num11 *= 1f - ((ItemGunAsset)this.displayAsset).spreadHip; num11 *= 0.75f; if (transform2 == null || Random.value > num11) { Vector3 vector8 = this.aimTransform.forward; vector8 += this.aimTransform.right * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8 += this.aimTransform.up * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8.Normalize(); Ray ray; ray..ctor(this.aimTransform.position, vector8); RaycastInfo raycastInfo = DamageTool.raycast(ray, ((ItemWeaponAsset)this.displayAsset).range, RayMasks.DAMAGE_SERVER); if (!(raycastInfo.transform == null)) { DamageTool.impact(raycastInfo.point, raycastInfo.normal, raycastInfo.material, raycastInfo.vehicle != null || raycastInfo.transform.CompareTag("Barricade") || raycastInfo.transform.CompareTag("Structure") || raycastInfo.transform.CompareTag("Resource")); if (raycastInfo.vehicle != null) { DamageTool.damage(raycastInfo.vehicle, false, Vector3.zero, false, ((ItemGunAsset)this.displayAsset).vehicleDamage, num10, true, out eplayerKill); } else if (raycastInfo.transform != null) { if (raycastInfo.transform.CompareTag("Barricade")) { ushort id; if (ushort.TryParse(raycastInfo.transform.name, out id)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id); if (itemBarricadeAsset != null && (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, ((ItemGunAsset)this.displayAsset).barricadeDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Structure")) { ushort id2; if (ushort.TryParse(raycastInfo.transform.name, out id2)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2); if (itemStructureAsset != null && (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).structureDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Resource")) { byte x; byte y; ushort index; if (ResourceManager.tryGetRegion(raycastInfo.transform, out x, out y, out index)) { ResourceSpawnpoint resourceSpawnpoint = ResourceManager.getResourceSpawnpoint(x, y, index); if (resourceSpawnpoint != null && !resourceSpawnpoint.isDead && resourceSpawnpoint.asset.bladeID == ((ItemWeaponAsset)this.displayAsset).bladeID) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).resourceDamage, num10, 1f, out eplayerKill, out num9); } } } else if (raycastInfo.section < 255) { InteractableObjectRubble component = raycastInfo.transform.GetComponent <InteractableObjectRubble>(); if (component != null && !component.isSectionDead(raycastInfo.section) && (component.asset.rubbleIsVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction, raycastInfo.section, ((ItemGunAsset)this.displayAsset).objectDamage, num10, out eplayerKill, out num9); } } } } } else { Vector3 vector9 = Vector3.zero; if (this.targetPlayer != null) { vector9 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { vector9 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector9 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector9 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector9 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector9 += new Vector3(0f, 1f, 0f); break; } } DamageTool.impact(vector9, -this.aimTransform.forward, EPhysicsMaterial.FLESH_DYNAMIC, true); if (this.targetPlayer != null) { DamageTool.damage(this.targetPlayer, EDeathCause.SENTRY, ELimb.SPINE, base.owner, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).playerDamageMultiplier, num10, true, out eplayerKill); } else if (this.targetZombie != null) { DamageTool.damage(this.targetZombie, ELimb.SPINE, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).zombieDamageMultiplier, num10, true, out eplayerKill, out num9); } } } } base.rebuildState(); } } bool flag = Time.realtimeSinceStartup - this.lastAlert < 1f; if (flag != this.isAlert) { this.isAlert = flag; if (!Dedicator.isDedicated) { if (this.isAlert) { EffectManager.effect(92, base.transform.position, Vector3.up); } else { EffectManager.effect(93, base.transform.position, Vector3.up); } } if (!this.isAlert) { this.targetYaw = base.transform.localRotation.eulerAngles.y; } } if (this.power != null) { if (this.power.isWired) { if (this.isAlert) { this.lastDrift = Time.realtimeSinceStartup; this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw, 4f * Time.deltaTime); } else { this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw + Mathf.Sin(Time.realtimeSinceStartup - this.lastDrift) * 60f, 4f * Time.deltaTime); } this.pitch = Mathf.LerpAngle(this.pitch, this.targetPitch, 4f * Time.deltaTime); this.yawTransform.rotation = Quaternion.Euler(-90f, 0f, this.yaw); this.pitchTransform.localRotation = Quaternion.Euler(0f, -90f, this.pitch); } if (!Dedicator.isDedicated) { if (this.onGameObject != null) { this.onGameObject.SetActive(this.isAlert && this.power.isWired); } if (this.onModelGameObject != null) { this.onModelGameObject.SetActive(this.isAlert); if (this.onMaterial != null) { this.onMaterial.SetColor("_EmissionColor", (!this.isAlert || !this.power.isWired) ? Color.black : this.onMaterial.color); } } if (this.offGameObject != null) { this.offGameObject.SetActive(!this.isAlert && this.power.isWired); } if (this.offModelGameObject != null) { this.offModelGameObject.SetActive(!this.isAlert); if (this.offMaterial != null) { this.offMaterial.SetColor("_EmissionColor", (this.isAlert || !this.power.isWired) ? Color.black : this.offMaterial.color); } } if ((double)(Time.realtimeSinceStartup - this.lastShot) > 0.05 && this.muzzleEmitter != null) { this.muzzleEmitter.GetComponent <Light>().enabled = false; } } } }
// Update is called once per frame void Update() { if (Vector3.Distance(originalLocation, this.transform.position) > maxRange) { Destroy(this.gameObject); } if (Vector3.Distance(originalLocation, this.transform.position) > 50) { trailRenderer.enabled = true; } else { trailRenderer.enabled = false; } if (Vector3.Distance(originalLocation, this.transform.position) > damageRange) { damage = (int)(damage * damageDropoff); } Vector3 point1 = this.transform.position; float stepSize = 1.0f / predictionStepsPerFrame; for (float step = 0; step < 1; step += stepSize) { bulletVelocity += Physics.gravity * stepSize * Time.deltaTime; Vector3 point2 = point1 + bulletVelocity * stepSize * Time.deltaTime; Ray ray = new Ray(point1, point2 - point1); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, (point2 - point1).magnitude)) { if (hitInfo.collider.tag == "Environment") { print(hitInfo.collider.material.name.Replace(" (Instance)", "")); Transform bullethole = Instantiate(bulletHolePrefabs[Random.Range(0, bulletHolePrefabs.Length)], hitInfo.point, Quaternion.LookRotation(hitInfo.normal)); bullethole.GetComponentInChildren <Renderer>().material = Resources.Load <Material>("Bulletholes/Materials/" + hitInfo.collider.material.name.Replace(" (Instance)", "")); } if (hitInfo.collider.gameObject.layer == 7) { Transform marker = Instantiate(Resources.Load <Transform>("Hitmarker"), GameObject.FindGameObjectWithTag("Center").transform.position, Resources.Load <Transform>("Hitmarker").rotation, GameObject.FindGameObjectWithTag("Canvas").transform); print(hitInfo.collider.material.name.Replace(" (Instance)", "")); PlayerManager _pm = hitInfo.collider.gameObject.GetComponent <PlayerManager>(); if (_pm.Damage(damage, damageMultiplier, hitInfo.collider.material.name.Replace(" (Instance)", "")) == true) { for (int i = 0; i < marker.GetComponentsInChildren <Image>().Length; i++) { marker.GetComponentsInChildren <Image>()[i].color = Color.red; } } } if (hitInfo.collider.gameObject.layer == 8) { Transform marker = Instantiate(Resources.Load <Transform>("Hitmarker"), GameObject.FindGameObjectWithTag("Center").transform.position, Resources.Load <Transform>("Hitmarker").rotation, GameObject.FindGameObjectWithTag("Canvas").transform); print(hitInfo.collider.material.name.Replace(" (Instance)", "")); ZombieManager _pm = hitInfo.collider.gameObject.GetComponent <ZombieManager>(); if (_pm.Damage(damage, damageMultiplier, hitInfo.collider.material.name.Replace(" (Instance)", "")) == true) { for (int i = 0; i < marker.GetComponentsInChildren <Image>().Length; i++) { marker.GetComponentsInChildren <Image>()[i].color = Color.red; } } } Destroy(this.gameObject); } point1 = point2; this.transform.position = point1; } }
public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry) { string animation = entry.GetArgument(queue, 1).ToUpperInvariant(); EntityTag entity = EntityTag.For(entry.GetArgumentObject(queue, 0)); if (entity == null) { queue.HandleError(entry, "Invalid entity!"); return; } PlayerTag player; if (entity.TryGetPlayer(out player)) { try { player.Internal.player.animator.sendGesture((EPlayerGesture)Enum.Parse(typeof(EPlayerGesture), animation), true); //player.Internal.player.animator.askGesture(player.Internal.playerID.steamID, (byte)((EPlayerGesture)Enum.Parse(typeof(EPlayerGesture), animation))); } catch (ArgumentException) { queue.HandleError(entry, "Invalid animation specified!"); return; } if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Animated a player!"); } return; } ZombieTag zombie; if (entity.TryGetZombie(out zombie)) { int ind = animation.IndexOf('_'); string after = animation.Substring(ind + 1); animation = animation.Substring(0, ind); if (animation == "STARTLE") { ZombieManager.sendZombieStartle(zombie.Internal, (byte)IntegerTag.TryFor(after).Internal); } else if (animation == "STUN") { ZombieManager.sendZombieStun(zombie.Internal, (byte)IntegerTag.TryFor(after).Internal); } else if (animation == "ATTACK") { ZombieManager.sendZombieAttack(zombie.Internal, (byte)IntegerTag.TryFor(after).Internal); } else { queue.HandleError(entry, "Invalid animation specified!"); return; } if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Animated an animal!"); } return; } AnimalTag animal; if (entity.TryGetAnimal(out animal)) { if (animation == "STARTLE") { AnimalManager.sendAnimalStartle(animal.Internal); } else if (animation == "PANIC") { AnimalManager.sendAnimalPanic(animal.Internal); } else if (animation == "ATTACK") { AnimalManager.sendAnimalAttack(animal.Internal); } else { queue.HandleError(entry, "Invalid animation specified!"); return; } if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Animated an animal!"); } return; } queue.HandleError(entry, "That entity can't be animated!"); }
void Start() { zombManager = GameObject.Find("ZombieManager").GetComponent <ZombieManager>(); isActivated = false; }
public static void StartUpServer() { GameServer.Managers.PacketManager.setup(); if (_RunningServer) { return; } _RunningServer = true; DateTime Start = DateTime.Now; Log.AppendText(""); Log.AppendText("WarRocK GameServer started!"); LookupModule = new LookupService("GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE); Log.AppendText("GeoIP module initialized."); DB.runQuery("UPDATE users SET online='0'"); Log.AppendText("All accounts have been set offline"); _ServerThread = new Thread(new ThreadStart(Structure.serverLoop)); _ServerThread.Priority = ThreadPriority.BelowNormal; _ServerThread.Start(); _CommandThread = new Thread(new ThreadStart(Structure.commandLoop)); _CommandThread.Priority = ThreadPriority.BelowNormal; _CommandThread.Start(); //ItemManager.InitializeHexTable(); Log.WriteBlank(); ClanManager.Load(); GameServer.Managers.BanManager.load(); UserManager.setup(); RoomManager.setup(); virtualMapData.Load(); EventManager.Load(); NoticeManager.load(); MapVehicleSeats.Load(); VehicleManager.Load(); WordManager.Load(); //VehicleManagers2.Load(); MapVehicles.Load(); ZombieManager.Load(); Thread EventThread = new Thread(Event); EventThread.Priority = ThreadPriority.AboveNormal; EventThread.Start(); Thread LoginEventThread = new Thread(LoginEventCheckLoop); LoginEventThread.Priority = ThreadPriority.AboveNormal; LoginEventThread.Start(); Thread CouponCheckThread = new Thread(CheckCouponLoop); CouponCheckThread.Priority = ThreadPriority.AboveNormal; CouponCheckThread.Start(); //MapManager.load(); DateTime current = DateTime.Now; long StartTime = long.Parse(String.Format("{0:yyMMdd}", current)); BootTime = Convert.ToInt32(StartTime.ToString()); FormCalling.frm1.AppendColorLabelBox2(""); FormCalling.frm1.AppendLabelBox2("Started"); TimeSpan bootTime = DateTime.Now - Start; Log.AppendText("Emulator has booted in " + bootTime.TotalMilliseconds + " milliseconds.."); Log.WriteBlank(); if (GameServer.NetworkSocket.openSocket(5340, 999999999) == false) { return; } GC.Collect(); }