• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UnitType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnitType的典型用法代码示例。如果您正苦于以下问题:C# UnitType类的具体用法?C# UnitType怎么用?C# UnitType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnitType类属于命名空间,在下文中一共展示了UnitType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
                }
        }
开发者ID:ajarbancina,项目名称:swat-eclipse,代码行数:34,代码来源:SQLiteValidation2.cs


示例2: BirdModel

 public BirdModel(UnitType type, double maxJumpSpeed, double minJumpFactor)
     : base(type)
 {
     JumpSpeed = maxJumpSpeed;
     MinJumpFactor = minJumpFactor;
     Position = new Vector { X = 0, Y = 0 };
 }
开发者ID:jchunzh,项目名称:ShoutyBird,代码行数:7,代码来源:BirdModel.cs


示例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();
 }
开发者ID:evandrix,项目名称:DAIDE10,代码行数:12,代码来源:Unit.cs


示例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.
     }
 }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:30,代码来源:UnitData.cs


示例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;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:13,代码来源:Unit.cs


示例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;
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:13,代码来源:CSSPrimitiveValue.cs


示例7: CSSPrimitiveValue

 internal CSSPrimitiveValue(HtmlColor value)
 {
     _text = value.ToCss();
     _type = CssValueType.PrimitiveValue;
     unit = UnitType.Rgbcolor;
     data = value;
 }
开发者ID:Rajbandi,项目名称:AngleSharp,代码行数:7,代码来源:CSSPrimitiveValue.cs


示例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;
 }
开发者ID:hjjohny,项目名称:szfgy1,代码行数:7,代码来源:GameManager.cs


示例9: Unit

 public Unit(int value)
 {
     if (value < -32768 || value > 0x7fff)
         throw new ArgumentOutOfRangeException("value");
     _value = value;
     _type = UnitType.Pixel;
 }
开发者ID:dbre2,项目名称:dynamic-image,代码行数:7,代码来源:Unit.cs


示例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();
        }
开发者ID:parappayo,项目名称:Bushido-Burrito,代码行数:30,代码来源:RenderUnit.cs


示例11: GetUnitCountByType

    public int GetUnitCountByType(UnitType type)
    {
        if(!mUnitsByType.ContainsKey(type))
            return 0;

        return mUnitsByType[type].Count;
    }
开发者ID:ddionisio,项目名称:1GAM_01_Aries,代码行数:7,代码来源:PlayerGroup.cs


示例12: ArmyStructure

 public ArmyStructure(CityType requiredCityType, decimal buildCost, int capacity, UnitType unitType)
 {
     this.RequiredCityType = requiredCityType;
     this.BuildCost = buildCost;
     this.Capacity = capacity;
     this.UnitType = unitType;
 }
开发者ID:simooo93,项目名称:Exams,代码行数:7,代码来源:ArmyStructure.cs


示例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;
    }
开发者ID:hysoftwareeng,项目名称:MedievalWarfare,代码行数:26,代码来源:Unit.cs


示例14: AbstractStructure

 protected AbstractStructure(CityType requiredCityType, decimal buildCost, int capacity, UnitType unitType)
 {
     RequiredCityType = requiredCityType;
     BuildCost = buildCost;
     Capacity = capacity;
     UnitType = unitType;
 }
开发者ID:zlatkovtv,项目名称:SoftUni_OOP,代码行数:7,代码来源:AbstractStructure.cs


示例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;
 }
开发者ID:AMEE,项目名称:revit,代码行数:14,代码来源:FieldData.cs


示例16: Unit

 public Unit(string unitId, String unitName, UnitType uType, List<string> components)
 {
     this.ID            = unitId;
     this.Name          = unitName;
     this.unitType      = uType;
     this.ComponentSpec = components ?? new List<string>();
 }
开发者ID:skeolan,项目名称:WarpWar,代码行数:7,代码来源:GameUnit.cs


示例17: UpdatePlayerState

 public void UpdatePlayerState(UnitType playerState)
 {
     foreach (NPC npc in Units)
     {
         npc.ToggleSpotted(npc.UnitType == playerState);
     }
 }
开发者ID:GGJTeamPurmerend,项目名称:GGJ-2014,代码行数:7,代码来源:UnitSpawnManager.cs


示例18: Compare

        /// <summary>
        /// Validate SQLite results for given unit type and column. Here same column name are assumed for bother
        /// SQLite and regular text file. But some column names have been changed in SQLite results. For these 
        /// columns, a lookup table should be used.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="var"></param>
        /// <returns></returns>
        public double Compare(UnitType source, string var, System.IO.StreamWriter file)
        {
            //System.Diagnostics.Debug.WriteLine("***************" + var.Trim() + "***************");

            int num = getNumberofUnit(source);
            if (source == UnitType.RSV) num = getNumberofUnit(UnitType.SUB);
            if (num == -1) return -99.0;

            double mean_R2 = 0;
            int num_R2 = 0;

            for (int i = 1; i <= num; i++)
            {
                double R2 = Compare(_startYear, _endYear, source, i, var);
                if (R2 > -99)
                {
                    mean_R2 += R2;
                    num_R2 += 1;
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}-{1}-{2},{3:F4}", source, i, var.Trim(), R2));
                    file.WriteLine(string.Format("{0},{1},{2},{3:F4}", source, i, var.Trim(), R2));
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}-{1}-{2},No Record", source, i, var.Trim()));
                    file.WriteLine(string.Format("{0},{1},{2},NoRecord", source, i, var.Trim()));
                }
            }

            if (num_R2 > 0)
                return mean_R2 / num_R2;
            return -99.0;
        }
开发者ID:ajarbancina,项目名称:swat-eclipse,代码行数:40,代码来源:SQLiteValidation.cs


示例19: Create

        public static IUnit Create(UnitType type, string name, int x, int y)
        {
            IUnit unit;

            switch (type)
            {
                case UnitType.IceGiant:
                    unit = new IceGiant(x, y, name, new IceGigantCombatHandler());
                    break;

                case UnitType.Mage:
                    unit = new Mage(x, y, name, new MageCombatHandler());
                    break;

                case UnitType.Warrior:
                    unit = new Warrior(x, y, name, new WarriorCombatHandler());
                    break;

                default:
                    throw new NotImplementedException();
            }

            unit.CombatHandler.Unit = unit;

            return unit;
        }
开发者ID:LyuboslavLyubenov,项目名称:OOP,代码行数:26,代码来源:UnitFactory.cs


示例20: Unit

 public Unit(House owner, UnitType type, bool alive, string name)
 {
     Owner = owner;
     Type = type;
     Alive = alive;
     Name = name;
 }
开发者ID:kongsgaard,项目名称:GameOfThrones,代码行数:7,代码来源:Unit.cs



注:本文中的UnitType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Units类代码示例发布时间:2022-05-24
下一篇:
C# UnitTestElementConsumer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap