open-fpsz/entities/components/projectile_spawner.gd

32 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-04-14 19:47:44 -04:00
# This file is part of open-fpsz.
#
2024-04-14 19:47:44 -04:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
2024-04-14 19:47:44 -04:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
2024-04-14 19:47:44 -04:00
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2024-05-07 14:21:10 +00:00
class_name ProjectileSpawner extends Node3D
2024-04-08 18:59:15 -07:00
2024-05-07 14:21:10 +00:00
@export_category("Projectile")
@export var PROJECTILE : PackedScene
@export_range(0., 1., .01) var inheritance : float = .5 # ratio
2024-04-08 18:59:15 -07:00
2024-05-07 14:21:10 +00:00
func new_projectile(
projectile_type : Object,
owner_velocity : Vector3,
shooter : MatchParticipantComponent
) -> Node3D:
return projectile_type.new_projectile(
self,
owner_velocity * inheritance,
shooter,
PROJECTILE
)