当前位置: 首页>>代码示例>>C#>>正文


C# Hex类代码示例

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


Hex类属于命名空间,在下文中一共展示了Hex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    // Use this for initialization
    void Start()
    {
        editorUserS.selection_menu_displayed = true;
        //		Hex[] keys = editorHexManagerS.hex_dict.Keys.toArray();;

        Hex[] keys = new Hex[editorHexManagerS.hex_dict.Keys.Count];
        editorHexManagerS.hex_dict.Keys.CopyTo(keys, 0);
        int size = keys.Length;
        float interval = (Mathf.PI * 2)/size;

        for(int i = 0; i < size; ++i)
        {
            float x =   Mathf.Cos(interval*i + (Mathf.PI/2))*radial_distance         + transform.position.x;
            float z = ((Mathf.Sin(interval*i + (Mathf.PI/2))*radial_distance)/1.16F) + transform.position.z;

            GameObject new_hex            = (GameObject) Instantiate(editorHexManagerS.hex_dict[keys[i]], new Vector3(x,  5 + (.01F * i) + .01F, z), Quaternion.identity);
            editorHexS new_hex_script 	  = (editorHexS) new_hex.AddComponent("editorHexS");

            new_hex_script.hex_type		  = keys[i];
            new_hex_script.menu_item 	  = true;
            new_hex_script.menu_item_num  = i;

            new_hex.transform.parent = transform;
        }
    }
开发者ID:ChrisRenke,项目名称:Precursor,代码行数:26,代码来源:editorMenuHexS.cs

示例2: AddHex

 public virtual void AddHex(Hex child)
 {
     if (Hexes == null)
         Hexes = new List<Hex>();
     child.World = this;
     Hexes.Add(child);
 }
开发者ID:Think-Jumper,项目名称:everland,代码行数:7,代码来源:World.cs

示例3: LocationPoint

 public LocationPoint(Hex attachingHex)
 {
     attachedHex = new List<Hex>();
     edges = new List<Edge>();
     attachedHex.Add(attachingHex);
     Harbor = SeaHarbor.NotHarbor;
 }
开发者ID:michaelfriesen63,项目名称:socsim,代码行数:7,代码来源:LocationPoint.cs

示例4: CodeDevice

        static void CodeDevice(string portName, string deviceName, Hex code, string[] args)
        {
            ErrorCode error;
            int[] pins;
            switch (deviceName) {
            case "pic18f":
                pins = GetPins(args, 2, 4);
                if (pins == null)
                    return;

                error = ProgrammerFactory.ProgramPic(portName, code, deviceName,
                    pins[0], pins[1], pins[2], pins[3]);
                break;

            case "cc25":
                pins = GetPins(args, 2, 3);
                if (pins == null)
                    return;

                error = ProgrammerFactory.ProgramCC2530(portName, code, deviceName,
                    pins[0], pins[1], pins[2]);
                break;

            default:
                Console.WriteLine("ERROR Device not supported.");
                ShowHelp();
                return;
            }

            if (error != ErrorCode.NoError)
                Console.WriteLine("ERROR " + error.ToString());
        }
开发者ID:pleonex,项目名称:Arduimmer,代码行数:32,代码来源:Program.cs

示例5: SetHex

 public void SetHex(GraphicCampo graphicCampo, Hex hex)
 {
     m_hex = hex;
     m_graphicCampo = graphicCampo;
     q = hex.q;
     r = hex.r;
 }
开发者ID:vittis,项目名称:hexsum-experiments,代码行数:7,代码来源:GraphicHex.cs

示例6: MoveNavy

		public MoveNavy() : base() { } //JSON Constructor

		public MoveNavy(Hex from, Hex to, int count)
			: base() 
		{
			this.from = from;
			this.to = to;
			this.count = count;
		}
开发者ID:AciesNN,项目名称:cyc,代码行数:9,代码来源:MoveNavy.cs

示例7: EqualHex

 public static void EqualHex(String name, Hex a, Hex b)
 {
     if (!(a.q == b.q && a.s == b.s && a.r == b.r))
     {
         Tests.Complain(name);
     }
 }
开发者ID:dested,项目名称:Social-War-Games,代码行数:7,代码来源:Tests.cs

示例8: CalculateHexValue

 /// <summary>
 /// Calculates the hex value.
 /// </summary>
 /// <returns>
 /// The hex value.
 /// </returns>
 /// <param name='hex'>
 /// Hex.
 /// </param>
 int CalculateHexValue(Hex hex)
 {
     if(hex.Unit != null) {
         if(hex.Unit.Team == player.Team || hex.Unit.Team == 0) {
             return int.MinValue;
         } else {
             return int.MaxValue - hex.Unit.Attack;
         }
     } else {
         Dictionary<Flag, int> flags;
         if(isAggressive) {
             flags = getEnemyOrNeutralFlagValues();
         } else {
             flags = getFriendlyFlagValues();
         }
         Flag flag = null;
         foreach(Flag f in flags.Keys) {
             if(flag == null) flag = f;
             else {
                 if(flags[f] > flags[flag]) {
                     flag = f;
                 }
             }
         }
         return flags[flag] - Mathf.FloorToInt(hex.Distance(flag.Hex));
     }
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:36,代码来源:EasyAI.cs

示例9: ReplaceTilePosition

 public Entity ReplaceTilePosition(Hex newPosition) {
     var componentPool = GetComponentPool(ComponentIds.TilePosition);
     var component = (TilePositionComponent)(componentPool.Count > 0 ? componentPool.Pop() : new TilePositionComponent());
     component.position = newPosition;
     ReplaceComponent(ComponentIds.TilePosition, component);
     return this;
 }
开发者ID:thebatoust,项目名称:Entitas-TileMap,代码行数:7,代码来源:TilePositionComponentGeneratedExtension.cs

示例10: foreach

    /*public void PathFinding(Hex start) {
        Queue<Hex> frontier = new Queue<Hex>();
        frontier.Enqueue(start);

        Dictionary<Hex, bool> visitado = new Dictionary<Hex, bool>();

        foreach (Hex hex in m_hexagons) {
            visitado[hex] = false;
        }
       visitado[start] = true;

        while (frontier.Count != 0) {
            Hex current = frontier.Peek();
            frontier.Dequeue();
            foreach (Hex hex in current.vizinhos) {
                if (visitado[hex] == false) {
                    frontier.Enqueue(hex);
                    visitado[hex] = true;
                    Debug.Log(hex);
                }
            }
        }
    }*/
    public void PathFinding(Hex start, Hex destino)
    {
        Queue<Hex> frontier = new Queue<Hex>();
        frontier.Enqueue(start);

        Dictionary<Hex, Hex> came_from = new Dictionary<Hex, Hex>();
        Hex hexnulo = new Hex(100, 100);

        foreach (Hex hex in m_hexagons) {
            came_from[hex] = hexnulo;
        }
        //came_from[start] = new Hex(100, 100);

        while (frontier.Count != 0) {
            Hex current = frontier.Peek();
            frontier.Dequeue();
            foreach (Hex hex in current.vizinhos) {
                if (came_from[hex] == hexnulo) {
                    frontier.Enqueue(hex);
                    came_from[hex] = current;
                }
            }
        }
        Hex atual = destino;
        List<Hex> path = new List<Hex>();
        path.Add(atual);
        while (atual != start) {
            atual = came_from[atual];
            path.Add(atual);
        }
        path.Reverse();
        foreach (Hex hex in path) {
            At(hex.q, hex.r).estaVazio = false;
        }
    }
开发者ID:vittis,项目名称:hexsum-experiments,代码行数:58,代码来源:Campo.cs

示例11: PlayCardOnHex

 public override Unit PlayCardOnHex(Card card, Hex hex, string id)
 {
     CardHistory.Add(card);
     GuiControl.AddCardToHistory(card);
     // TODO Clean up this method to better handle multiple card types.
     if(typeof(EntityCard).IsAssignableFrom(card.GetType())) {
         EntityCard eCard = (EntityCard) card;
         GameObject go = (GameObject) Instantiate(UnitPrefab, Vector3.zero, Quaternion.identity);
         Unit unit = go.GetComponent<Unit>();
         unit.Id = id;
         unit.FromCard(eCard);
         unit.Hex = hex;
         unit.transform.position = hex.transform.position;
         hex.Unit = unit;
         Units.Add(unit);
         unit.Team = MyTurn() ? Team.ME : Team.ENEMY;
         if(MyTurn() && ThisPlayer.Hand.Count != 0) {
             // TODO Find a better way to sort this
             ThisPlayer.PlayCard();
         }
         card.OnPlay(new StateObject(Units, hex, null, MyTurn() ? ThisPlayer : EnemyPlayer, MyTurn() ? EnemyPlayer : ThisPlayer));
         return unit;
     } else {
         if(MyTurn() && ThisPlayer.Hand.Count != 0) {
             // TODO Find a better way to sort this
             ThisPlayer.PlayCard();
         }
         card.OnPlay(new StateObject(Units, hex, null, MyTurn() ? ThisPlayer : EnemyPlayer, MyTurn() ? EnemyPlayer : ThisPlayer));
         return null;
     }
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:31,代码来源:KingOfTheHill.cs

示例12: distance

        public static int distance(Hex h1, Hex h2)
        {

            return (int)(Math.Abs(h1.axialCoordinates.X - h2.axialCoordinates.X) + Math.Abs(h1.axialCoordinates.Y - h2.axialCoordinates.Y)
                  + Math.Abs(h1.axialCoordinates.X + h1.axialCoordinates.Y - h2.axialCoordinates.X - h2.axialCoordinates.Y)) / 2;

        }
开发者ID:Zimex,项目名称:Tess,代码行数:7,代码来源:Hex.cs

示例13: GetConnectedSeas

		public static List<Hex> GetConnectedSeas(MapCM map, int playerID, Hex h, int moveLimit, bool is_possible_to_attack_enemy)
		{
			List<Hex> res = new List<Hex>();
			res.Add(h);
			_GetConnectedSeas(map, playerID, h, moveLimit, res, is_possible_to_attack_enemy);
			return res;
		}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:MapCM.cs

示例14: GetDistance

    public static float GetDistance(Hex a, Hex b)
    {
        Cube ca = a.ToCube();
        Cube cb = b.ToCube();

        return Cube.GetDistance(ca, cb);
    }
开发者ID:thebatoust,项目名称:Entitas-TileMap,代码行数:7,代码来源:Hex.cs

示例15: HexVisual

 public HexVisual(Point2D point, Hex hex)
     : base(point)
 {
     _Hex = hex;
     Init();
     InitHex();
 }
开发者ID:generateui,项目名称:SettleIn,代码行数:7,代码来源:HexVisual.cs


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