tile-types #15
@ -1,4 +1,4 @@
 | 
			
		||||
[gd_scene load_steps=10 format=2]
 | 
			
		||||
[gd_scene load_steps=11 format=2]
 | 
			
		||||
 | 
			
		||||
[ext_resource path="res://nodes/grid.tscn" type="PackedScene" id=1]
 | 
			
		||||
[ext_resource path="res://nodes/grid_cursor.tscn" type="PackedScene" id=2]
 | 
			
		||||
@ -7,6 +7,7 @@
 | 
			
		||||
[ext_resource path="res://nodes/interaction_modes/interaction_mode.tscn" type="PackedScene" id=5]
 | 
			
		||||
[ext_resource path="res://nodes/ui/build_mode_ui.tscn" type="PackedScene" id=6]
 | 
			
		||||
[ext_resource path="res://nodes/interaction_modes/build_mode.tscn" type="PackedScene" id=7]
 | 
			
		||||
[ext_resource path="res://resources/tile_types/wild.tres" type="Resource" id=8]
 | 
			
		||||
[ext_resource path="res://nodes/ui/mode_selection_ui.tscn" type="PackedScene" id=9]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="Curve" id=1]
 | 
			
		||||
@ -19,6 +20,7 @@ _autoTick = true
 | 
			
		||||
 | 
			
		||||
[node name="Grid" parent="." instance=ExtResource( 1 )]
 | 
			
		||||
DiffusionCoefficient = 0.1
 | 
			
		||||
_startTileTypeResource = ExtResource( 8 )
 | 
			
		||||
 | 
			
		||||
[node name="Cursor" parent="." instance=ExtResource( 2 )]
 | 
			
		||||
Grid = NodePath("../Grid")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								half-earth/resources/tile_types/wild.tres
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								half-earth/resources/tile_types/wild.tres
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
[gd_resource type="Resource" load_steps=2 format=2]
 | 
			
		||||
 | 
			
		||||
[ext_resource path="res://scripts/TileType.cs" type="Script" id=1]
 | 
			
		||||
 | 
			
		||||
[resource]
 | 
			
		||||
script = ExtResource( 1 )
 | 
			
		||||
Name = "Wild"
 | 
			
		||||
BuildLabel = "[W]ild"
 | 
			
		||||
Key = 87
 | 
			
		||||
Color = Color( 0, 0.545098, 0.0196078, 1 )
 | 
			
		||||
@ -6,6 +6,10 @@ public class WorldGrid : Node2D
 | 
			
		||||
    [Export]
 | 
			
		||||
    private PackedScene TileScene { get; set; }
 | 
			
		||||
 | 
			
		||||
    [Export]
 | 
			
		||||
    private Resource _startTileTypeResource;
 | 
			
		||||
    private TileType _startTileType;
 | 
			
		||||
 | 
			
		||||
    [Export]
 | 
			
		||||
    public int Size { get; set; }
 | 
			
		||||
 | 
			
		||||
@ -21,6 +25,8 @@ public class WorldGrid : Node2D
 | 
			
		||||
    // Called when the node enters the scene tree for the first time.
 | 
			
		||||
    public override void _Ready()
 | 
			
		||||
    {
 | 
			
		||||
        _startTileType = (TileType)_startTileTypeResource;
 | 
			
		||||
 | 
			
		||||
        GenerateGrid(Size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -95,6 +101,7 @@ public class WorldGrid : Node2D
 | 
			
		||||
                var tile = new Tile();
 | 
			
		||||
                tile.isHighlighted = false;
 | 
			
		||||
                tile.value = 0.0f;
 | 
			
		||||
                tile.type = _startTileType;
 | 
			
		||||
 | 
			
		||||
                var node = TileScene.Instance<Node2D>();
 | 
			
		||||
                this.AddChild(node);
 | 
			
		||||
@ -106,6 +113,7 @@ public class WorldGrid : Node2D
 | 
			
		||||
                node.Position = position;
 | 
			
		||||
                var canvasItem = (CanvasItem)node;
 | 
			
		||||
                tile.material = (ShaderMaterial)canvasItem.Material;
 | 
			
		||||
                tile.material.SetShaderParam("lowColor", _startTileType.Color);
 | 
			
		||||
 | 
			
		||||
                _tiles[x, y] = tile;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user