fix: camera movement makes character blurry
This commit is contained in:
+3
-1
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://rs3hv73svbpa"]
|
[gd_scene load_steps=10 format=3 uid="uid://rs3hv73svbpa"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://4mg67crlim53" path="res://scenes/player/player.gd" id="1_o5qli"]
|
[ext_resource type="Script" uid="uid://4mg67crlim53" path="res://scenes/player/player.gd" id="1_o5qli"]
|
||||||
[ext_resource type="Script" uid="uid://ii8ai801jur2" path="res://scenes/player/camera_rig.gd" id="2_0wfyh"]
|
[ext_resource type="Script" uid="uid://ii8ai801jur2" path="res://scenes/player/camera_rig.gd" id="2_0wfyh"]
|
||||||
|
[ext_resource type="Script" uid="uid://dbb25ttlyogqr" path="res://scripts/simulation/SimulationManager.gd" id="3_sugp2"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o5qli"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o5qli"]
|
||||||
albedo_color = Color(0.16862746, 0.52156866, 0.30588236, 1)
|
albedo_color = Color(0.16862746, 0.52156866, 0.30588236, 1)
|
||||||
@@ -65,6 +66,7 @@ current = true
|
|||||||
fov = 65.0
|
fov = 65.0
|
||||||
|
|
||||||
[node name="SimulationManager" type="Node" parent="."]
|
[node name="SimulationManager" type="Node" parent="."]
|
||||||
|
script = ExtResource("3_sugp2")
|
||||||
|
|
||||||
[node name="WorldViewManager" type="Node" parent="."]
|
[node name="WorldViewManager" type="Node" parent="."]
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if target == null:
|
if target == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
class_name SimNPC
|
||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
var id: int
|
||||||
|
var npc_name: String
|
||||||
|
var profession: String
|
||||||
|
var hunger: float
|
||||||
|
var energy: float
|
||||||
|
var strength: float
|
||||||
|
var intelligence: float
|
||||||
|
var current_task: String = "idle"
|
||||||
|
|
||||||
|
func _init(
|
||||||
|
_id: int,
|
||||||
|
_npc_name: String,
|
||||||
|
_profession: String,
|
||||||
|
_strength: float,
|
||||||
|
_intelligence: float
|
||||||
|
) -> void:
|
||||||
|
id = _id
|
||||||
|
npc_name = _npc_name
|
||||||
|
profession = _profession
|
||||||
|
strength = _strength
|
||||||
|
intelligence = _intelligence
|
||||||
|
hunger = randf_range(20.0, 80.0)
|
||||||
|
energy = randf_range(40.0, 100.0)
|
||||||
|
|
||||||
|
func simulate_tick() -> void:
|
||||||
|
hunger += 5.0
|
||||||
|
energy -= 2.0
|
||||||
|
|
||||||
|
if hunger > 75.0:
|
||||||
|
current_task = "eat"
|
||||||
|
hunger -= 25.0
|
||||||
|
elif energy < 30.0:
|
||||||
|
current_task = "rest"
|
||||||
|
energy += 20.0
|
||||||
|
elif profession == "farmer":
|
||||||
|
current_task = "gather_food"
|
||||||
|
elif profession == "woodcutter":
|
||||||
|
current_task = "gather_wood"
|
||||||
|
elif profession == "guard":
|
||||||
|
current_task = "patrol"
|
||||||
|
elif profession == "scholar":
|
||||||
|
current_task = "study"
|
||||||
|
else:
|
||||||
|
current_task = "wander"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cn6lyqb2cq4en
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var npcs: Array[SimNPC] = []
|
||||||
|
var tick_interval := 1.0
|
||||||
|
var tick_timer := 0.0
|
||||||
|
var tick_count := 0
|
||||||
|
|
||||||
|
var names := [
|
||||||
|
"Rafi", "Mira", "Adem", "Nura", "Sahin",
|
||||||
|
"Lejla", "Tarik", "Hana", "Idris", "Zejd"
|
||||||
|
]
|
||||||
|
|
||||||
|
var professions := [
|
||||||
|
"farmer",
|
||||||
|
"woodcutter",
|
||||||
|
"guard",
|
||||||
|
"scholar",
|
||||||
|
"wanderer"
|
||||||
|
]
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
randomize()
|
||||||
|
generate_npcs()
|
||||||
|
print("--- Simulation started ---")
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
tick_timer += delta
|
||||||
|
|
||||||
|
if tick_timer >= tick_interval:
|
||||||
|
tick_timer -= tick_interval
|
||||||
|
simulate_tick()
|
||||||
|
|
||||||
|
func generate_npcs() -> void:
|
||||||
|
for i in range(10):
|
||||||
|
var npc := SimNPC.new(
|
||||||
|
i,
|
||||||
|
names[i],
|
||||||
|
professions.pick_random(),
|
||||||
|
randf_range(1.0, 10.0),
|
||||||
|
randf_range(1.0, 10.0)
|
||||||
|
)
|
||||||
|
|
||||||
|
npcs.append(npc)
|
||||||
|
|
||||||
|
func simulate_tick() -> void:
|
||||||
|
tick_count += 1
|
||||||
|
print("--- Tick ", tick_count, " ---")
|
||||||
|
|
||||||
|
for npc in npcs:
|
||||||
|
npc.simulate_tick()
|
||||||
|
print(
|
||||||
|
npc.npc_name,
|
||||||
|
" | ",
|
||||||
|
npc.profession,
|
||||||
|
" | task: ",
|
||||||
|
npc.current_task,
|
||||||
|
" | hunger: ",
|
||||||
|
round(npc.hunger),
|
||||||
|
" | energy: ",
|
||||||
|
round(npc.energy)
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dbb25ttlyogqr
|
||||||
Reference in New Issue
Block a user