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


C# ISpace类代码示例

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


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

示例1: TryGetSpace

 public bool TryGetSpace(IEntity entity, ISpace dreamPosition)
 {
     var res = FullSpaces.Any(s => s.Area.Intersects(dreamPosition.Area));
     if (!res)
         entitiesSpaces.Add(Tuple.Create(entity, dreamPosition));
     return !res;
 }
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:7,代码来源:LayoutManager.cs

示例2: Awake

	void Awake() {
		int[,] boardArr;

		var spaceArr = new ISpace<Tiles>[dims, dims];
		board = new TileSudokuBoard((int) dims, spaceArr);

		switch (SceneManager.GetActiveScene().name) {
		case "Tutorial":
			boardArr = tutorialBoard;
			board.EndPos = new int[] {2, 2};
			break;
		case "MainGame":
		default:
			Debug.Log ("name is " + SceneManager.GetActiveScene().name);
			boardArr = normalBoard;
			break;
		}


		if (prefab==null)
			throw new System.Exception("missing spacewrapper prefab");
		//var spaceArr = new ISpace<Tiles>[dims, dims];
		for (var i = 0; i < dims; ++i)
			for (var j = 0; j < dims; ++j) {
				spaceArr [i, j] = CreateSpaceWrapper (i, j, (Tiles)boardArr [i, j]);
				Debug.Log ("Set Tile " + boardArr [i, j].ToString () + " at position" + i.ToString () + ", " + j.ToString());

			}
	}
开发者ID:evan-erdos,项目名称:Sudoku-Reimagined,代码行数:29,代码来源:SudokuBoardWrapper.cs

示例3: Expand

        public override void Expand(ISpace space, Point markedPoint, Point unmarkedPoint)
        {
            Point prev = markedPoint;
            Point cur = unmarkedPoint;

            ScreenConstructionParameters scp = new ScreenConstructionParameters(cur, TerminalName, m_fractalCreator);

            space.AddScreen(scp, this.MissionNodeID);
            space.ConnectTwoWay(prev, cur, (Connection)space.GetConnection(prev, cur));

            if (m_objectPopulators.Count >= 1) scp.ObjectPopulator = m_objectPopulators[0];
            if (m_postProcessors.Count >= 1) scp.PostProcessor = m_postProcessors[0];

            for (int i = 1; i < m_length; ++i)
            {
                prev = cur;
                cur = DirectionUtils.Move(cur, m_bestEvaledDirection);

                scp = new ScreenConstructionParameters(cur, TerminalName, m_fractalCreator);

                space.AddScreen(scp, this.MissionNodeID);
                space.ConnectTwoWay(prev, cur, Connection.Open);

                if (m_objectPopulators.Count > i) scp.ObjectPopulator = m_objectPopulators[i];
                if (m_postProcessors.Count > i) scp.PostProcessor = m_postProcessors[i];
            }

            prev = cur;

            space.ConnectOneWay(prev, m_bestEvaledDirection.Move(prev), Connection.Door);
            space.ConnectOneWay(prev, m_bestEvaledDirection.RotationCW.Move(prev), Connection.Door);
            space.ConnectOneWay(prev, m_bestEvaledDirection.RotationCCW.Move(prev), Connection.Door);
        }
开发者ID:dallasmccall,项目名称:metroid-ai-project,代码行数:33,代码来源:LineCapsOnly.cs

示例4: FreeSpace

 public void FreeSpace(IEntity entity, ISpace space)
 {
     int index = entitiesSpaces.FindIndex(t => t.Item1 == entity && t.Item2 == space);
     if(index == -1 )
         throw new InvalidOperationException("Record is not in collection.");
     entitiesSpaces.RemoveAt(index);
 }
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:7,代码来源:LayoutManager.cs

示例5: OnAdditionToSpace

 public void OnAdditionToSpace(ISpace newSpace)
 {
     foreach(OperationalMachine o in machines)
         newSpace.Add(o);
     foreach(BaseModel m in models)
         newSpace.Add(m);
 }
开发者ID:snoozbuster,项目名称:accelerated-delivery,代码行数:7,代码来源:Machine.cs

示例6: Awake

 void Awake()
 {
     if (prefab==null)
         throw new System.Exception("missing spacewrapper prefab");
     var spaceArr = new ISpace<Tiles>[dims, dims];
     for (var i=0; i<dims; ++i)
         for (var j=0; j<dims; ++j)
             spaceArr[i,j] = CreateSpaceWrapper(i,j);
     board = new TileSudokuBoard((int) dims, spaceArr);
 }
开发者ID:mojoz0,项目名称:Sudoku-Reimagined,代码行数:10,代码来源:SudokuBoardWrapper.cs

示例7: GetToSpace

        private IEnumerable<ISpaceRouteElement> GetToSpace(IEntity entity, Tile currentTile, ISpace destSpace)
        {
            bool found = false;
            ISpace currentSpace = entity.Location.Space; //currentTile.LayoutManager.FindCurrentSpace(entity);

            if (currentSpace == destSpace)
                return new FourthSpaceRouteElement(currentSpace, currentTile).ToEnumerable();

            searcher.LayoutManager = currentTile.LayoutManager;
            searcher.StartSearch(AllSpaces.First(), currentSpace, 1, (space, layer, bundle) =>
            {
                if (space == destSpace)
                {
                    searcher.StopSearch();
                    found = true;
                }
            });

            return found ? searcher.GetShortestRoute(destSpace).Select(s => new FourthSpaceRouteElement(s, currentTile)) : null;
        }
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:20,代码来源:Small4GroupLayout.cs

示例8: Evaluate

        public override float Evaluate(ISpace space, Point markedPoint, Point unmarkedPoint)
        {
            // walk m_length tiles and verify they are all free
            Point cur = unmarkedPoint;
            for (int i = 0; i < m_length; ++i)
            {
                if (!space.IsAreaFree(cur)) return float.PositiveInfinity;
                cur = DirectionUtils.Move(cur, m_direction);
            }

            // went one too far, so back up to last tile in the dealio
            cur = DirectionUtils.Move(cur, m_direction.Opposite);

            int blockedCount = 0;
            if (!space.IsAreaFree(cur)) blockedCount++;
            if (!space.IsAreaFree(DirectionUtils.Move(cur, m_exitDir.RotationCW))) blockedCount++;
            if (!space.IsAreaFree(DirectionUtils.Move(cur, m_exitDir.RotationCCW))) blockedCount++;
            if (!space.IsAreaFree(DirectionUtils.Move(cur, m_exitDir))) blockedCount++;

            return blockedCount / 4.0f;
        }
开发者ID:dallasmccall,项目名称:metroid-ai-project,代码行数:21,代码来源:MissionTerminalExpanderDummy.cs

示例9: Evaluate

        public override float Evaluate(ISpace space, Point markedPoint, Point unmarkedPoint)
        {
            float bestCost = float.PositiveInfinity; // worst possible, best possible is 0

            foreach (Direction dir in m_directions)
            {
                // walk m_length tiles and verify they are all free
                Point cur = unmarkedPoint;
                int counter = 0;
                int blockedCounter = 0;
                for (int i = 0; i < m_length; ++i)
                {
                    if (!space.IsAreaFree(cur))
                    {
                        blockedCounter = Int32.MaxValue - 5;
                        break;
                    }

                    counter += 2;
                    if (!space.IsAreaFree(dir.RotationCW.Move(cur))) blockedCounter++;
                    if (!space.IsAreaFree(dir.RotationCCW.Move(cur))) blockedCounter++;

                    cur = dir.Move(cur);
                }

                counter++;
                if (!space.IsAreaFree(cur)) blockedCounter++; // one past the end

                float score = (float)blockedCounter / counter;

                if (score < bestCost)
                {
                    bestCost = score;
                    m_bestEvaledDirection = dir;
                }
            }

            return bestCost;
        }
开发者ID:dallasmccall,项目名称:metroid-ai-project,代码行数:39,代码来源:LineCapsOnly.cs

示例10: Expand

        public override void Expand(ISpace space, Point markedPoint, Point unmarkedPoint)
        {
            Point prev = markedPoint;
            Point cur = unmarkedPoint;

            ScreenConstructionParameters scp = new ScreenConstructionParameters(cur, TerminalName, m_fractalCreator);

            space.AddScreen(scp, this.MissionNodeID);
            space.ConnectTwoWay(prev, cur, Connection.Door);

            for (int i = 1; i < m_length; ++i)
            {
                prev = cur;
                cur = DirectionUtils.Move(cur, m_direction);

                scp = new ScreenConstructionParameters(cur, TerminalName, m_fractalCreator);

                space.AddScreen(scp, this.MissionNodeID);
                space.ConnectTwoWay(prev, cur, Connection.Open);

                if (i != m_length - 1)
                {
                    Point side = DirectionUtils.Move(cur, m_direction.RotationCW);
                    space.ConnectOneWay(cur, side, Connection.Door);
                    side = DirectionUtils.Move(cur, m_direction.RotationCCW);
                    space.ConnectOneWay(cur, side, Connection.Door);
                }
            }

            prev = cur;
            //cur = m_direction.Move(cur, m_exitDir);
            space.ConnectOneWay(prev, m_direction.Move(prev), Connection.Door);
            space.ConnectOneWay(prev, m_direction.RotationCW.Move(prev), Connection.Door);
            space.ConnectOneWay(prev, m_direction.RotationCCW.Move(prev), Connection.Door);
            //space.ConnectOneWay(prev, cur, Connection.Door);
        }
开发者ID:dallasmccall,项目名称:metroid-ai-project,代码行数:36,代码来源:MissionTerminalExpanderDummy.cs

示例11: OnRemovalFromSpace

        internal void OnRemovalFromSpace(ISpace space)
        {
            space.Remove(shape.detector);

            shape.OnRemovalFromSpace(space);
        }
开发者ID:rc183,项目名称:igf,代码行数:6,代码来源:Wheel.cs

示例12: OnRemovalFromSpace

 public void OnRemovalFromSpace(ISpace oldSpace)
 {
     oldSpace.Remove(Model);
     oldSpace.Remove(joint);
     Model.Ent.CollisionInformation.Events.PairTouching -= onCollision;
 }
开发者ID:snoozbuster,项目名称:accelerated-delivery,代码行数:6,代码来源:Button.cs

示例13: OnAdditionToSpace

 public void OnAdditionToSpace(ISpace newSpace)
 {
     newSpace.Add(Model);
     newSpace.Add(joint);
     Model.Ent.CollisionInformation.Events.PairTouching += onCollision;
 }
开发者ID:snoozbuster,项目名称:accelerated-delivery,代码行数:6,代码来源:Button.cs

示例14: Plan

 public Plan(ITile tile, ISpace space)
 {
     Tile = tile;
     Space = space;
     Arguments = new List<object>();
     Worths = new Dictionary<IPlayer, int>();
 }
开发者ID:llanes1990,项目名称:RecreatingInfiniteCity,代码行数:7,代码来源:Skynet.cs

示例15: GetSpaceWorth

        private int GetSpaceWorth(ISpace space, IPlayer player)
        {
            int worth;
            lock (_lock)
                if (_spaceWorths.TryGetValue(new Tuple<ISpace, IPlayer>(space, player), out worth))
                    return worth;

            var visited = new HashSet<ITile>();
            if (space.Tile != null)
                visited.Add(space.Tile);

            var groups = new List<List<ITile>>();
            foreach (ITile tile in space.AdjacentTiles.Where(t => t.HasToken(player) && !visited.Contains(t)))
            {
                var group = new List<ITile>();
                var queue = new Queue<ITile>(new[] {tile});
                while (queue.Count>0)
                {
                    ITile query = queue.Dequeue();
                    visited.Add(query);
                    group.Add(query);
                    foreach (ITile adj in query.Space.AdjacentTiles.Where(t => t.HasToken(player) && !visited.Contains(t)))
                        queue.Enqueue(adj);
                }
                groups.Add(group);
            }

            int[] sizes = groups.Select(g => g.Count).ToArray();
            if (sizes.Length == 0 || sizes.Sum()<GameState.SmallestScoringGroup-1)
                worth = 0;
            else
                worth = 1+sizes.Where(i => i<GameState.SmallestScoringGroup).Sum();

            lock (_lock)
                _spaceWorths[new Tuple<ISpace, IPlayer>(space, player)] = worth;
            return worth;
        }
开发者ID:llanes1990,项目名称:RecreatingInfiniteCity,代码行数:37,代码来源:Skynet.cs


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