точно есть дэшм
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
extends RigidBody3D
|
||||
|
||||
func hitscanHit(propulForce : float, propulDir: Vector3, propulPos : Vector3):
|
||||
var hitPos : Vector3 = propulPos - global_transform.origin#set the position to launch the object at
|
||||
if propulDir != Vector3.ZERO: apply_impulse(propulDir * propulForce, hitPos)
|
||||
|
||||
func projectileHit(propulForce : float, propulDir: Vector3):
|
||||
if propulDir != Vector3.ZERO: apply_central_force((global_transform.origin - propulDir) * propulForce)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://coyv53xc2grb0
|
||||
@@ -0,0 +1,6 @@
|
||||
extends StaticBody3D
|
||||
|
||||
@onready var parent : CharacterBody3D = $".."
|
||||
|
||||
func hitscanHit(damageVal : float, hitscanDir : Vector3, hitscanPos : Vector3):
|
||||
if parent != null: parent.hitscanHit(damageVal, hitscanDir, hitscanPos)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cnw6x7g8unlvp
|
||||
@@ -0,0 +1,34 @@
|
||||
extends Node3D
|
||||
|
||||
var shootRangeTargets : Array[CharacterBody3D] = []
|
||||
|
||||
@export_group("Keybind variables")
|
||||
@export var restartShootingRangeAction : String = ""
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
if child is ShootingRangeTarget:
|
||||
shootRangeTargets.append(child)
|
||||
|
||||
func _process(_delta : float):
|
||||
inputManagement()
|
||||
|
||||
func inputManagement():
|
||||
if Input.is_action_just_pressed(restartShootingRangeAction):
|
||||
restartShootRange()
|
||||
|
||||
func restartShootRange():
|
||||
#revive all fallen targets
|
||||
for target in range(0, shootRangeTargets.size()):
|
||||
if shootRangeTargets[target].isDisabled:
|
||||
shootRangeTargets[target].animManager.play_backwards("fall")
|
||||
shootRangeTargets[target].health = 100
|
||||
shootRangeTargets[target].isDisabled = false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://c8a2kystypxdm
|
||||
@@ -0,0 +1,40 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
class_name ShootingRangeTarget
|
||||
|
||||
@export var health : float = 100.0
|
||||
var healthRef : float
|
||||
var isDisabled : bool = false
|
||||
|
||||
@onready var animManager : AnimationPlayer = $AnimationPlayer
|
||||
|
||||
func _ready():
|
||||
healthRef = health
|
||||
animManager.play("idle")
|
||||
|
||||
func hitscanHit(damageVal : float, _hitscanDir : Vector3, _hitscanPos : Vector3):
|
||||
health -= damageVal
|
||||
|
||||
print("Hitscan hit, target health : ", health)
|
||||
|
||||
if health <= 0.0 and !isDisabled:
|
||||
isDisabled = true
|
||||
animManager.play("fall")
|
||||
|
||||
func projectileHit(damageVal : float, _hitscanDir : Vector3):
|
||||
health -= damageVal
|
||||
|
||||
print("Projectile hit, target health : ", health)
|
||||
|
||||
if health <= 0.0 and !isDisabled:
|
||||
isDisabled = true
|
||||
animManager.play("fall")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://0mu6mj41uch3
|
||||
Reference in New Issue
Block a user