public override bool WorthProcessing(Driven.PanelInputs inputs) { //TODO: Make these more complex (like providing opposite input is faster to stop than just letting go). //TODO: Cause self-damage if you reverse while still going full on an axis. float leftAxis = inputs.topLeft - inputs.bottomLeft; float rightAxis = inputs.topRight - inputs.bottomRight; return(!(Mathf.Approximately(leftAxis, leftThrottle) && Mathf.Approximately(rightAxis, rightThrottle))); }
// Update is called once per frame void Update() { if (!isLocalPlayer) { return; } Driven.PanelInputs[] inputs = new Driven.PanelInputs[] { new Driven.PanelInputs(Input.GetAxis("1 Top Left"), Input.GetAxis("1 Top"), Input.GetAxis("1 Top Right"), Input.GetAxis("1 Left"), Input.GetAxis("1 Middle"), Input.GetAxis("1 Right"), Input.GetAxis("1 Bottom Left"), Input.GetAxis("1 Bottom"), Input.GetAxis("1 Bottom Right")) }; List <Module> modules = mech.ModulesForPilot(crewPosition); for (int i = 0; i < modules.Count; i++) { if (modules[i] && modules[i].WorthProcessing(inputs[i])) { CmdSendInputs(inputs); } } }
public abstract void ProcessInputs(Driven.PanelInputs inputs);
public abstract bool WorthProcessing(Driven.PanelInputs inputs);
public override void ProcessInputs(Driven.PanelInputs inputs) { leftThrottle = inputs.topLeft - inputs.bottomLeft; rightThrottle = inputs.topRight - inputs.bottomRight; }