Ejemplo n.º 1
0
 private void LoadResources()
 {
     //Regestir for the event callback for the placing of the rooms
     PlaceExitEvent.RegisterListener(InitExitWall);
     //Init he raycasts of the room walls used for creating the room
     roofRay  = GetNode <RayCast>("Roof/RoofRay");
     floorRay = GetNode <RayCast>("Floor/FloorRay");
     frontRay = GetNode <RayCast>("FrontWall/FrontRay");
     backRay  = GetNode <RayCast>("BackWall/BackRay");
     leftRay  = GetNode <RayCast>("LeftWall/LeftRay");
     rightRay = GetNode <RayCast>("RightWall/RightRay");
     //Get the reference to the walls
     frontWall = GetNode <KinematicBody>("FrontWall");
     backWall  = GetNode <KinematicBody>("BackWall");
     leftWall  = GetNode <KinematicBody>("LeftWall");
     rightWall = GetNode <KinematicBody>("RightWall");
     roofWall  = GetNode <KinematicBody>("Roof");
     floorWall = GetNode <KinematicBody>("Floor");
     //Get the refferences to the platform sets
     platformSet1Scene = ResourceLoader.Load("res://Scenes/PlatformSet1.tscn") as PackedScene;
     platformSet2Scene = ResourceLoader.Load("res://Scenes/PlatformSet2.tscn") as PackedScene;
     platformSet3Scene = ResourceLoader.Load("res://Scenes/PlatformSet3.tscn") as PackedScene;
     platformSet4Scene = ResourceLoader.Load("res://Scenes/PlatformSet4.tscn") as PackedScene;
     platformSet5Scene = ResourceLoader.Load("res://Scenes/PlatformSet5.tscn") as PackedScene;
     platformSet6Scene = ResourceLoader.Load("res://Scenes/PlatformSet6.tscn") as PackedScene;
     platformSet7Scene = ResourceLoader.Load("res://Scenes/PlatformSet7.tscn") as PackedScene;
     //Grab the reference to the exit walls scene
     exitWallScene = ResourceLoader.Load("res://Scenes/ExitWall.tscn") as PackedScene;
 }
Ejemplo n.º 2
0
 private void InitExitWall(PlaceExitEvent peei)
 {
     //Where the exit needs to go
     PlaceExitWall(peei.newLocation);
     //We have to do this so that if the message to place a exit is sent to the newest room that this room does not also place antother exit util the whole room is just exits
     //To bad the player will need to figure out there is no exit ;)
     exitPlaced = true;
 }
Ejemplo n.º 3
0
    private void GenerateRoom(Vector3 pos)
    {
        //Send signal to room of where the exit needs to go ==============
        PlaceExitEvent peei = new PlaceExitEvent();

        peei.newLocation = newRoomDirection;
        peei.FireEvent();
        //================================================================
        //Reseed the random number generator every time we have to place  room
        rng.Seed = OS.GetTicksMsec();
        //Instance the room and set the room spatial to it so we can edit the spawn position of the room
        room = (Spatial)roomScene.Instance();
        //Set the position of hte room
        room.Transform = new Transform(room.Transform.basis, pos);
        //Add the room to the room list
        roomList.Add(room);
        //Set the room as a child of the map builder
        AddChild(room);
    }