Simple.cs
1 |
using System.Collections.Generic; |
---|---|
2 |
using System.Linq; |
3 |
|
4 |
using UnityEngine; |
5 |
using CommNet; |
6 |
|
7 |
namespace CommNetStockBug |
8 |
{ |
9 |
[KSPAddon(KSPAddon.Startup.Flight, false)] |
10 |
public class Simple : MonoBehaviour |
11 |
{ |
12 |
private bool runOnce = false; |
13 |
public void Update() |
14 |
{ |
15 |
if (CommNetNetwork.Instance == null) |
16 |
return; |
17 |
|
18 |
List<CommLink> allCommLinks = CommNetNetwork.Instance.CommNet.Links; |
19 |
|
20 |
if (allCommLinks.Count() < 1 || runOnce) |
21 |
return; |
22 |
|
23 |
for (int i = 0; i < allCommLinks.Count(); i++) |
24 |
{ |
25 |
CommLink thisLink = allCommLinks.ElementAt(i); |
26 |
double strength = thisLink.signalStrength; |
27 |
HopType type = thisLink.hopType; |
28 |
} |
29 |
|
30 |
runOnce = true; |
31 |
} |
32 |
} |
33 |
} |