public void Release() { if (goapAgent == null || !goapAgent.IsAlive()) { follow.SetPos(new Vector3(0, 1000, 0)); } for (int i = useHpTextList.Count - 1; i >= 0; --i) { ReleaseText(useHpTextList[i]); } HpControllerPanel.instance.ReleaseHp(this); hpSlider.SetValue(1); }
public static void Damage(GoapAgent attacker, GoapAgent target, int skillID) { if (!target.IsAlive()) { return; } SkillData skillData = TableTool.GetTableDataRow <SkillData>(TableType.Skill, skillID); if (skillData == null) { return; } target.Damage(skillData.damage); }
public GoapAgent Search(GoapAgent goapAgent, CampRelations campRelations) { List <GoapAgent> monsterList = UnitManager.MonsterList; Camp selfCamp = goapAgent.Camp; GoapAgent target = null; float distance = 0; for (int i = monsterList.Count - 1; i >= 0; --i) { GoapAgent monsterAgent = monsterList[i]; if (monsterAgent == null || !monsterAgent.IsAlive()) { monsterList.RemoveAt(i); continue; } Camp camp = monsterAgent.Camp; CampRelations relations = UnitCampRelations.GetRelations(selfCamp, camp); if ((campRelations & relations) != campRelations) { continue; } if (target == null) { target = monsterAgent; distance = Vector3.Distance(goapAgent.transform.position, target.transform.position); continue; } float dis = Vector3.Distance(goapAgent.transform.position, monsterAgent.transform.position); if (dis < distance) { target = monsterAgent; distance = dis; } } return(target); }