using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace YLBattle
{
///
///
///
public partial class BattleManager : IBattleGlobalOper
{
#region 战斗对象
///
/// 修改指定战斗对象位置信息
///
/// 对象编号
/// x坐标
/// y坐标
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);
}
///
/// 获取指定对象属性
///
/// 对象实例id
/// 属性类型
/// 属性值
public float GetFighterProperty(string id, EBattleProperty tp)
{
LogicFighter fighter = this.Env().mLogicFighterOper.FindFighter(id);
if (null == fighter)
{
return 0;
}
return fighter.GetProperty(tp);
}
///
/// 通过monster占位获得plat偏移
///
///
///
public int GetMonsterPlatOffset(int _seat)
{
return this.Env().FieldAdapter().FighterMonsterOffset(_seat);
}
///
/// 每回合恢复所有角色的回合数和能量值
///
//public void ModifyFighterProAtRound()
//{
// Debug.Log("。。。当前第:" + this.Env().BattleRound + " 回合。。。每回合恢复所有角色的回合数和能量值。。。");
// /*
// * 除此之外,每回合每个角色自然回复的点击能量数值可能小幅度不同,可以暂定为15%左右,必杀每个回合回复5%
// */
// List 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();
//}
///
///
///
///
///
public float GetTeamHp(EBattleTeam team)
{
List 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;
}
///
/// 寻求朋友帮助
///
/// 占位
public void SetFriendHelp(int seat)
{
if (this.Env().friend == null)
{
LogHelper.Log("No Friend Helping...............");
return;
}
this.Env().mLogicFighterOper.SetFriendHelp(seat, true);
}
#endregion
}
}