本文整理汇总了C#中Building.RemoveAttacker方法的典型用法代码示例。如果您正苦于以下问题:C# Building.RemoveAttacker方法的具体用法?C# Building.RemoveAttacker怎么用?C# Building.RemoveAttacker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Building
的用法示例。
在下文中一共展示了Building.RemoveAttacker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeDecision
public void MakeDecision()
{
if (gameObject != null)
{
if (ShouldChangeAttackTarget())
{
mOldAttackingObject = mAttackingObject;
if (mOldAttackingObject != null)
{
mOldAttackingObject.RemoveAttacker(this);
}
Utility.Log("mDetectionRange.RangeTargetList.Count = " + mDetectionRange.RangeTargetList.Count);
if (MapManager.MMInstance.AttackableAliveBuildingNumber <= 0 && MapManager.MMInstance.NotAttackableAliveBuildingNumber <= 0)
{
mAttackingObject = null;
return;
}
bool hasprefferinmap = false;
bool hasprefferinrange = false;
if (mPreferAttackType == PreferAttackType.E_ATTACKABLE)
{
if (MapManager.MMInstance.AttackableAliveBuildingNumber > 0)
{
hasprefferinmap = true;
if (mDetectionRange.AttackableAliveAliveBuildingNumber > 0)
{
hasprefferinrange = true;
}
}
}
else if (mPreferAttackType == PreferAttackType.E_ALL)
{
if (MapManager.MMInstance.AttackableAliveBuildingNumber > 0 || MapManager.MMInstance.NotAttackableAliveBuildingNumber > 0)
{
hasprefferinmap = true;
if (mDetectionRange.AttackableAliveAliveBuildingNumber > 0 || mDetectionRange.NotAttackableAliveBuildingNumber > 0)
{
hasprefferinrange = true;
}
}
}
if (hasprefferinmap && hasprefferinrange)
{
mBSearchForPreffered = true;
mAttackingObject = ObtainAttackObjectInDetectionRange();
}
else if (hasprefferinmap && !hasprefferinrange)
{
mBSearchForPreffered = true;
//Otherwise chose one as attack target in whole map
Utility.Log("Chose Target From Whole Map");
mAttackingObject = MapManager.MMInstance.ObtainAttackObject(this);
}
else
{
//No preffer attacking building left
mBSearchForPreffered = false;
//Otherwise chose one as attack target in whole map
Utility.Log("Chose Target From Whole Map");
mAttackingObject = MapManager.MMInstance.ObtainAttackObject(this);
}
if (/*mAttackingObject != mOldAttackingObject &&*/ mAttackingObject != null)
{
//Change the first point to gameobject location to avoid soldier move away from target
mAStarPath = mShortestPath.MovementPathToTarget;
mAStarPathIndexList = mShortestPath.PathToTarget;
mCurrentWayPoint = mAStarPath.Count - 1;
mAStarPath[mCurrentWayPoint] = transform.position;
//Append soldier to attackerlist for building
mAttackingObject.AppendAttacker(this);
//if the attacking object is Wall,
//we let soldier listenning for wall break event to make new decision once has wall breaked
/*
* Inform all soldiers that is listenning to WALL_BREAK will cause fps drop
* Only inform soldiers that are in valid wall notification range
if(mAttackingObject.mBI.getBuildingType() == BuildingType.E_WALL)
{
EventManager.mEMInstance.StartListening("WALL_BREAK",WallBreakDelegate);
}
else
{
EventManager.mEMInstance.StopListening("WALL_BREAK",WallBreakDelegate);
}
*/
}
}
}
}