コード例 #1
0
        public void Start()
        {
            StreamReader MapWriter = new StreamReader("pasta\\Map0.json");
            Map          objectMap = Map.LoadMapFromJson(MapWriter.ReadToEnd());

            MapWriter.Close();
            Map = objectMap;
            foreach (UserSession user in Room.RoomMembers)
            {
                user.UserGameState = new InMatchState(user, this);

                foreach (UserSession spawnPlayer in Room.RoomMembers)
                {
                    IMapElement sp = objectMap.GetMapElementByName <IMapElement>("sp");
                    spawnPlayer.position = sp.Position;
                    NetOutgoingMessage SendAllPlayersPositionToCurrentSession = user.Connection.Peer.CreateMessage();
                    SendAllPlayersPositionToCurrentSession.Write(SpawnPacket.OpCode);
                    SendAllPlayersPositionToCurrentSession.Write(spawnPlayer.ID);
                    user.Connection.SendMessage(SendAllPlayersPositionToCurrentSession, NetDeliveryMethod.UnreliableSequenced, SendAllPlayersPositionToCurrentSession.LengthBytes);
                }
            }
            SendPositionInterval.Start();
            GameTimeInterval.Start();
            Started = true;
        }
コード例 #2
0
 void SetMapElement(IMapElement mapElement)
 {
     RemoveMapElementEventHandlers();
     currentMapElement = mapElement;
     AddMapElementEventHandlers();
     Draw();
 }
コード例 #3
0
    public IMapElement GetNonDestroyObject(Transform parent)
    {
        IMapElement element = Instantiate(_nonDestroyObjects[Random.Range(0, _nonDestroyObjects.Count)], parent);

        element.RandomRotate();
        return(element);
    }
コード例 #4
0
ファイル: MapCreator.cs プロジェクト: smithvs/Sokoban
        public static IMapElement[,] Create(List <string> mapTemplate)
        {
            Exception e = null;

            if (!TryMapTemplate(mapTemplate, e))
            {
                throw e;
            }

            var map = new IMapElement[mapTemplate.Count, mapTemplate[0].Length];

            for (int i = 0; i < mapTemplate.Count; i++)
            {
                for (int j = 0; j < mapTemplate[i].Length; j++)
                {
                    map[i, j] = CreateEntityBySymbol(mapTemplate[i][j], i, j);
                }
            }

            //if (countPlayer != 1)
            //    throw new ArgumentException("Can't define current Player position");

            //if (countBox > countBoxParking)
            //    throw new ArgumentException("Count Box more count Box Parking ");

            return(map);
        }
コード例 #5
0
    public IMapElement GetDestroyObject()
    {
        IMapElement element = _destroyObjects[Random.Range(0, _destroyObjects.Count)];

        element.RandomRotate();
        return(element);
    }
コード例 #6
0
 public MapElementContainer(int x, int y, IMapElement mapElement, IBlowingElement blowingElement = null)
 {
     X              = x;
     Y              = y;
     MapElement     = mapElement;
     BlowingElement = blowingElement;
 }
コード例 #7
0
        void Inspect()
        {
            IMapElement targetMapElement = agent.TargetMapElement;

            bool isNotNullMapElement = targetMapElement != null;
            bool isNotSelf           = targetMapElement != agent;

            if (isNotNullMapElement && isNotSelf)
            {
                bool isEnemy = GetIsEnemy(targetMapElement);
                if (isEnemy)
                {
                    agent.Description = "Found enemy " + targetMapElement.DisplayName;
                    agent.HandleTransition(enemyFoundTransition);
                }
                else
                {
                    bool isItem = GetIsItem(targetMapElement);
                    if (isItem)
                    {
                        agent.Description = "Found item " + targetMapElement.DisplayName;
                        agent.HandleTransition(itemFoundTransition);
                    }
                    else
                    {
                        agent.HandleTransition(nothingFoundTransition);
                    }
                }
            }
            else
            {
                agent.HandleTransition(nothingFoundTransition);
            }
        }
コード例 #8
0
ファイル: WorldManager.cs プロジェクト: ixi150/garbage-puzzle
 public static void AddElement(Vector2Int pos, IMapElement element)
 {
     if (!HasElement(pos) && IsThereTile(pos))
     {
         map.Add(pos, element);
     }
 }
コード例 #9
0
 /// <summary>
 /// 更新列表的显示(递归)
 /// </summary>
 /// <param name="items"></param>
 private void UpdateItemList(IMapElement <EntryDataInfo>[] items)
 {
     foreach (IMapElement <EntryDataInfo> item in items)
     {
         EditorGUILayout.BeginHorizontal();
         GUILayout.Space(15 * item.Deep);
         if (selectTarget != null && selectTarget.ID == item.ID)
         {
             if (GUILayout.Button(item.ID + ":" + item.Value.Name, buttonSelectStyle))
             {
                 selectTarget = item; selectEntryValueType = EntryDataInfo.EnumEntryValueType.Title;
             }
         }
         else
         {
             if (GUILayout.Button(item.ID + ":" + item.Value.Name))
             {
                 selectTarget = item; selectEntryValueType = EntryDataInfo.EnumEntryValueType.Title;
             }
         }
         EditorGUILayout.EndHorizontal();
         //便利子节点
         IMapElement <EntryDataInfo>[] childs = item.Next(EnumMapTraversalModel.More);
         if (childs.Length > 0)
         {
             UpdateItemList(childs);
         }
     }
 }
コード例 #10
0
 void InitMapElement()
 {
     if (mapElement == null)
     {
         mapElement = MapElementHelper.Create(gameObject, this);
         mapElement.AddToMap();
     }
 }
コード例 #11
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ContentContainer.LoadContent(Content);

            objectInspector = new ObjectInspector(this);

            gameEffect = Content.Load <Effect>("Effect\\effect");
            tex        = Content.Load <Texture2D>("character");
            font       = Content.Load <SpriteFont>("File");


            Map = new Map(Content, GraphicsDevice);


            SetUpVertices();
            player = new Player(Vector2.Zero);
            Engine.GameUtility.Physic.Point circle = new Engine.GameUtility.Physic.Point(new Vector2(positionOnPlane.X, positionOnPlane.Z));
            player.CollisionObject              = circle;
            player.CollisionObject.OnCollision += new CollideDetected(delegate(ICollider item)
            {
                if (item.GetType() == typeof(Polygon))
                {
                    MessageBox.Show("Collide", "Circle<>Linse", new string[] { "walsiw" });
                }
            });
            player.CollisionObject.OnCollision += new CollideDetected(EventMethod);
            Director.InstanceDirector.Camera.SetDevice(this.GraphicsDevice);


            model = Content.Load <Model>("robot");



            BiStableKey tempKey = new BiStableKey(Keys.Space);

            tempKey.action += new ClickTrigger(delegate
            {
                IMapElement el = Map.GetMapElementByName <IMapElement>(objectInspector.selectedID);
                if (el != null)
                {
                    Map.GetMapElementByName <IMapElement>(objectInspector.selectedID).Position = new Vector2(positionOnPlane.X, positionOnPlane.Z);
                }
                else
                {
                    IFloor floor = Map.GetMapElementByName <IFloor>(objectInspector.selectedID);
                    floor.FloorPolygon
                    .AddPoint(new VertexPositionColor(positionOnPlane + new Vector3(0, 1, 0), Color.BlueViolet));
                }
            });

            keys.Add(tempKey);


            // MapWriter.Write(jsonSerialize);
        }
コード例 #12
0
 /// <summary>
 /// 移除指定的元素
 /// </summary>
 /// <param name="iMapElement">指定的元素</param>
 /// <returns>是否移除成功</returns>
 public bool Remove(IMapElement <T> iMapElement)
 {
     if (iMapElements.Contains(iMapElement))
     {
         iMapElements.Remove(iMapElement);                           //本届点移除对应的元素
         iMapElement.CorrelativesNode.UpdateRemove(baseIMapElement); //对应的元素移除本届点
         return(true);
     }
     return(false);
 }
コード例 #13
0
 /// <summary>
 /// 更新添加图节点
 /// 仅供内部调用
 /// </summary>
 /// <param name="iMapElement">图节点</param>
 public void UpdateAdd(IMapElement <T> iMapElement)
 {
     if (iMapElement.CorrelativesNode.Contains(baseIMapElement))
     {
         if (!iMapElements.Contains(iMapElement))
         {
             iMapElements.Add(iMapElement);
         }
     }
 }
コード例 #14
0
 /// <summary>
 /// 更新移除指定节点
 /// 仅供内部调用
 /// </summary>
 /// <param name="iMapElement"></param>
 public void UpdateRemove(IMapElement <T> iMapElement)
 {
     if (!iMapElement.CorrelativesNode.Contains(baseIMapElement))//如果传来的机欸但已经不包含本届点了,则移除,如果还包含,则说明不是使用Remove函数移除的,不需要理财
     {
         if (iMapElements.Contains(iMapElement))
         {
             iMapElements.Remove(iMapElement);
         }
     }
 }
コード例 #15
0
        /// <summary>
        /// 移除指定下标的元素
        /// </summary>
        /// <param name="index">下标</param>
        /// <returns>是否成功</returns>
        public bool Remove(int index)
        {
            IMapElement <T> iMapElement = this[index];

            if (iMapElement != null)
            {
                return(Remove(iMapElement));
            }
            return(false);
        }
コード例 #16
0
        protected override void RemoveElement(IMapElement mapElement)
        {
            if (mapElementToHashId.ContainsKey(mapElement))
            {
                hashIdToMapElement[mapElementToHashId[mapElement]].Remove(mapElement);
            }

            mapElementToHashId.Remove(mapElement);
            OnElementRemoved?.Invoke(mapElement);
        }
コード例 #17
0
ファイル: LevelManager.cs プロジェクト: GustavGMD/ComboMaker
    private bool MoveElementRoutine(IMapElement element, Vector2Int targetPosition)
    {
        if (mapElements.ContainsKey(targetPosition))
        {
            return(false);
        }

        mapElements.Remove(element.GetPosition());
        element.Move(targetPosition);
        mapElements.Add(targetPosition, element);
        return(true);
    }
コード例 #18
0
        // TODO: Maybe have a "drag" helper which lets us subscribe to the whole mouse down -> drag -> mouse up
        // and encapsulate its lifecycle.
        #region MouseDrag
        private void HandleMouseHeldOnElement(IMapElement mapElement)
        {
            if (_inputLock.IsLocked)
            {
                return;
            }

            _mouseDragLock = _inputLock.Lock();
            _gridInputManager.LeftMouseDragOnTile.Subscribe(coords => HandleElementDragged(mapElement, coords));
            _mouseUpObserver = Observable.EveryUpdate()
                               .Where(_ => Input.GetMouseButtonUp(0))
                               .Subscribe(_ => HandleMouseUp());
        }
コード例 #19
0
ファイル: Box.cs プロジェクト: smithvs/Sokoban
        public Box(int x, int y, IMapElement entity)
        {
            if (entity is Wall)
            {
                throw new ArgumentException("Box can't stay in Wall");
            }
            if (entity is BoxParking)
            {
                InParking = true;
            }
            entity.SetBox(this);

            Position = new Position(x, y);
        }
コード例 #20
0
    private void GenerateTile(Vector3[] positions, MapElementTypes mapElementTypes)
    {
        if (_pool == null)
        {
            _pool = FindObjectOfType <MapElementPool>();
        }

        for (int i = 0; i < positions.Length; i++)
        {
            IMapElement prefab     = mapElementTypes == MapElementTypes.Destroy ? _pool.GetDestroyObject() : _pool.GetNonDestroyObject();
            IMapElement mapElement = Instantiate((MapElement)prefab, transform);
            mapElement.SetElement(GetPosition() + positions[i]);
            _mapElements.Add(mapElement);
        }
    }
コード例 #21
0
ファイル: LevelManager.cs プロジェクト: GustavGMD/ComboMaker
    void Start()
    {
        //initialize DoTween
        DOTween.Init();

        //Initialize some other elements
        inputManager.OnPlayerMovePressed.AddListener(OnMovePlayerPressed);

        //Instantiate Player
        GameObject instantiatedPlayer = Instantiate(playerObject, Vector3.zero, Quaternion.identity);

        Utilities.GetIMapElement(instantiatedPlayer).SetPosition(new Vector2Int(4, 2));
        AddElementToMap(instantiatedPlayer);
        playerElement = Utilities.GetIMapElement(instantiatedPlayer);

        //Now some Obstacles at random positions
        for (int i = 0; i < 8; i++)
        {
            Vector2Int tryPosition = new Vector2Int(UnityEngine.Random.Range(0, mapWidth), UnityEngine.Random.Range(0, mapHeight));
            if (mapElements.ContainsKey(tryPosition))
            {
                break;
            }

            GameObject instantiatedObstacle = Instantiate(obstacleObject, Vector3.zero, Quaternion.identity);
            instantiatedObstacle.transform.position = (Vector2)tryPosition;
            AddElementToMap(instantiatedObstacle);
        }

        //Finally some enemiezzz
        enemyElements = new List <IMapElement>();
        for (int i = 0; i < 8; i++)
        {
            Vector2Int tryPosition = new Vector2Int(UnityEngine.Random.Range(0, mapWidth), UnityEngine.Random.Range(0, mapHeight));
            if (mapElements.ContainsKey(tryPosition))
            {
                break;
            }

            GameObject instantiatedEnemy = Instantiate(enemyObject, Vector3.zero, Quaternion.identity);
            Utilities.GetIMapElement(instantiatedEnemy).SetPosition(tryPosition);
            AddElementToMap(instantiatedEnemy);
            enemyElements.Add(Utilities.GetIMapElement(instantiatedEnemy));
        }

        //Some final Routines
        CurrentTurn = Turn.PLAYER;
    }
コード例 #22
0
        /// <summary>
        /// Gets the highest ranked map element within the agent location and the footprint locations.
        /// </summary>
        /// <returns>The highest ranked map element.</returns>
        IMapElement GetHighestRankedMapElement()
        {
            int         highestEnemyRank        = 0;
            int         highestItemRank         = 0;
            IMapElement highestRankedMapElement = null;

            List <IMapElement> mapElements = agent.Map.GetMapElementsAtCell <IMapElement>(agent.Location);

            foreach (IMapElement footprintElement in footprint.AllFootprintElements)
            {
                List <IMapElement> footprintMapElementsAtCell = agent.Map.GetMapElementsAtCell <IMapElement>(footprintElement.Location);
                mapElements.AddRange(footprintMapElementsAtCell);
            }

            foreach (IMapElement mapElement in mapElements)
            {
                if (mapElement == agent)
                {
                    continue;
                }

                bool isAttackable = GetIsAttackable(mapElement);
                if (isAttackable)
                {
                    bool isEnemy = GetIsEnemy(mapElement);
                    if (isEnemy)
                    {
                        int enemyRank = GetMapElementRank(mapElement);
                        if (enemyRank > highestEnemyRank)
                        {
                            highestEnemyRank        = enemyRank;
                            highestRankedMapElement = mapElement;
                        }
                    }
                }
                else if (highestEnemyRank == 0)
                {
                    int itemRank = GetMapElementRank(mapElement);
                    if (itemRank > highestItemRank)
                    {
                        highestItemRank         = itemRank;
                        highestRankedMapElement = mapElement;
                    }
                }
            }

            return(highestRankedMapElement);
        }
コード例 #23
0
        public static MapElementContainer[,] GenerateMap(IMapElement mapElement = null)
        {
            var testMap = new MapElementContainer[3, 3];

            testMap[0, 0] = new MapElementContainer(0, 0, new NonBreakableWall());
            testMap[0, 1] = new MapElementContainer(0, 1, new BreakableWall());
            testMap[0, 2] = new MapElementContainer(0, 2, new NonBreakableWall());
            testMap[1, 0] = new MapElementContainer(1, 0, new BreakableWall());
            testMap[1, 1] = new MapElementContainer(1, 1, mapElement ?? new EmptyField());
            testMap[1, 2] = new MapElementContainer(1, 2, new BreakableWall());
            testMap[2, 0] = new MapElementContainer(2, 0, new NonBreakableWall());
            testMap[2, 1] = new MapElementContainer(2, 1, new BreakableWall());
            testMap[2, 2] = new MapElementContainer(2, 2, new NonBreakableWall());

            return(testMap);
        }
コード例 #24
0
        public async UniTask Show(IntVector2 tileCoords, IMapElement mapElement)
        {
            Vector3 screenPosition =
                _camera.WorldToScreenPoint(_gridPositionCalculator.GetTileCenterWorldPosition(tileCoords));

            _radialMenu.Show(screenPosition);

            var result = await _removeButton.ToButtonCancellableTask(_cancelButton);

            if (!result.isCanceled)
            {
                mapElement.Remove();
            }

            await _radialMenu.Hide();
        }
コード例 #25
0
        void Generate()
        {
            int mapCellCount  = map.CellCount;
            int fillCellCount = Mathf.FloorToInt(mapCellCount * fillPercentage);

            Debug.Log("mapCellCount = " + mapCellCount + ", fillCellCount = " + fillCellCount);

            Vector2Int mapSize = map.Size;
            int        offsetX = -mapSize.x / 2;
            int        offsetY = -mapSize.y / 2;

            List <Vector2Int> occupiedCells = new List <Vector2Int>();

            foreach (MapGeneratorElementData data in datas)
            {
                int elementCount = Mathf.FloorToInt(data.Percentage * fillCellCount);
                Debug.Log("Generating " + elementCount + " " + data.Prefab.name);

                for (int i = 0; i < elementCount; i++)
                {
                    bool isMapFilled = occupiedCells.Count >= fillCellCount;
                    if (isMapFilled)
                    {
                        break;
                    }

                    GameObject mapElementGameObject = Instantiate(data.Prefab);
                    mapElementGameObject.transform.parent = transform;
                    IMapElement mapElement = mapElementGameObject.GetComponent <IMapElement>();
                    mapElement.DisplayName = mapElement.DisplayName + " " + i;
                    Vector2Int cell = new Vector2Int();

                    bool isLookingForCell = true;
                    while (isLookingForCell)
                    {
                        cell.x           = Random.Range(0, mapSize.x) + offsetX;
                        cell.y           = Random.Range(0, mapSize.y) + offsetY;
                        isLookingForCell = occupiedCells.Contains(cell);
                    }

                    occupiedCells.Add(cell);

                    Vector3 position = map.CellToLocal(cell);
                    mapElement.Position = position;
                }
            }
        }
コード例 #26
0
 /// <summary>
 /// 添加图节点
 /// </summary>
 /// <param name="iMapElement">图节点</param>
 /// <returns>是否添加成功</returns>
 public bool Add(IMapElement <T> iMapElement)
 {
     if (!CanAddFunc(iMapElement))
     {
         return(false);
     }
     if (iMapElements.Contains(iMapElement))
     {
         return(false);
     }
     if (baseIMapElement == iMapElement)
     {
         return(false);
     }
     iMapElements.Add(iMapElement);                           //添加该节点
     iMapElement.CorrelativesNode.UpdateAdd(baseIMapElement); //该节点添加本届点
     return(true);
 }
コード例 #27
0
        public EdgeResult EvaluateCondition(IMapElement mapElement)
        {
            bool isEdge            = false;
            bool isIncluded        = false;
            bool hasValidCondition = false;

            foreach (IEdgeCondOp conditionOperation in ConditionOperations)
            {
                EdgeResult evalResult = conditionOperation.EvaluateCondition(mapElement);

                /// If the operation we were given has a null Condition then we don't want to include this as it will dirty our result.
                if (evalResult.IsEdge.HasValue)
                {
                    hasValidCondition = true;
                    isEdge           |= evalResult.IsEdge.Value;
                    isIncluded       |= evalResult.IsIncluded;

                    /// This is just to squeeze a little more performance. If isEdge is false and isIncluded is true
                    /// then we can safely assume nothing will further change these values (consider the OR and AND
                    /// operators being used for each) and so we can end early.
                    if (isEdge && isIncluded)
                    {
                        break;
                    }
                }
            }

            if (hasValidCondition)
            {
                return(new EdgeResult()
                {
                    IsEdge = isEdge, IsIncluded = isIncluded
                });
            }
            else
            {
                return(new EdgeResult()
                {
                    IsEdge = null, IsIncluded = false
                });
            }
        }
コード例 #28
0
        /// <summary>
        /// Gets the given map element rank based off of the agent's desires and
        /// the map element's stats.
        /// </summary>
        int GetMapElementRank(IMapElement itemElement)
        {
            List <ITrait> desires = agent.Desires;
            List <ITrait> stats   = itemElement.Stats;

            int rank = 0;

            foreach (ITrait stat in stats)
            {
                foreach (ITrait desire in desires)
                {
                    if (stat.Id == desire.Id)
                    {
                        int statRank = stat.Quantity * desire.Quantity;
                        rank += statRank;
                    }
                }
            }
            return(rank);
        }
コード例 #29
0
        void HandleMouseClick()
        {
            RaycastHit2D hitInfo = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            IMapElement    mapElement     = null;
            SpriteRenderer spriteRenderer = null;

            if (hitInfo.transform != null)
            {
                GameObject hitGameObject = hitInfo.transform.gameObject;
                mapElement = hitGameObject.GetComponent <IMapElement>();
                if (mapElement != null)
                {
                    spriteRenderer = hitGameObject.GetComponentInChildren <SpriteRenderer>();
                }
            }

            SetCurrentSpriteRenderer(spriteRenderer);
            SetMapElement(mapElement);
        }
コード例 #30
0
        public IMapElement?GetNearestElementIn(List <IMapElement> elements)
        {
            if (elements.Count == 0)
            {
                return(null);
            }

            IMapElement nearest     = elements[0];
            float       minDistance = GetDistanceFrom(nearest.HitBox);

            foreach (var element in elements)
            {
                var distance = GetDistanceFrom(element.HitBox);
                if (distance < minDistance)
                {
                    minDistance = distance;
                    nearest     = element;
                }
            }

            return(nearest);
        }
コード例 #31
0
ファイル: AndEdgeCondOp.cs プロジェクト: chris-tomich/Glyma
        public EdgeResult EvaluateCondition(IMapElement mapElement)
        {
            bool isEdge = true;
            bool isIncluded = false;
            bool hasValidCondition = false;

            foreach (IEdgeCondOp conditionOperation in ConditionOperations)
            {
                EdgeResult evalResult = conditionOperation.EvaluateCondition(mapElement);

                /// If the operation we were given has a null Condition then we don't want to include this as it will dirty our result.
                if (evalResult.IsEdge.HasValue)
                {
                    hasValidCondition = true;
                    isEdge &= evalResult.IsEdge.Value;
                    isIncluded |= evalResult.IsIncluded;

                    /// This is just to squeeze a little more performance. If isEdge is false and isIncluded is true
                    /// then we can safely assume nothing will further change these values (consider the AND and OR
                    /// operators being used for each) and so we can end early.
                    if (!isEdge && isIncluded)
                    {
                        break;
                    }
                }
            }

            if (hasValidCondition)
            {
                return new EdgeResult() { IsEdge = isEdge, IsIncluded = isIncluded };
            }
            else
            {
                return new EdgeResult() { IsEdge = null, IsIncluded = false };
            }
        }
コード例 #32
0
		public MapSignTileInfo(MapSign mapSign)
		{
			MapElement = mapSign;
		}
コード例 #33
0
		public WarpTileInfo(Warp mapWarp)
		{
			MapElement = mapWarp;
		}
コード例 #34
0
        public EdgeResult EvaluateCondition(IMapElement mapElement)
        {
            if (Condition == null)
            {
                /// As we weren't given a Condition we want this to be ignored so other results aren't dirtied.
                return new EdgeResult() { IsEdge = null, IsIncluded = false };
            }

            if (mapElement is Node && Condition.EdgeElement == EdgeElementType.Relationship)
            {
                // If the mapElement type doesn't match the condition type then ignore this condition.
                return new EdgeResult() { IsEdge = null, IsIncluded = false };
            }
            else if (mapElement is Relationship && Condition.EdgeElement == EdgeElementType.Node)
            {
                // If the mapElement type doesn't match the condition type then ignore this condition.
                return new EdgeResult() { IsEdge = null, IsIncluded = false };
            }
            else if (!(mapElement is Node) && !(mapElement is Relationship))
            {
                // If the mapElement isn't a known type then ignore this condition.
                return new EdgeResult() { IsEdge = null, IsIncluded = false };
            }

            bool isEdge = false;

            switch (Condition.EdgeComponent)
            {
                case EdgeComponentType.Id:
                    isEdge = !mapElement.Id.Equals(Condition.ComponentValue);
                    break;

                case EdgeComponentType.OriginalId:
                    isEdge = !mapElement.OriginalId.Equals(Condition.ComponentValue);
                    break;

                case EdgeComponentType.Type:
                    isEdge = !mapElement.TypeId.Equals(Condition.ComponentValue);
                    break;

                case EdgeComponentType.Metadata:
                    MetadataEdgeConditionTest metadataCondition = Condition as MetadataEdgeConditionTest;

                    if (metadataCondition != null)
                    {
                        IEnumerable<KeyValuePair<MetadataContext, Metadata>> matchingMetadata = mapElement.Metadata.Where(item => item.Value.MetadataName.Equals(metadataCondition.MetadataName) == item.Value.MetadataValue.Equals(metadataCondition.ComponentValue));
                        isEdge = (matchingMetadata.Count() == 0);
                    }
                    else
                    {
                        isEdge = false;
                    }
                    break;

                default:
                    isEdge = false;
                    break;
            }

            return new EdgeResult() { IsEdge = isEdge, IsIncluded = Condition.IsIncluded };
        }
コード例 #35
0
		public NPCTileInfo(NPC npc)
		{
			MapElement = npc;
		}
コード例 #36
0
		public NPCTileInfo(NPCRecord npc)
		{
			MapElement = npc;
		}