using System;
using System.Collections.Generic;
namespace YLBattle
{
///
/// 子弹策略辅助类
///
public class BulletPolicyFinder
{
///
/// 单键实例
///
private static BulletPolicyFinder _Instance = null;
///
/// 瞄准策略
///
private Dictionary mAIMPolicy = new Dictionary();
///
/// 伤害计算
///
private Dictionary mDamagePolicy = new Dictionary();
///
/// 弹道模拟策略
///
private Dictionary mTrajectPolicy = new Dictionary();
///
/// 单键实例
///
/// 单键
public static BulletPolicyFinder Instance()
{
if (null == _Instance)
{
_Instance = new BulletPolicyFinder();
}
return _Instance;
}
///
/// 构造函数
///
protected BulletPolicyFinder()
{
this.mAIMPolicy.Clear();
this.mTrajectPolicy.Clear();
this.mDamagePolicy.Clear();
this.InitializeAIMPolicy();
this.InitializeBulletTraject();
this.InitialzieDamage();
}
///
/// 查询弹道策略
///
/// 查询弹道类型
/// 弹道策略
public BulletTrajectFoundation BulletTrajectFoundation(EBulletTrajectoryType type)
{
if (this.mTrajectPolicy.ContainsKey(type))
{
return this.mTrajectPolicy[type];
}
return null;
}
///
/// 查询AIM
///
/// 查询类型
/// AIM瞄准策略
public BulletAIMFoundation AIMFoundation(EBulletAIMType type)
{
if (this.mAIMPolicy.ContainsKey(type))
{
return (BulletAIMFoundation)this.mAIMPolicy[type].Clone();
}
return null;
}
///
/// 查找伤害策略
///
/// 查询伤害类型
/// 伤害策略
public BulletDamageFoundation BulletDamage(EBulletDamageType type)
{
if (this.mDamagePolicy.ContainsKey(type))
{
return this.mDamagePolicy[type];
}
return null;
}
///
/// 初始化瞄准目标选择
///
public void InitializeAIMPolicy()
{
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_SELF, new BulletAIMSelf());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_CENTERTARGET, new BulletAIMLockedTarget());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_TARGET, new BulletAIMTarget());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_SELFAROUND, new BulletAIMSelfGround());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_TARGETAROUND, new BulletAIMTargetAround());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_ALLFRIENDS, new BulletAIMAllFriends());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_ALLENEMIES, new BulletAIMAllEnemies());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_ABOVEHPENEMY, new BulletAboveHpEnemy());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_UNDERHPENEMY, new BulletUnderHpEnemy());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_UNDERHPFRIEND, new BulletUnderHpFriend());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_LEASTHPMOREFRIEND, new BulletAIMLastHpMoreFriend());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_LEASTHPMOREENEMY, new BulletAIMLastHpMoreEnemy());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_RONDOMMOREENEMY, new BulletAIMRondomMoreEnemy());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_HIGHATTACKMOREENEMY, new BulletAIMHighAttackMoreEnemy());
this.mAIMPolicy.Add(EBulletAIMType.EBULLET_AIM_LEASTHPFRIENDEXPME, new BulletAIMLastHpFriendExpSelf());
}
///
/// 初始化伤害策略
///
public void InitialzieDamage()
{
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_BUFF, new BulletDamageBuff());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_SHAKE, new BulletDamageShake());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_DRAG, new BulletDamageDrag());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_MAG, new BulletDamageMag());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_CRITICAL, new BulletDamageCritical());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_PHY, new BulletDamagePhy());
this.mDamagePolicy.Add(EBulletDamageType.EBULLET_DAMAGE_CURE, new BulletDamageCure());
}
///
/// 初始化弹道策略
///
public void InitializeBulletTraject()
{
this.mTrajectPolicy.Add(EBulletTrajectoryType.EBULLET_TRAJECT_NONE, new BulletTrajectNone());
this.mTrajectPolicy.Add(EBulletTrajectoryType.EBULLET_TRAJECT_PARABOLA, new BulletTrajectParabola());
this.mTrajectPolicy.Add(EBulletTrajectoryType.EBULLET_TRAJECT_LINE, new BulletTrajectLine());
}
}
}