123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- namespace YLBattle
- {
- /// <summary>
- ///
- /// </summary>
- public partial class BattleManager : IBattleGlobalOper
- {
- #region 战斗对象
- /// <summary>
- /// 修改指定战斗对象位置信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <param name="x">x坐标</param>
- /// <param name="y">y坐标</param>
- public void ModifyFighterPosition(string id, float x, float y)
- {
- LogicFighter fighter = this.Env().mLogicFighterOper.FindFighter(id);
- if (null == fighter)
- {
- return;
- }
- fighter.SetProperty(EBattleProperty.POSX, x);
- fighter.SetProperty(EBattleProperty.POSY, y);
- }
- /// <summary>
- /// 获取指定对象属性
- /// </summary>
- /// <param name="id">对象实例id</param>
- /// <param name="tp">属性类型</param>
- /// <returns>属性值</returns>
- public float GetFighterProperty(string id, EBattleProperty tp)
- {
- LogicFighter fighter = this.Env().mLogicFighterOper.FindFighter(id);
- if (null == fighter)
- {
- return 0;
- }
- return fighter.GetProperty(tp);
- }
- /// <summary>
- /// 通过monster占位获得plat偏移
- /// </summary>
- /// <param name="_seat"></param>
- /// <returns></returns>
- public int GetMonsterPlatOffset(int _seat)
- {
- return this.Env().FieldAdapter().FighterMonsterOffset(_seat);
- }
- /// <summary>
- /// 每回合恢复所有角色的回合数和能量值
- /// </summary>
- //public void ModifyFighterProAtRound()
- //{
- // Debug.Log("。。。当前第:" + this.Env().BattleRound + " 回合。。。每回合恢复所有角色的回合数和能量值。。。");
- // /*
- // * 除此之外,每回合每个角色自然回复的点击能量数值可能小幅度不同,可以暂定为15%左右,必杀每个回合回复5%
- // */
- // List<LogicFighter> fighters = this.Env().mLogicFighterOper.FindAliveFighter();
- // foreach (LogicFighter fighter in fighters)
- // {
- // fighter.ModifyProperty(EBattleProperty.LOCKEDROUND, -1);
- // if (fighter.IsChargePower())
- // {
- // fighter.ModifyProperty(EBattleProperty.NPOWER, fighter.GetProperty(EBattleProperty.RPOWER));
- // this.Env().ShowAdapter().BattleFighterHealthInfo(fighter.ID(),
- // fighter.GetProperty(EBattleProperty.HP),
- // fighter.GetProperty(EBattleProperty.HPMAX),
- // fighter.GetProperty(EBattleProperty.NPOWER),
- // fighter.GetProperty(EBattleProperty.NMAXPOWER));
- // }
- // }
- // this.Env().BattleBlueTeamPower += this.Env().RoundBlueTeamRoverPower;
- // //Debug.LogError(" 此回合蓝队必杀值增加" + this.Env().RoundBlueTeamRoverPower);
- // this.Env().BattleRedTeamPower += this.Env().RoundRedTeamRoverPower;
- // this.Env().ShowAdapter().OnRefreshWindowData();
- //}
- /// <summary>
- ///
- /// </summary>
- /// <param name="team"></param>
- /// <returns></returns>
- public float GetTeamHp(EBattleTeam team)
- {
- List<LogicFighter> fighters = this.Env().mLogicFighterOper.FindTeamAllFighter(team);
- float min = 0;
- float max = 0;
- foreach (LogicFighter f in fighters)
- {
- float temp = f.GetProperty(EBattleProperty.HP);
- if (temp >= 0)
- {
- min += temp;
- }
- max += f.GetProperty(EBattleProperty.HPMAX);
- }
- if (max == 0)
- {
- return 0;
- }
- return min / max;
- }
- /// <summary>
- /// 寻求朋友帮助
- /// </summary>
- /// <param name="seat">占位</param>
- public void SetFriendHelp(int seat)
- {
- if (this.Env().friend == null)
- {
- LogHelper.Log("No Friend Helping...............");
- return;
- }
- this.Env().mLogicFighterOper.SetFriendHelp(seat, true);
- }
- #endregion
- }
- }
|