예제 #1
0
    //Run when the recording starts up
    public override void Init()
    {
        //Regestrations for the events needed for the scene ===========================================================
        InputCallbackEvent.RegisterListener(GrabInput);
        MouseInputCallbackEvent.RegisterListener(GrabMouseInput);
        //=============================================================================================================
        //Preload the scenes for the state to be used =================================================================
        //Load the map resource scene and instance it as a child of the GameProgramState node
        mapScene = ResourceLoader.Load("res://Scenes/Map.tscn") as PackedScene;
        map      = mapScene.Instance();
        AddChild(map);
        TileMap RealMap = GetNode <TileMap>("Map/RealMap");

        RealMap.QueueFree();
        displayMap         = GetNode <TileMap>("Map/ProgramMap");
        displayMap.Visible = true;
        playerScene        = ResourceLoader.Load("res://Scenes/Player.tscn") as PackedScene;
        //=============================================================================================================
        //Set the ui state to the programming hud =====================================================================
        SendUIEvent suiei = new SendUIEvent();

        suiei.uiState = UIState.PROGRAMMING_HUD;
        suiei.FireEvent();
        //=============================================================================================================
        //Grab the time the program started recording the time for hte user input
        timerStarted = OS.GetTicksMsec();

        BuildMap();

        //Set up the camera follow for hte player
        CameraEvent cei = new CameraEvent();

        cei.target = (Node2D)player;
        cei.FireEvent();
    }
예제 #2
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     InputCallbackEvent.RegisterListener(GetInput);
     MouseInputCallbackEvent.RegisterListener(GetMousePos);
 }