Rev | Line | |
---|
[252] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 |
|
---|
| 4 | namespace AllocsFixes.LiveData
|
---|
| 5 | {
|
---|
| 6 | public class Animals
|
---|
| 7 | {
|
---|
[306] | 8 | public static void Get (List<EntityAnimal> _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];
|
---|
[252] | 14 |
|
---|
[307] | 15 | if (entity is EntityAnimal) {
|
---|
[306] | 16 | EntityAnimal ea = (EntityAnimal)entity;
|
---|
[252] | 17 |
|
---|
[306] | 18 | if (ea.IsAlive ())
|
---|
| 19 | _list.Add (ea);
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 | catch (Exception e) {
|
---|
| 24 | Log.Exception (e);
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
[252] | 27 |
|
---|
[306] | 28 | public static int GetCount () {
|
---|
| 29 | int count = 0;
|
---|
| 30 | try {
|
---|
| 31 | List<Entity> entities = GameManager.Instance.World.Entities.list;
|
---|
| 32 | for (int i = 0; i < entities.Count; i++) {
|
---|
| 33 | Entity entity = entities [i];
|
---|
[252] | 34 |
|
---|
[307] | 35 | if (entity is EntityAnimal) {
|
---|
[306] | 36 | EntityAnimal ea = (EntityAnimal)entity;
|
---|
[252] | 37 |
|
---|
[306] | 38 | if (ea.IsAlive ())
|
---|
| 39 | count++;
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 | catch (Exception e) {
|
---|
| 44 | Log.Exception (e);
|
---|
| 45 | }
|
---|
| 46 | return count;
|
---|
| 47 | }
|
---|
[252] | 48 |
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.