mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 08:21:54 +08:00
feat(掉落物): 将物品拾取半径改为可配置属性
将硬编码的物品拾取半径改为从FieldStore中获取的可配置属性,并增加默认值60。同时调整了EntityBase中的初始物品数量配置。
This commit is contained in:
@@ -37,19 +37,21 @@ var fields = {
|
||||
FieldStore.Entity.ENERGY_MULTIPILER: 1,
|
||||
FieldStore.Entity.SAVE_ENERGY: 1,
|
||||
FieldStore.Entity.ENERGY_REGENERATION: 1,
|
||||
# 掉落物
|
||||
FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS: 60,
|
||||
}
|
||||
var attackCooldownMap = {
|
||||
0: 100
|
||||
}
|
||||
var inventory = {
|
||||
ItemStore.ItemType.BASEBALL: 100,
|
||||
ItemStore.ItemType.BASKETBALL: 100,
|
||||
ItemStore.ItemType.APPLE: 5, # 初始苹果数量
|
||||
ItemStore.ItemType.BASEBALL: 500,
|
||||
ItemStore.ItemType.BASKETBALL: 500,
|
||||
ItemStore.ItemType.APPLE: 5,
|
||||
}
|
||||
var inventoryMax = {
|
||||
ItemStore.ItemType.BASEBALL: INF, # 无限
|
||||
ItemStore.ItemType.BASKETBALL: INF,
|
||||
ItemStore.ItemType.APPLE: 5, # 最多5个苹果
|
||||
ItemStore.ItemType.APPLE: 5,
|
||||
}
|
||||
|
||||
@export var defaultCooldownUnit: float = 100
|
||||
|
||||
@@ -23,7 +23,7 @@ func _physics_process(_delta):
|
||||
var direction = (targetPlayer.position - position).normalized()
|
||||
var speed = 5000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
|
||||
apply_central_force(direction * speed)
|
||||
if position.distance_to(targetPlayer.position) < 60:
|
||||
if position.distance_to(targetPlayer.position) < targetPlayer.fields.get(FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS):
|
||||
targetPlayer.collectItem(item, stackCount)
|
||||
collect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user