-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEvaFuelManager.cs
33 lines (30 loc) · 935 Bytes
/
EvaFuelManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace EvaFuel
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, true)]
public class EvaFuelManager : MonoBehaviour
{
public void Awake()
{
GameEvents.onCrewOnEva.Add(this.onEvaStart);
GameEvents.onCrewBoardVessel.Add(this.onEvaEnd);
}
public void onEvaStart(GameEvents.FromToAction<Part, Part> data)
{
double fuel = data.from.RequestResource("MonoPropellant", 5);
if (fuel < 5)
{
data.to.RequestResource("EVA Propellant", 5 - fuel);
}
}
public void onEvaEnd(GameEvents.FromToAction<Part, Part> data)
{
double fuelleft = data.from.RequestResource("EVA Propellant", 5);
data.to.RequestResource("MonoPropellant", -fuelleft);
}
}
}