예제 #1
0
    //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);
    }
예제 #2
0
 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;
 }
예제 #3
0
    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);
    }
예제 #4
0
 public override void _ExitTree()
 {
     SendUIEvent.UnregisterListener(ChangeState);
     SendProgramEvent.UnregisterListener(GetProgram);
 }
예제 #5
0
 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;
 }
예제 #6
0
 public override void Exit()
 {
     base.Exit();
     SendProgramEvent.UnregisterListener(StoreProgram);
     GetProgramEvent.UnregisterListener(GetProgram);
 }
예제 #7
0
 public override void Init(Node state)
 {
     base.Init(state);
     SendProgramEvent.RegisterListener(StoreProgram);
     GetProgramEvent.RegisterListener(GetProgram);
 }