Пример #1
0
        public override void _Ready()
        {
            lineColor  = Color.Color8(0, 100, 0, 255);
            pathColor  = Color.Color8(0, 255, 0, 255);
            blockColor = Color.Color8(255, 255, 0, 255);
            startColor = Color.Color8(0, 0, 255, 255);
            endColor   = Color.Color8(255, 0, 0, 255);
            fWidth     = SWidth / gridSize;
            fHeight    = SHeight / gridSize;
            field      = new bool[fWidth, fHeight];

            start = new PointI[] { new PointI(1, 1), new PointI(18, 2), new PointI(37, 27), new PointI(5, 27) };
            end   = new PointI[] { new PointI(19, 14), new PointI(1, 14) };

            pathUpdater = new AsyncPathUpdater(this);
        }
Пример #2
0
        public override void _Ready()
        {
            camera = GetNode <Camera>(new NodePath("../CameraRig/Camera"));

            sceneTower  = GD.Load <PackedScene>("res://Scenes/Tiles/TestTower.tscn");
            sceneCobble = GD.Load <PackedScene>("res://Scenes/Tiles/FlatCobble.tscn");
            GridReady();

            var sceneGlowTile = GD.Load <PackedScene>("res://Scenes/Objects/TileGlow.tscn");

            glowTile = (Spatial)sceneGlowTile.Instance();
            AddChild(glowTile);

            walls       = GetNode <Spatial>("../Walls");
            walls.Scale = new Vector3(Width, 1, Height);

            endPoints         = new PointI[] { new PointI(Width - 2, Height / 2) };
            pathUpdaterGround = new AsyncPathUpdater(GetGrid(MovementLayer.Ground));
        }