This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 540 | |
| 960 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Camera3D | |
| @onready var ray_cast_3d: RayCast3D = $RayCast3D | |
| @export var grid_map: GridMap | |
| @export var turret_manager: Node3D | |
| @export var turret_cost := 100 | |
| @onready var bank := get_tree().get_first_node_in_group("Bank") | |
| # Called every frame. 'delta' is the elapsed time since the previous frame. | |
| func _process(delta: float) -> void: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.InputSystem; | |
| public class BallHandler : MonoBehaviour | |
| { | |
| private Camera mainCamera; | |
| // Start is called once before the first execution of Update after the MonoBehaviour is created | |
| void Start() | |
| { | |
| mainCamera = Camera.main; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node3D | |
| @export var projectile: PackedScene | |
| @onready var turret_top: MeshInstance3D = $TurretBase/TurretTop | |
| var enemy_path: Path3D | |
| func _physics_process(delta: float) -> void: | |
| var enemy = enemy_path.get_children().back() | |
| look_at(enemy.global_position, Vector3.UP, true) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Area3D | |
| var direction := Vector3.FORWARD | |
| @export var speed := 30.0 | |
| func _physics_process(delta: float) -> void: | |
| position += direction * speed * delta | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node3D | |
| @export var projectile: PackedScene | |
| func _ready() -> void: | |
| var shot = projectile.instantiate() | |
| add_child(shot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node3D | |
| @export var turret: PackedScene | |
| # Called when the node enters the scene tree for the first time. | |
| func _ready() -> void: | |
| var new_turret = turret.instantiate() | |
| add_child(new_turret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Camera3D | |
| @onready var ray_cast_3d: RayCast3D = $RayCast3D | |
| @export var grid_map: GridMap | |
| # Called every frame. 'delta' is the elapsed time since the previous frame. | |
| func _process(delta: float) -> void: | |
| var mouse_position: Vector2 = get_viewport().get_mouse_position() | |
| ray_cast_3d.target_position = project_local_ray_normal(mouse_position) * 100.0 | |
| ray_cast_3d.force_raycast_update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var red: Color = Color.RED | |
| var white: Color = Color.WHITE | |
| var blended_color = red.lerp(white, float(current_health) / float(max_health)) | |
| label_3d.modulate = blended_color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var current_health: int: | |
| set(health_in): | |
| current_health = health_in | |
| print("health was changed") | |
| label_3d.text = str(current_health) + "/" + str(max_health) | |
| var red: Color = Color.RED | |
| var white: Color = Color.WHITE | |
| var blended_color = red.lerp(white, float(current_health) / float(max_health)) | |
| label_3d.modulate = blended_color | |
| if current_health < 1: |