#58 ajout d'un item package servant à déployer des machines
This commit is contained in:
@@ -40,6 +40,13 @@ func _ready():
|
||||
|
||||
#region ------------------ Generation ------------------
|
||||
|
||||
func instantiate_entity(s: PackedScene, entity_position : Vector2):
|
||||
var entity = s.instantiate() as Node2D
|
||||
|
||||
add_entity(entity)
|
||||
|
||||
entity.global_position = entity_position
|
||||
|
||||
func add_entity(e : Node2D, container : Node2D = entityContainer):
|
||||
if e.get_parent():
|
||||
e.get_parent().remove_child(e)
|
||||
@@ -49,7 +56,6 @@ func add_entity(e : Node2D, container : Node2D = entityContainer):
|
||||
|
||||
container.add_child(e)
|
||||
|
||||
|
||||
func generate_polygon_sprite(order : int = 0) -> Polygon2D:
|
||||
var sprite = Polygon2D.new()
|
||||
var size = terrainData.terrainSize
|
||||
@@ -115,6 +121,9 @@ func impact_contamination(impact_position : Vector2, impact_radius : int, contam
|
||||
if contamination_texture:
|
||||
contamination_texture.update(terrainData.contamination)
|
||||
|
||||
func is_in_zone(point : Vector2) -> bool:
|
||||
return terrainData.is_in_image(terrainData.get_pixel_point(point), terrainData.contamination)
|
||||
|
||||
func is_there_contamination(point : Vector2) -> bool:
|
||||
return terrainData.get_contamination(point) < 0.5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user