2024-01-02 21:39:53 +00:00
|
|
|
// using Sirenix.OdinInspector;
|
|
|
|
// using UnityEngine;
|
|
|
|
//
|
|
|
|
// // ReSharper disable once CheckNamespace
|
|
|
|
// namespace BlueWaterProject
|
|
|
|
// {
|
|
|
|
// [SelectionBase]
|
|
|
|
// public class HouseInfo : MonoBehaviour, IDamageable
|
|
|
|
// {
|
|
|
|
// #region Property and variable
|
|
|
|
//
|
|
|
|
// [SerializeField] private IslandInfo islandInfo;
|
|
|
|
//
|
|
|
|
// [SerializeField] private float maxHp = 500f;
|
|
|
|
//
|
|
|
|
// [DisableIf("@true")]
|
|
|
|
// [SerializeField] private float currentHp;
|
|
|
|
//
|
|
|
|
// #endregion
|
|
|
|
//
|
|
|
|
// #region Unity built-in function
|
|
|
|
//
|
|
|
|
// private void Awake()
|
|
|
|
// {
|
|
|
|
// SetCurrentHp(maxHp);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// private void OnDisable()
|
|
|
|
// {
|
|
|
|
// RemoveIslandInfo();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// #endregion
|
|
|
|
//
|
|
|
|
// #region Interface property and function
|
|
|
|
//
|
|
|
|
// public void TakeDamage(float attackerPower, Vector3? attackPos = null)
|
|
|
|
// {
|
|
|
|
// var changeHp = Mathf.Max(currentHp - attackerPower, 0);
|
|
|
|
// SetCurrentHp(changeHp);
|
|
|
|
//
|
|
|
|
// // 건물 파괴
|
|
|
|
// if (changeHp == 0f)
|
|
|
|
// {
|
|
|
|
// Die();
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public void Die()
|
|
|
|
// {
|
|
|
|
// Destroy(gameObject);
|
|
|
|
// RemoveIslandInfo();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// #endregion
|
|
|
|
//
|
|
|
|
// #region Custom function
|
|
|
|
//
|
|
|
|
// private void RemoveIslandInfo()
|
|
|
|
// {
|
|
|
|
// if (islandInfo == null) return;
|
|
|
|
//
|
|
|
|
// islandInfo.RemoveListElement(islandInfo.HouseList, transform);
|
|
|
|
// islandInfo.RemoveListElement(islandInfo.TargetAllList, transform);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public float GetCurrentHp() => currentHp;
|
|
|
|
// public void SetCurrentHp(float value) => currentHp = value;
|
|
|
|
// public void SetIslandInfo(IslandInfo island) => islandInfo = island;
|
|
|
|
//
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
// }
|