//Run when the program is unloaded or closed public override void Exit() { //Set up the camera follow for hte player CameraEvent cei = new CameraEvent(); //cei.target = (Node2D)player.GetParent().GetParent().GetParent(); cei.target = GetNode <Node2D>("../../../Main"); cei.FireEvent(); //Call program event and pass along the movement data to the run state SendProgramEvent pei = new SendProgramEvent(); pei.leftInputTimer = leftInputTimer; pei.rightInputTimer = rightInputTimer; pei.upInputTimer = upInputTimer; pei.downInputTimer = downInputTimer; pei.lmbInputTimer = lmbInputTimer; pei.rmbInputTimer = rmbInputTimer; pei.mousePosTimer = mousePosTimer; pei.FireEvent(); //Hide the programing map displayMap.Visible = false; //Unregister the keyboard and mouse position input methods InputCallbackEvent.UnregisterListener(GrabInput); MouseInputCallbackEvent.UnregisterListener(GrabMouseInput); }
private void StoreProgram(SendProgramEvent spei) { leftInputTimer = spei.leftInputTimer; rightInputTimer = spei.rightInputTimer; upInputTimer = spei.upInputTimer; downInputTimer = spei.downInputTimer; lmbInputTimer = spei.lmbInputTimer; rmbInputTimer = spei.rmbInputTimer; mousePosTimer = spei.mousePosTimer; }
public override void _Ready() { //Referencing all the displays in the UI node for later use menu = GetNode <VBoxContainer>("Menu"); wait = GetNode <VBoxContainer>("Wait"); programming = GetNode <Node2D>("Programming"); run = GetNode <Node2D>("Run"); win = GetNode <Node2D>("Win"); lose = GetNode <Node2D>("Lose"); SendUIEvent.RegisterListener(ChangeState); SendProgramEvent.RegisterListener(GetProgram); }
public override void _ExitTree() { SendUIEvent.UnregisterListener(ChangeState); SendProgramEvent.UnregisterListener(GetProgram); }
private void GetProgram(SendProgramEvent pei) { //If a program has been recorded then the disable button wil become enables, this is to prevent errors treing to run an empty program GetNode <Button>("Wait/Run").Disabled = false; }
public override void Exit() { base.Exit(); SendProgramEvent.UnregisterListener(StoreProgram); GetProgramEvent.UnregisterListener(GetProgram); }
public override void Init(Node state) { base.Init(state); SendProgramEvent.RegisterListener(StoreProgram); GetProgramEvent.RegisterListener(GetProgram); }