mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
39 lines
1.2 KiB
GDScript3
39 lines
1.2 KiB
GDScript3
|
extends Node
|
||
|
|
||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||
|
|
||
|
export(PackedScene) var number_scene
|
||
|
|
||
|
func damage(entity_position : Vector3, entity_height : float, value : int, crit : bool) -> void:
|
||
|
var scene : Node = number_scene.instance()
|
||
|
|
||
|
add_child(scene)
|
||
|
scene.owner = self
|
||
|
|
||
|
entity_position.y += entity_height + (0.2 * randf())
|
||
|
entity_position.x += entity_height * 0.4 - entity_height * 0.8 * randf()
|
||
|
entity_position.z += entity_height * 0.4 - entity_height * 0.8 * randf()
|
||
|
|
||
|
scene.damage(entity_position, value, crit)
|
||
|
|
||
|
func heal(entity_position : Vector3, entity_height : float, value : int, crit : bool) -> void:
|
||
|
var scene : Node = number_scene.instance()
|
||
|
|
||
|
add_child(scene)
|
||
|
scene.owner = self
|
||
|
|
||
|
randomize()
|
||
|
|
||
|
entity_position.y += entity_height + (0.3 * randf())
|
||
|
entity_position.x += entity_height * 0.4 - entity_height * 0.8 * randf()
|
||
|
entity_position.z += entity_height * 0.4 - entity_height * 0.8 * randf()
|
||
|
|
||
|
|
||
|
scene.heal(entity_position, value, crit)
|
||
|
|
||
|
func clear() -> void:
|
||
|
for child in get_children():
|
||
|
child.queue_free()
|