當前位置: 首頁>>代碼示例>>C#>>正文


C# System.Coord類代碼示例

本文整理匯總了C#中System.Coord的典型用法代碼示例。如果您正苦於以下問題:C# Coord類的具體用法?C# Coord怎麽用?C# Coord使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Coord類屬於System命名空間,在下文中一共展示了Coord類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Shard

 public Shard(Coord ul, Coord ur, Coord ll, Coord lr)
 {
     _ul = ul;
       _ur = ur;
       _ll = ll;
       _lr = lr;
 }
開發者ID:unhammer,項目名稱:gimp-sharp,代碼行數:7,代碼來源:Shard.cs

示例2: InitialiseInhab

        private static void InitialiseInhab(Inhabitant thing,Room room,AMaterialStats stats)
        {
            int trytimes = 0;
            bool done = false;
            Coord size = new Coord(3, 3);

            while (!done && trytimes < 20)
            {
                //Random distribution HACK! u can make more distribution types
                int tryx = MyRandom.Random.Next(0, room.RoomOccupiedGrid.GetLength(0) - size.X);
                int tryy = MyRandom.Random.Next(0, room.RoomOccupiedGrid.GetLength(1) - size.Y);

                if (CheckClear(new Coord(tryx, tryy), size,room.RoomOccupiedGrid))
                {
                    MakeNotCLear(new Coord(tryx, tryy), size, room.RoomOccupiedGrid);

                    thing.Initialise(size - new Coord(1, 1)
                   , room.Position + (new Vector2(tryx+1.5f, tryy+1.5f)*Globals.SmallGridSize)
                   , room.RoomAmbient.RoomColour, room.RoomAmbient.GlowColour, stats
                   , room.RoomAmbient.RoomTileset);
                    done = true;
                }
                trytimes++;
            }
        }
開發者ID:Wonko-the-sane,項目名稱:Artefact001,代碼行數:25,代碼來源:InhabitantsFactory.cs

示例3: Main

        private static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var coord0 = new Coord(input[1], input[2]);
            var rgcoord = new HashSet<Coord>();
            for (var i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                rgcoord.Add(new Coord(input[0], input[1]));
            }

            var d = 0;
            while (rgcoord.Any())
            {
                d++;
                var coord = rgcoord.First();
                var vX = coord.x - coord0.x;
                var vY = coord.y - coord0.y;

                foreach (var coordT in rgcoord.ToList())
                {
                    if (vY*(coordT.x - coord0.x) == vX*(coordT.y - coord0.y))
                        rgcoord.Remove(coordT);
                }
            }

            Console.WriteLine(d);
        }
開發者ID:encse,項目名稱:codeforces,代碼行數:29,代碼來源:p514B-9833983.cs

示例4: DrawTargetMark

        private static void DrawTargetMark(Unit currentUnit, Coord target, bool toShow)
        {
            if (toShow)
            {
                ZBuffer.ReadBuffer("targetBuffer", target.X, target.Y, 3, 3);

                var buffer = ZBuffer.BackupBuffer("defaultBuffer");
                ZIOX.OutputType = ZIOX.OutputTypeEnum.Buffer;
                ZIOX.BufferName = "defaultBuffer";

                var targetColor = IsTargetOnSoldier(currentUnit, target) ? Color.Yellow : Color.Cyan;

                ZIOX.Print(target.X-1, target.Y-1, (char)Tools.Get_Ascii_Byte('┌'), targetColor);
                ZIOX.Print(target.X+1, target.Y-1, (char)Tools.Get_Ascii_Byte('┐'), targetColor);
                ZIOX.Print(target.X-1, target.Y+1, (char)Tools.Get_Ascii_Byte('└'), targetColor);
                ZIOX.Print(target.X+1, target.Y+1, (char)Tools.Get_Ascii_Byte('┘'), targetColor);

                MapRender.DrawVisibleUnits(currentUnit);
                ZIOX.OutputType = ZIOX.OutputTypeEnum.Direct;

                ZBuffer.WriteBuffer("defaultBuffer", UIConfig.GameAreaRect.Left, UIConfig.GameAreaRect.Top);
                ZBuffer.SaveBuffer("defaultBuffer", buffer);
            }
            else
            {
                ZBuffer.WriteBuffer("targetBuffer", target.X, target.Y);
            }
        }
開發者ID:ZeroByte1987,項目名稱:ConsoleGames,代碼行數:28,代碼來源:TargetMark.cs

示例5: DoTargetAction

        public static Coord DoTargetAction(Unit unit)
        {
            var exitFlag = false;

            var target = new Coord(unit.Position.X, unit.Position.Y);
            DrawTargetMark(unit, target, true);

            while (!exitFlag)
            {
                var key = ZInput.ReadKey();
                var oldTarget = new Coord(target.X, target.Y);

                switch (key)
                {
                    case ConsoleKey.LeftArrow	:	MoveTarget(target, -1,  0);		break;
                    case ConsoleKey.RightArrow	:	MoveTarget(target, +1,  0);		break;
                    case ConsoleKey.UpArrow		:	MoveTarget(target,  0, -1);		break;
                    case ConsoleKey.DownArrow	:	MoveTarget(target,  0, +1);		break;

                    case ConsoleKey.Enter		:	return target;		break;
                    case ConsoleKey.Escape		:	exitFlag = true;	break;
                }

                if (!oldTarget.Equals(target))
                {
                    DrawTargetMark(unit, oldTarget, false);
                    DrawTargetMark(unit, target, true);
                }
            }

            return null;
        }
開發者ID:ZeroByte1987,項目名稱:ConsoleGames,代碼行數:32,代碼來源:TargetMark.cs

示例6: Room

 public Room(Coord aTopLeft, int aHeight, int aWidth, Direction aDirection)
 {
     iTopLeft = aTopLeft;
     iHeight = aHeight;
     iWidth = aWidth;
     iDoorLocation = aDirection;
 }
開發者ID:kjchiu,項目名稱:zomgame-2,代碼行數:7,代碼來源:Room.cs

示例7: DFS

        private static void DFS(Coord coord, Coord target, long sum, int[,] lab)
        {
            //if (!visited.Contains(coord))
            //{
                visited.Add(coord);

                if (coord.Equals(target))
                {
                    results.Add(sum);
                    return;
                }

                if (lab[coord.X, coord.Y] == 1)
                {
                    sum += 1;
                }

                if (coord.X + 1 < lab.GetLength(0))
                {
                    

                    DFS(new Coord(coord.X + 1, coord.Y), target, sum, lab);
                }
                if (coord.Y + 1 < lab.GetLength(1))
                {

                    DFS(new Coord(coord.X, coord.Y + 1), target, sum, lab);
                }
            //}
        }
開發者ID:GenoGenov,項目名稱:TelerikAcademyAssignments,代碼行數:30,代碼來源:Program.cs

示例8: Pieces

 protected Pieces(string name, Couleur couleur, Coord coord)
 {
     Name = name;
     Couleur = couleur;
     Coord = coord;
     Depart = true;
     Captured = false;
 }
開發者ID:theking973,項目名稱:ChessMVC,代碼行數:8,代碼來源:Pieces.cs

示例9: FlamingLongSword

 public FlamingLongSword(string name = "Flaming Long Sword", Coord position = new Coord())
     : base(name,
            position: position,
            specialAttack: Weapon.WeaponSpecialAttacks.Flaming,
            specialAttackDescription: Weapon.WeaponSpecialAttacks.Flaming.WeaponDescription())
 {
     
 }
開發者ID:Fux90,項目名稱:GodsWill_ASCIIRPG,代碼行數:8,代碼來源:LongSword.cs

示例10: StackItemTest

        public StackItemTest(   Color color = new Color(),
                                string description = "Stackable Item",
                                Coord position = new Coord(),
                                int uses = _UnlimitedUses)
            :base("Stack Item", "s", color: color, cost: 1, description: description, position: position, uses: uses)
        {

        }
開發者ID:Fux90,項目名稱:GodsWill_ASCIIRPG,代碼行數:8,代碼來源:StackItemTest.cs

示例11: ShardSet

 public ShardSet(Coord ul, Coord lr, int n)
 {
     var ur = new Coord(ul.X, lr.Y);
       var ll = new Coord(lr.X, ul.Y);
       _set = Split(new Shard(ul, ur, ll, lr), n);
       Console.WriteLine("n: " + n);
       Console.WriteLine("#shards: " + _set.Count);
 }
開發者ID:unhammer,項目名稱:gimp-sharp,代碼行數:8,代碼來源:ShardSet.cs

示例12: IsTargetOnSoldier

 public static bool IsTargetOnSoldier(Unit currentUnit, Coord target)
 {
     foreach (var team in MainGame.Teams)
         foreach (var unit in team.Units.Where(a => a.Name != currentUnit.Name))
             if (target.Equals(unit.Position))
                 return true;
     return false;
 }
開發者ID:ZeroByte1987,項目名稱:ConsoleGames,代碼行數:8,代碼來源:TargetMark.cs

示例13: GenerateByBuilderType

        public static Item GenerateByBuilderType(  Type type, 
                                            Pg.Level level = Pg.Level.Novice, 
                                            Coord position = new Coord())
        {

            return Generators.ContainsKey(type)
                ? Generators[type].GenerateRandom(level, position)
                : null;
        }
開發者ID:Fux90,項目名稱:GodsWill_ASCIIRPG,代碼行數:9,代碼來源:ItemGenerator.cs

示例14: Render

        public byte[] Render(Coord coord, string format, int tileWidth, int tileHeight)
        {
            ProxyProvider proxy;
            if (!this._proxyDictionary.TryGetValue(format.ToString(), out proxy))
                throw new InvalidTileFormatException(
                    string.Format("Invalid tile FORMAT {0}", format)
                );

            return proxy.Render(coord, format, tileWidth, tileHeight);
        }
開發者ID:jbrwn,項目名稱:tc,代碼行數:10,代碼來源:MultiProxyProvider.cs

示例15: Wall

        public Wall(Coord position)
            : base("Wall", 
                   "█", 
                   Color.LightGray, 
                   false, 
                   true,
                   "A rock wall",
                   position)
        {

        }
開發者ID:Fux90,項目名稱:GodsWill_ASCIIRPG,代碼行數:11,代碼來源:Wall.cs


注:本文中的System.Coord類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。