本文整理汇总了C#中Unit.getCurrentWater方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.getCurrentWater方法的具体用法?C# Unit.getCurrentWater怎么用?C# Unit.getCurrentWater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.getCurrentWater方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttackRound
// Sets damage done by one round of attacking.
// Must be re-set after doing this; assumes within countering range.
public AttackRound(Unit attackerIn, int attackerWaterCost, Unit defenderIn) {
attacker = attackerIn;
defender = defenderIn;
utility = expectedDamage = expectedCounterDamage = 0;
dieDef = dieAtk = false;
// Store current stats.
waterAtk = attacker.getCurrentWater();
clayDef = defender.getClay();
attacker.setCurrentWater(waterAtk - attackerWaterCost);
expectedDamage = calculateExpectedDamage(attacker, defender);
// Assume defender looses appropriate amount of clay before counter.
if ((clayDef - expectedDamage) > 0)
{
defender.setClay(clayDef - expectedDamage);
expectedCounterDamage = calculateExpectedDamage(defender, attacker);
}
else
{
defender.setClay(0);
dieDef = true;
}
if ((attacker.getClay() - expectedDamage) < 0)
{
dieAtk = true;
}
// Calculates a utility value using expected damage values
utility = calculateUtility();
}
示例2: Attack
// Calculates the damage, hit chance and critical chance of an attack from one unit to another
// Goal to max attack: maximize water.
public Attack(Unit attacker, Unit defender) {
atk = attacker;
def = defender;
damage = Mathf.Max(attacker.getClay() - defender.getHardness(), 0);
// TODO: water: fix this to be more balanced.
float waterVal = Mathf.Max(attacker.getMaxWater() / 2, attacker.getCurrentWater());
hitChance = Mathf.Min((waterVal - defender.getBendiness()) / defender.getBendiness(), 1.0f);
critChance = Mathf.Min((attacker.getBendiness() - defender.getBendiness()) / defender.getBendiness(), 1.0f);
}
示例3: PathMemoizer
public PathMemoizer(PathFinder p, Unit unitRef)
{
uRef = unitRef;
pathFinderRef = p;
nodesCanWalkTo = new List<Node>();
nodesCanWalkToSet = new HashSet<Node>();
nodesInRange = new List<Node>(); ;
nodesInRangeSet = new HashSet<Node>();
reverseNodesInRangeSetCost = new Dictionary<Node, int>();
currentTargets = new List<Node.NodePointer>();
initialize(unitRef.getNode(), unitRef.getCurrentWater());
}
示例4: displayRangeOfUnit
public void displayRangeOfUnit(Unit u, Vector2 mousePosition)
{
clearRangeDisplay();
if (overlayNodes == null)
overlayNodes = new List<Node>();
List<Node> reach = nodesWithinEnduranceValue(closestMostValidNode(mousePosition), u.getCurrentWater());
List<Node> range = NodesInRangeOfNodes(reach, u.getMinAttackRange(), u.getMaxAttackRange());
HashSet<Node> inReach = new HashSet<Node>();
inReach.UnionWith(reach);
HashSet<Node> inRange = new HashSet<Node>();
inRange.UnionWith(range);
inRange.RemoveWhere(inReach.Contains);
foreach (Node n in inReach)
{
//make slightly smaller to show square off
Node q = new Node(transform.gameObject, nodeImg, n.getPos(), n.getGridPos(), Node.randWalkState(), radii * 1.75f);
q.setColor(new Color(0, 0.5f, 0, 0.75f));
overlayNodes.Add(q);
}
foreach (Node n in inRange)
{
//make slightly smaller to show square off
Node q = new Node(transform.gameObject, nodeImg, n.getPos(), n.getGridPos(), Node.randWalkState(), radii * 1.75f);
q.setColor(new Color(0, 0, 0.5f, 0.75f));
overlayNodes.Add(q);
}
}
示例5: setDisplayedUnit
public void setDisplayedUnit(Unit uRef)
{
UnitName.text = "Name: " + uRef.name();
UnitName.color = (uRef.isEnemy()) ? Color.red : Color.black;
UnitClay.text = "Clay: " + uRef.getClay();
UnitWater.text = "Water: " + uRef.getCurrentWater();
UnitBendiness.text = "Bendiness: " + uRef.getBendiness();
UnitHardness.text = "Hardness: " + uRef.getHardness();
UnitRangeNotation.text = "Range: [" + uRef.getMinAttackRange() + ", " + uRef.getMaxAttackRange() + "]";
}