source: binary-improvements/7dtd-server-fixes/src/LiveData/Hostiles.cs@ 311

Last change on this file since 311 was 306, checked in by alloc, 7 years ago

Fixes update A16.2

File size: 975 bytes
RevLine 
[306]1using System;
2using System.Collections.Generic;
3
4namespace AllocsFixes.LiveData
5{
6 public class Hostiles
7 {
8 public static void Get (List<EntityEnemy> _list) {
9 _list.Clear ();
10 try {
11 List<Entity> entities = GameManager.Instance.World.Entities.list;
12 for (int i = 0; i < entities.Count; i++) {
13 Entity entity = entities [i];
14
15 if (entity is EntityEnemy) {
16 if (entity.IsAlive ())
17 _list.Add (entity as EntityEnemy);
18 }
19 }
20 }
21 catch (Exception e) {
22 Log.Exception (e);
23 }
24 }
25
26 public static int GetCount () {
27 int count = 0;
28 try {
29 List<Entity> entities = GameManager.Instance.World.Entities.list;
30 for (int i = 0; i < entities.Count; i++) {
31 Entity entity = entities [i];
32
33 if (entity.entityType == EntityType.Zombie) {
34 EntityEnemy ee = (EntityEnemy)entity;
35
36 if (ee.IsAlive ())
37 count++;
38 }
39 }
40 }
41 catch (Exception e) {
42 Log.Exception (e);
43 }
44 return count;
45 }
46 }
47}
48
Note: See TracBrowser for help on using the repository browser.