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


C# IntPoint3类代码示例

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


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

示例1: ConstructJob

        public ConstructJob(IJobObserver parent, ConstructMode mode, IItemObject[] items, IEnvironmentObject environment, IntPoint3 location)
            : base(parent)
        {
            m_mode = mode;
            m_items = items;
            m_environment = environment;
            m_location = location;

            m_state = 0;

            DirectionSet positioning;

            switch (mode)
            {
                case ConstructMode.Floor:
                    positioning = DirectionSet.Planar;
                    break;

                case ConstructMode.Pavement:
                    positioning = DirectionSet.Exact;
                    break;

                case ConstructMode.Wall:
                    positioning = DirectionSet.Planar;
                    break;

                default:
                    throw new Exception();
            }

            AddSubJob(new FetchItems(this, m_environment, m_location, items, positioning));
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:32,代码来源:ConstructJob.cs

示例2: CanWaterFlow

        bool CanWaterFlow(IntPoint3 from, IntPoint3 to)
        {
            if (!m_env.Contains(to))
                return false;

            IntVector3 v = to - from;

            Debug.Assert(v.IsNormal);

            var dstTerrain = m_env.GetTerrain(to);
            var dstInter = m_env.GetInterior(to);

            if (dstTerrain.IsBlocker || dstInter.IsBlocker)
                return false;

            if (v.Z == 0)
                return true;

            Direction dir = v.ToDirection();

            if (dir == Direction.Up)
                return dstTerrain.IsPermeable == true;

            var srcTerrain = m_env.GetTerrain(from);

            if (dir == Direction.Down)
                return srcTerrain.IsPermeable == true;

            throw new Exception();
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:30,代码来源:EnvWaterHandler.cs

示例3: SetupWorldForNewPlayer

        public override LivingObject[] SetupWorldForNewPlayer(Player player)
        {
            const int NUM_DWARVES = 1;

            // XXX entry location
            var env = this.World.AllObjects.OfType<Dwarrowdelf.Server.EnvironmentObject>().First();

            var list = new List<LivingObject>();

            for (int i = 0; i < NUM_DWARVES; ++i)
            {
                IntPoint3 p;
                do
                {
                    p = new IntPoint3(m_random.Next(env.Width), m_random.Next(env.Height), env.HomeLocation.Z);
                } while (!EnvironmentHelpers.CanEnter(env, p));

                var l = CreateDwarf(i);

                if (!l.MoveTo(env, p))
                    throw new Exception();

                list.Add(l);
            }

            return list.ToArray();
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:27,代码来源:MyEngine.cs

示例4: InitializeWorld

        public void InitializeWorld(World world)
        {
            CreateTerrain();

            IntPoint3? stairs = null;

            foreach (var p2 in m_terrainData.Size.Plane.Range())
            {
                var z = m_terrainData.GetHeight(p2);

                var p = new IntPoint3(p2, z);
                var td = m_terrainData.GetTileData(p);
                if (td.TerrainID == TerrainID.StairsDown)
                {
                    stairs = p;
                    break;
                }
            }

            if (stairs.HasValue == false)
                throw new Exception();

            m_env = EnvironmentObject.Create(world, m_terrainData, VisibilityMode.LivingLOS, stairs.Value);

            CreateMonsters();

            CreateDebugMonsterAtEntry();
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:28,代码来源:DungeonWorldCreator.cs

示例5: MoveTo

        public void MoveTo(ContainerObject dst, IntPoint3 dstLoc)
        {
            var src = this.Parent;
            var srcLoc = this.Location;

            if (src != dst)
            {
                if (src != null)
                    src.RemoveChild(this);

                this.Parent = dst;
            }

            if (srcLoc != dstLoc)
            {
                this.Location = dstLoc;
                if (dst != null && src == dst)
                    dst.MoveChild(this, srcLoc, dstLoc);
            }

            if (src != dst)
            {
                if (dst != null)
                    dst.AddChild(this);
            }

            if (src != dst || srcLoc != dstLoc)
                if (ObjectMoved != null)
                    ObjectMoved(this, this.Parent, this.Location);
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:30,代码来源:MovableObject.cs

示例6: ContainsPoint

 public ItemObject ContainsPoint(IntPoint3 p)
 {
     var data = m_jobDataList.Where(d => d.Mode == InstallMode.Install && d.Location == p).FirstOrDefault();
     if (data == null)
         return null;
     return data.Item;
 }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:InstallItemManager.cs

示例7: MoveBaseAssignment

 protected MoveBaseAssignment(IJobObserver parent, IEnvironmentObject environment, IntPoint3 location)
     : base(parent)
 {
     this.Environment = environment;
     this.Location = location;
     m_state = 0;
 }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:MoveBaseAssignment.cs

示例8: MapSelection

 public MapSelection(IntPoint3 start, IntPoint3 end)
     : this()
 {
     this.SelectionStart = start;
     this.SelectionEnd = end;
     this.IsSelectionValid = true;
 }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:MapControlSelectionService.cs

示例9: GetVisible

        bool GetVisible(IntPoint3 p)
        {
            if (m_visibilityArray == null)
                return false;

            return m_visibilityArray[p.Z, p.Y, p.X];
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:VisionTrackerGlobalFOV.cs

示例10: Sees

        public override bool Sees(IntPoint3 p)
        {
            if (!m_environment.Contains(p))
                return false;

            return GetVisible(p);
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:VisionTrackerGlobalFOV.cs

示例11: GetPossiblePositioning

        static DirectionSet GetPossiblePositioning(IEnvironmentObject env, IntPoint3 p, MineActionType mineActionType)
        {
            DirectionSet pos;

            var down = p + Direction.Down;

            switch (mineActionType)
            {
                case MineActionType.Mine:
                    pos = DirectionSet.Planar;

                    if (EnvironmentHelpers.CanMoveFrom(env, down, Direction.Up))
                        pos |= DirectionSet.Down;

                    break;

                case MineActionType.Stairs:
                    pos = DirectionSet.Planar | DirectionSet.Up;

                    if (EnvironmentHelpers.CanMoveFrom(env, down, Direction.Up))
                        pos |= DirectionSet.Down;

                    break;

                case MineActionType.Channel:
                    pos = DirectionSet.Planar;
                    break;

                default:
                    throw new Exception();
            }

            return pos;
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:34,代码来源:MoveMineAssignment.cs

示例12: MineAssignment

 public MineAssignment(IJobObserver parent, IEnvironmentObject environment, IntPoint3 location, MineActionType mineActionType)
     : base(parent)
 {
     m_environment = environment;
     m_location = location;
     m_mineActionType = mineActionType;
 }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:7,代码来源:MineAssignment.cs

示例13: CanReach

        /* Parallel */
        /// <summary>
        /// Returns if dst can be reached from src
        /// </summary>
        public static bool CanReach(IAStarEnvironment environment, IntPoint3 src, IntPoint3 dst, DirectionSet dstPositioning)
        {
            Debug.Assert(environment != null);

            // Do pathfinding to both directions simultaneously to detect faster if the destination is blocked
            CancellationTokenSource cts = new CancellationTokenSource();

            AStarResult resBackward = null;
            AStarResult resForward = null;

            var taskForward = new Task(delegate
            {
                resForward = Find(environment, src, DirectionSet.Exact, dst, dstPositioning, 200000, cts.Token);
            });
            taskForward.Start();

            var taskBackward = new Task(delegate
            {
                resBackward = Find(environment, dst, dstPositioning, src, DirectionSet.Exact, 200000, cts.Token);
            });
            taskBackward.Start();

            Task.WaitAny(taskBackward, taskForward);

            cts.Cancel();

            Task.WaitAll(taskBackward, taskForward);

            if (resForward.Status == AStarStatus.Found || resBackward.Status == AStarStatus.Found)
                return true;
            else
                return false;
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:37,代码来源:AStar.cs

示例14: CreateGrass

        public static void CreateGrass(TerrainData terrain, Random random, int grassLimit)
        {
            var grid = terrain.TileGrid;
            var heightMap = terrain.HeightMap;

            int w = terrain.Width;
            int h = terrain.Height;

            var materials = Materials.GetMaterials(MaterialCategory.Grass).ToArray();
            for (int y = 0; y < h; ++y)
            {
                for (int x = 0; x < w; ++x)
                {
                    int z = heightMap[y, x];

                    var p = new IntPoint3(x, y, z);

                    if (z < grassLimit)
                    {
                        var td = grid[p.Z, p.Y, p.X];

                        if (Materials.GetMaterial(td.TerrainMaterialID).Category == MaterialCategory.Soil &&
                            (td.TerrainID.IsFloor() || td.TerrainID.IsSlope()))
                        {
                            td.InteriorID = InteriorID.Grass;
                            td.InteriorMaterialID = materials[random.Next(materials.Length)].ID;

                            grid[p.Z, p.Y, p.X] = td;
                        }
                    }
                }
            }
        }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:33,代码来源:TerrainHelpers.cs

示例15: ConstructAssignment

 public ConstructAssignment(IJobObserver parent, ConstructMode mode, IEnvironmentObject environment, IntPoint3 location, IItemObject[] items)
     : base(parent)
 {
     m_mode = mode;
     m_environment = environment;
     m_location = location;
     m_items = items;
 }
开发者ID:Fulborg,项目名称:dwarrowdelf,代码行数:8,代码来源:ConstructAssignment.cs


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