本文整理汇总了C#中UnitType类的典型用法代码示例。如果您正苦于以下问题:C# UnitType类的具体用法?C# UnitType怎么用?C# UnitType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitType类属于命名空间,在下文中一共展示了UnitType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compare
/// <summary>
/// Compare outputs in text files and SQLite database for given SWAT unit
/// </summary>
/// <param name="source">SWAT unit type</param>
/// <returns>Average R2</returns>
/// <remarks>
/// 1. R2 is calculated for each column
/// 2. A text file would be created on desktop to record R2 for all columns
/// </remarks>
public double Compare(UnitType source)
{
using(StreamWriter file = new StreamWriter(
Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop), source.ToString() + "_" + _extractText.OutputInterval.ToString() + "_validation.txt")))
{
string[] cols = ExtractSWAT_SQLite.GetSQLiteColumns(source);
if (cols == null) return -99.0;
double mean_R2 = 0;
int num_R2 = 0;
foreach (string col in cols)
{
double R2 = Compare(source, col,file);
if (R2 > -99)
{
mean_R2 += R2;
num_R2 += 1;
}
}
if (num_R2 > 0)
return mean_R2 / num_R2;
return -99.0;
}
}
示例2: BirdModel
public BirdModel(UnitType type, double maxJumpSpeed, double minJumpFactor)
: base(type)
{
JumpSpeed = maxJumpSpeed;
MinJumpFactor = minJumpFactor;
Position = new Vector { X = 0, Y = 0 };
}
示例3: Unit
/// <summary>Creates a new <see cref="Unit"/> instance.
/// </summary>
/// <param name="type">Type.</param>
/// <param name="power">Power.</param>
/// <param name="location">Location.</param>
public Unit(UnitType type, Power power, Location location)
{
this.type = type;
this.power = power;
this.location = location;
this.retreatLocations = new LocationCollection();
}
示例4: GetHallucination
public UnitType GetHallucination(UnitType t)
{
switch (t)
{
case UnitType.Probe:
return UnitType.ProbeHallucination;
case UnitType.Zealot:
return UnitType.ZealotHallucination;
case UnitType.Stalker:
return UnitType.StalkerHallucination;
case UnitType.HighTemplar:
return UnitType.HighTemplarHallucination;
case UnitType.Archon:
return UnitType.ArchonHallucination;
case UnitType.Immortal:
return UnitType.ImmortalHallucination;
case UnitType.WarpPrism:
return UnitType.WarpPrismHallucination;
case UnitType.WarpPrismPhasing:
return UnitType.WarpPrismPhasingHallucination;
case UnitType.Colossus:
return UnitType.ColossusHallucination;
case UnitType.Phoenix:
return UnitType.PhoenixHallucination;
case UnitType.VoidRay:
return UnitType.VoidRayHallucination;
default:
return UnitType.Unknown; // Could throw, but it doesn't break the parser.
}
}
示例5: Unit
/// <devdoc>
/// <para> Initializes a new instance of the <see cref='System.Web.UI.WebControls.Unit'/> structure with the
/// specified double-precision
/// floating point number as the unit value and <see langword='Pixel'/>
/// as the (default) unit type.</para>
/// </devdoc>
public Unit(double value) {
if ((value < MinValue) || (value > MaxValue)) {
throw new ArgumentOutOfRangeException("value");
}
this.value = (int)value;
this.type = UnitType.Pixel;
}
示例6: SetFloatValue
/// <summary>
/// Sets the primitive value to the given number.
/// </summary>
/// <param name="unitType">The unit of the number.</param>
/// <param name="value">The value of the number.</param>
/// <returns>The CSS primitive value instance.</returns>
public CSSPrimitiveValue SetFloatValue(UnitType unitType, Single value)
{
_text = value.ToString(CultureInfo.InvariantCulture) + ConvertUnitTypeToString(unitType);
unit = unitType;
data = value;
return this;
}
示例7: CSSPrimitiveValue
internal CSSPrimitiveValue(HtmlColor value)
{
_text = value.ToCss();
_type = CssValueType.PrimitiveValue;
unit = UnitType.Rgbcolor;
data = value;
}
示例8: buyUnit
public void buyUnit(UnitType unitType_)
{
Unit newUnit = new Unit(unitType_, _players[_currentPlayerIndex]._race);
//map.placeNewUnit(_players[currentPlayerIndex],newUnit); //beállítja a pozíciót a unitnál-is!!!!!
_players[_currentPlayerIndex]._units.Add(newUnit);
_players[_currentPlayerIndex]._money -= newUnit._stats._price;
}
示例9: Unit
public Unit(int value)
{
if (value < -32768 || value > 0x7fff)
throw new ArgumentOutOfRangeException("value");
_value = value;
_type = UnitType.Pixel;
}
示例10: DrawUnit
public void DrawUnit(HexTilePosition pos, UnitType type)
{
Vector3 mapPos = RenderHex.HexPositionToMapPosition(pos);
render.PushWorldMatrix(Matrix.CreateTranslation(mapPos));
switch (type)
{
case UnitType.Unknown:
DrawUnknown();
break;
case UnitType.Infantry:
DrawInfantry();
break;
case UnitType.Armor:
DrawArmor();
break;
case UnitType.Artillery:
DrawArtillery();
break;
default:
DrawInvalid();
break;
}
render.PopWorldMatrix();
}
示例11: GetUnitCountByType
public int GetUnitCountByType(UnitType type)
{
if(!mUnitsByType.ContainsKey(type))
return 0;
return mUnitsByType[type].Count;
}
示例12: ArmyStructure
public ArmyStructure(CityType requiredCityType, decimal buildCost, int capacity, UnitType unitType)
{
this.RequiredCityType = requiredCityType;
this.BuildCost = buildCost;
this.Capacity = capacity;
this.UnitType = unitType;
}
示例13: CreateComponent
//constructor
public static Unit CreateComponent( UnitType unitType, Tile location, Village v, GameObject PeasantPrefab )
{
Tile toplace = null;
foreach (Tile a in location.getNeighbours())
{
if(a.prefab == null && a.getOccupyingUnit() == null && a.getColor() == location.getColor())
{
toplace = a;
}
}
if(toplace == null)
{
toplace = location;
}
GameObject o = Instantiate(PeasantPrefab, new Vector3(toplace.point.x, 0.15f, toplace.point.y), toplace.transform.rotation) as GameObject;
Unit theUnit = o.AddComponent<Unit>();
theUnit.locatedAt = toplace;
theUnit.myType = unitType;
theUnit.myVillage = v;
theUnit.myAction = UnitActionType.ReadyForOrders;
location.setOccupyingUnit (theUnit);
return theUnit;
}
示例14: AbstractStructure
protected AbstractStructure(CityType requiredCityType, decimal buildCost, int capacity, UnitType unitType)
{
RequiredCityType = requiredCityType;
BuildCost = buildCost;
Capacity = capacity;
UnitType = unitType;
}
示例15: FieldData
/// <summary>
/// Create a new FieldData object
/// </summary>
/// <param name="name">The name of the field</param>
/// <param name="typeIn">The AssemblyQualifiedName of the Field's data type</param>
/// <param name="unit">The unit type of the Field (set to UT_Undefined for non-floating point types</param>
/// <param name="subSchema">The SchemaWrapper of the field's subSchema, if the field is of type "Entity"</param>
public FieldData(string name, string typeIn, UnitType unit, SchemaWrapper subSchema)
{
m_Name = name;
m_Type = typeIn;
m_Unit = unit;
m_SubSchema = subSchema;
}