public void DirectAttack() { /* * //アニメーション * var targetAnimator = currentTarget.GetComponent<Animator>(); * targetAnimator.SetTrigger("Damage"); */ var damage = 0; // 攻撃相手のStatus if (targetCharacterStatus as AllyStatus != null) { var castedTargetStatus = (AllyStatus)targetCharacterBattleScript.GetCharacterStatus(); // 攻撃相手の通常の防御力+相手のキャラの補助値 var targetDefencePower = castedTargetStatus.GetStrikingStrength() + (castedTargetStatus.GetEquipArmor()?.GetAmount() ?? 0) + targetCharacterBattleScript.GetAuxiliaryStrikingStrength(); damage = Mathf.Max(0, (int)(((characterStatus.GetPower() + auxiliaryPower) - targetDefencePower) * guardPercentage)); // 相手のステータスのHPをセット targetCharacterBattleScript.SetHp(targetCharacterBattleScript.GetHp() - damage); // ステータスUIを更新 battleStatusScript.UpdateStatus(targetCharacterStatus, BattleStatusScript.Status.HP, targetCharacterBattleScript.GetHp()); } else if (targetCharacterStatus as EnemyStatus != null) { var castedTargetStatus = (EnemyStatus)targetCharacterBattleScript.GetCharacterStatus(); // 攻撃相手の通常の防御力+相手のキャラの補助値 var targetDefencePower = castedTargetStatus.GetStrikingStrength() + targetCharacterBattleScript.GetAuxiliaryStrikingStrength(); damage = Mathf.Max(0, (characterStatus.GetPower() + (((AllyStatus)characterStatus).GetEquipWeapon()?.GetAmount() ?? 0) + auxiliaryPower) - targetDefencePower); // 敵のステータスのHPをセット targetCharacterBattleScript.SetHp(targetCharacterBattleScript.GetHp() - damage); } else { Debug.LogError("直接攻撃でターゲットが設定されていない"); } battleManager.ShowMessage(gameObject.name + "は" + currentTarget.name + "に" + currentSkill.GetKanjiName() + "をして" + damage + "を与えた。"); }