// Update is called once per frame void Update() { if (Input.GetButtonDown("Fire1")) { m_Client.Attack(); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.UpArrow)) { player_.Jump(); } if (Input.GetMouseButton(0)) { tap_seconds_ += Time.deltaTime; } else { // タップを離した時間が一定以下なら攻撃 if (tap_seconds_ > 0 && tap_seconds_ < attack_judgs_econds_) { player_.Attack(); } tap_seconds_ = 0.0f; } if (tap_seconds_ > attack_judgs_econds_ && floatingJoystick_.Horizontal < 0) { player_.MoveBack(); } if (tap_seconds_ > attack_judgs_econds_ && floatingJoystick_.Horizontal > 0) { player_.MoveFront(); } if (tap_seconds_ > attack_judgs_econds_ && floatingJoystick_.Vertical > 0.5) { player_.Jump(); } }
private void Attack(CharacterBase attacker, CharacterBase defender) { int dmg = attacker.Attack(() => { // if both units are still alive, set next state if (attacker.healthSystem.health > 0 && defender.healthSystem.health > 0) { battleState = battleState == BattleStates.PlayerAttack ? BattleStates.EnemyTurn : BattleStates.PlayerTurn; } }); defender.healthSystem.Damage(dmg); if (defender.healthSystem.health <= 0) { battleState = battleState == BattleStates.PlayerAttack ? BattleStates.EnemyDead : BattleStates.PlayerDead; } }
protected void Attack() { character_.Attack(); }