mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat: 新增角色系统及基础功能实现
新增HCN、Lynx和MuyangDog三个可玩角色及其相关资源 实现角色选择界面和角色属性系统 重构玩家生成逻辑以支持角色选择 优化角色卡片UI显示效果
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
extends PlayerBase
|
||||
|
||||
func summoned(entity: SummonBase):
|
||||
entity.died.connect(func(): tryHeal(3))
|
||||
@@ -0,0 +1 @@
|
||||
uid://bevc4f6apql4t
|
||||
@@ -0,0 +1,5 @@
|
||||
extends PlayerBase
|
||||
|
||||
func register():
|
||||
super.register()
|
||||
sprintMultiplier += 3
|
||||
@@ -0,0 +1 @@
|
||||
uid://b8g0hkqvyeptg
|
||||
@@ -0,0 +1,11 @@
|
||||
extends PlayerBase
|
||||
|
||||
var parryCounter: CooldownTimer = CooldownTimer.new(5000)
|
||||
|
||||
func ai():
|
||||
super.ai()
|
||||
if parryCounter.start():
|
||||
var track = getTrackingAnchor()
|
||||
var bullet = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 400)
|
||||
if is_instance_valid(bullet):
|
||||
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(bullet.position))
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbmb572iba42l
|
||||
@@ -0,0 +1,80 @@
|
||||
extends EntityBase
|
||||
class_name PlayerBase
|
||||
|
||||
var chargeStartTime = {}
|
||||
@onready var chargeParticle: GPUParticles2D = $%chargeParticle
|
||||
|
||||
func register():
|
||||
attackCooldownMap[0] = 200
|
||||
attackCooldownMap[1] = 6000
|
||||
hit.connect(
|
||||
func(_damage: float, bullet: BulletBase, _crit: bool):
|
||||
if bullet is DogCircle:
|
||||
EffectController.create(ComponentManager.getEffect("FeatherFall"), texture.global_position).shot()
|
||||
elif bullet is FoxZhua:
|
||||
EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot()
|
||||
)
|
||||
chargeParticle.emitting = false
|
||||
|
||||
func ai():
|
||||
currentFocusedPosition = get_global_mouse_position()
|
||||
texture.play("walk")
|
||||
var direction = Vector2(
|
||||
Input.get_axis("m_left", "m_right"),
|
||||
Input.get_axis("m_up", "m_down")
|
||||
)
|
||||
move(direction)
|
||||
if direction.length() == 0:
|
||||
texture.play("idle")
|
||||
tryLaunch("attack", 0)
|
||||
tryLaunch("attack2", 1)
|
||||
tryLaunch("smallSkill", 2)
|
||||
tryLaunch("superSkill", 3)
|
||||
for i in range(3):
|
||||
tryLaunch("cardSkill%d" % i, 4 + i)
|
||||
if Input.is_action_just_pressed("sprint"):
|
||||
trySprint()
|
||||
if Input.is_action_just_pressed("heal"):
|
||||
if health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
||||
if useItem({
|
||||
ItemStore.ItemType.APPLE: 1
|
||||
}):
|
||||
tryHeal(20)
|
||||
func sprint():
|
||||
move(Vector2(
|
||||
Input.get_axis("m_left", "m_right"),
|
||||
Input.get_axis("m_up", "m_down")
|
||||
) * sprintMultiplier, true)
|
||||
|
||||
func tryLaunch(action: String, weaponIndex: int):
|
||||
if Input.is_action_just_pressed(action):
|
||||
if len(weapons) > weaponIndex:
|
||||
var weapon = weapons[weaponIndex]
|
||||
if weapon.emitType == Weapon.EmitType.CHARGE:
|
||||
if weapon.canAttackBy(self ):
|
||||
chargeStartTime[weaponIndex] = Time.get_ticks_msec()
|
||||
chargeParticle.emitting = true
|
||||
chargeParticle.speed_scale = 1
|
||||
elif weapon.emitType == Weapon.EmitType.CLICK_SHOOT || weapon.emitType == Weapon.EmitType.HOLD_LOOP:
|
||||
tryAttack(weaponIndex)
|
||||
if Input.is_action_pressed(action):
|
||||
if len(weapons) > weaponIndex:
|
||||
var weapon = weapons[weaponIndex]
|
||||
if chargeStartTime.has(weaponIndex):
|
||||
chargeParticle.speed_scale += 0.01 * self.fields.get(FieldStore.Entity.CHARGE_SPEED)
|
||||
elif weapon.emitType == Weapon.EmitType.HOLD_SHOOT || weapon.emitType == Weapon.EmitType.HOLD_LOOP:
|
||||
tryAttack(weaponIndex)
|
||||
if Input.is_action_just_released(action):
|
||||
if len(weapons) > weaponIndex:
|
||||
var weapon = weapons[weaponIndex]
|
||||
if weapon.emitType == Weapon.EmitType.CHARGE:
|
||||
if chargeStartTime.has(weaponIndex):
|
||||
var startTime = chargeStartTime[weaponIndex]
|
||||
var endTime = Time.get_ticks_msec()
|
||||
var chargedTime = endTime - startTime
|
||||
chargeStartTime.erase(weaponIndex)
|
||||
weapon.chargedTime = chargedTime * self.fields.get(FieldStore.Entity.CHARGE_SPEED)
|
||||
tryAttack(weaponIndex)
|
||||
chargeParticle.emitting = false
|
||||
elif weapon.emitType == Weapon.EmitType.HOLD_LOOP:
|
||||
weapon.exitLoop(self )
|
||||
@@ -0,0 +1 @@
|
||||
uid://r5gm7rcya35p
|
||||
@@ -76,14 +76,18 @@ func startMultiplayerGame():
|
||||
MultiplayerState.connection = multiplayer.multiplayer_peer
|
||||
WorldManager.rootNode.multiplayer.multiplayer_peer = multiplayer.multiplayer_peer
|
||||
for i in getPlayerNames():
|
||||
EntityBase.generatePlayer(i)
|
||||
EntityBase.generatePlayer(i, selectedCharacter)
|
||||
UIState.closeCurrentPanel()
|
||||
func startSingleplayerGame():
|
||||
startSingleplayerBtn.disabled = true
|
||||
MultiplayerState.isMultiplayer = false
|
||||
MultiplayerState.playerName = playerNameInput.text
|
||||
Wave.usingWaveData = GAMEMODE_MAP_WAVE[gamemodeOption.selected]
|
||||
UIState.player = EntityBase.generatePlayer(playerNameInput.text)
|
||||
var extras = ArrayTool.mergeDictionary(ArrayTool.dictionaryFromEntries(
|
||||
getCurrentSelectedCharacter().fields,
|
||||
getCurrentSelectedCharacter().fieldValues
|
||||
), OutGameStorage.upgradableFieldsValue)
|
||||
UIState.player = EntityBase.generatePlayer(playerNameInput.text, selectedCharacter, extras)
|
||||
WorldManager.rootNode.spawnWave(Vector2.ZERO)
|
||||
UIState.setPanel("CompilingTip")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user