| | |
| | | public int WoodAimCount { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 血条的引用 |
| | | /// </summary> |
| | | public AgentBlood BloodBar { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 更新怪物的移动速度。 |
| | | /// </summary> |
| | | /// <param name="fscale"></param> |
| | |
| | | /// <param name="coinDrop"></param> 设置当前小怪的金币掉落数据 |
| | | public void SetAgentData(float health, float moveSpeed = -1, int coinDrop = 0) |
| | | { |
| | | SpawnBlood(); |
| | | BloodBar.SetCurrentBlood(1f, false); |
| | | configuration.maxHealth = health; |
| | | configuration.startingHealth = health; |
| | | configuration.SetMaxHealth(health); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成血条 |
| | | /// </summary> |
| | | /// <param name="agent"></param> |
| | | private void SpawnBlood() |
| | | { |
| | | if (BloodBar == null) |
| | | { |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/AgentBlood"); |
| | | GameObject obj = Instantiate(prefab); |
| | | BloodBar = obj.GetComponent<AgentBlood>(); |
| | | GameObject bloodUI = GameObject.Find("MainUI/BloodUI"); |
| | | obj.transform.SetParent(bloodUI.transform, false); |
| | | AgentBlood agentBlood = obj.GetComponent<AgentBlood>(); |
| | | agentBlood.Target = this; |
| | | |
| | | configuration.died += agentBlood.OnDied; |
| | | configuration.healthChanged += agentBlood.OnHealthChanged; |
| | | } |
| | | BloodBar.Hide(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Checks if the path is blocked |
| | | /// </summary> |
| | | /// <value> |