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

C# Hex类代码示例

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

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



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


示例16: Create_World_And_Hexes

        public void Create_World_And_Hexes()
        {
            var race = new Race { Name = "Default Race" };
            var nation = new Nation { Name = "Default Nation", Race = race };
            var user = new User { Email = "[email protected]", FirstName = "Jamie", LastName = "Fraser", OpenId = "http://jamief00.myopenid.com/" };
            var world = new World { Height = 100, Width = 100, Name = "Default World" };
            var game = new Game { Name = "Default Game", Started = DateTime.Now, GameWorld = world};
            var gameSession = new GameSession { EnteredGame = DateTime.Now, Nation = nation, Game = game, User = user };

            using (var tran = _dataContext.WorldRepository.Session.BeginTransaction())
            {
                _dataContext.RaceRepository.Save(race);
                _dataContext.NationRepository.Save(nation);
                _dataContext.UserRepository.Save(user);
                _dataContext.GameRepository.Save(game);
                _dataContext.WorldRepository.Save(world);
                _dataContext.GameSessionRepository.Save(gameSession);

                for (var y = 1; y <= world.Width; y++)
                {
                    for (var x = 1; x <= world.Height; x++)
                    {
                        var hex = new Hex { World = world, HexType = HexType.Grass, X = x, Y = y };

                        _dataContext.HexRepository.Save(hex);
                    }
                }

                tran.Commit();
            }
        }
开发者ID:Think-Jumper,项目名称:everland,代码行数:31,代码来源:WorldTests.cs


示例17: Add

        public override bool Add(Hex h)
        {
            if (!base.Add(h)) return false;

            ColorTable.Add(h, Color.Black);
            return true;
        }
开发者ID:deanljohnson,项目名称:PathView,代码行数:7,代码来源:DrawableHexSet.cs


示例18: Activate

    public void Activate(Critter newCritter, Hex newHab)
    {
        critter = newCritter;
        habitat = newHab;

        warnControl = FindObjectOfType<WarningsController>();
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:WarningChecker.cs


示例19: findPath

    public static List<Hex> findPath(Hex start, Hex goal)
    {
        Dictionary<Hex,int> distances = new Dictionary<Hex,int> ();
        Dictionary<Hex,Hex> previous = new Dictionary<Hex,Hex> ();

        List<Hex> queue = new List<Hex> { start };
        distances [start] = 0;

        while (queue.Count > 0) {
            queue.Sort ((a, b) => (distances[a] + Hex.Distance (a, goal)) - (distances[b] + Hex.Distance (b, goal)));
            Hex current = queue [0];
            queue.RemoveAt (0);
            if (current == goal) {
                List<Hex> path = new List<Hex> {goal};
                while (previous.ContainsKey (path [path.Count - 1])) {
                    path.Add (previous [path [path.Count - 1]]);
                }
                path.Reverse ();
                return path;
            }
            for (int i = 0; i < 6; i++) {
                Hex neighbor = Hex.Neighbor (current, i);
                if (!distances.ContainsKey (neighbor) || distances [current] + 1 < distances [neighbor]) {
                    distances [neighbor] = distances [current] + 1;
                    previous [neighbor] = current;
                    queue.Add (neighbor);
                }
            }
        }
        throw new UnityException ();
    }
开发者ID:Rosstin,项目名称:Battledance,代码行数:31,代码来源:PathFinder.cs


示例20: GetMapObject

    public static MapObject GetMapObject(int start, MapObjectType objType, byte[] bytes, Hex[] hexes, out int newStart)
        {
            switch (objType)
            {
                //case MapObjectType.Item:
                //    break;
                case MapObjectType.Critter:
                    return new Critter(start, bytes, hexes, criNames, itemsProtoNames, out newStart);
                case MapObjectType.Scenery:
                    return new Scenery(start, bytes, hexes, sceNames, itemsProtoNames, out newStart);
                case MapObjectType.Wall:
                    return new Wall(start, bytes, hexes, wallNames, itemsProtoNames, out newStart);
                //case MapObjectType.Tiles:
                //    break;
                case MapObjectType.Misc:
                    return new Misc(start, bytes, hexes, miscNames, itemsProtoNames, out newStart);
                //case MapObjectType.Interface:
                //    break;
                //case MapObjectType.Invent:
                //    break;
                //case MapObjectType.Head:
                //    break;
                //case MapObjectType.Backgrnd:
                //    break;
                //case MapObjectType.Skilldex:
                //    break;
                //default:
                //    break;
            }
            newStart = start + 88;
            return null;

        }
开发者ID:Uhha,项目名称:Fo2,代码行数:33,代码来源:MapObjectFactory.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# HexBox类代码示例发布时间:2022-05-24
下一篇:
C# Hero类代码示例发布时间: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