示例#1
0
    public override void _EnterTree()
    {
        Camera2D camera = GetNode <Camera2D>("Player/Camera2D");

        CurrentCamera.Init(camera);
        root             = this;
        WorldScreenSizeX = GetViewport().Size.x *CurrentCamera.GetXZoom();
        if (!load)
        {
            TileMap back      = GetNode("Tilemaps").GetNode <TileMap>("0");
            TileMap ground    = GetNode("Tilemaps").GetNode <TileMap>("1");
            TileMap uiground  = GetNode("Tilemaps").GetNode <TileMap>("3");
            TileMap uiground2 = GetNode("Tilemaps").GetNode <TileMap>("2");
            Building.Init(this);
            Loot.Init(this);
            Tree.Init(this);
            BuildingInterface.Init(GetNode("CanvasLayer"));
            Liquid.Init();
            World.Init(ground, uiground, uiground2, back);
            Structure.Init();
            SpaceShip.Init();
            PlayerMouvements.initialPosition = World.spawn;
            InitialiseIverntories();
        }
        else
        {
            TileMap back      = GetNode("Tilemaps").GetNode <TileMap>("0");
            TileMap ground    = GetNode("Tilemaps").GetNode <TileMap>("1");
            TileMap uiground  = GetNode("Tilemaps").GetNode <TileMap>("3");
            TileMap uiground2 = GetNode("Tilemaps").GetNode <TileMap>("2");
            Loot.Init(this);
            Tree.Init(this);
            Building.Init(this);
            BuildingInterface.Init(GetNode("CanvasLayer"));
            World.Init(ground, uiground, uiground2, back, false);
            Save._Load(saveName);
            SpaceShip.Init();
        }
    }