コード例 #1
0
        public void SetMiniMap(MiniMapDTO miniMap)
        {
            MiniMap = miniMap;

            MiniMap.SpawnPointDTOList = new List <SlotSpawnDTO>();
            MiniMap.SpawnPointDTOList.Add(new SlotSpawnDTO()
            {
                Coordinates         = new Vector2(MiniMap.Coordinates.x + 1, MiniMap.Coordinates.y),
                SpawnPointTransform = _spawnRight
            });
            MiniMap.SpawnPointDTOList.Add(new SlotSpawnDTO()
            {
                Coordinates         = new Vector2(MiniMap.Coordinates.x - 1, MiniMap.Coordinates.y),
                SpawnPointTransform = _spawnLeft
            });
            MiniMap.SpawnPointDTOList.Add(new SlotSpawnDTO()
            {
                Coordinates         = new Vector2(MiniMap.Coordinates.x, MiniMap.Coordinates.y + 1),
                SpawnPointTransform = _spawnUp
            });
            MiniMap.SpawnPointDTOList.Add(new SlotSpawnDTO()
            {
                Coordinates         = new Vector2(MiniMap.Coordinates.x, MiniMap.Coordinates.y - 1),
                SpawnPointTransform = _spawnDown
            });

            this.UpdateUI();
        }
コード例 #2
0
        public void UpdateMiniMap(MiniMapDTO miniMap)
        {
            MiniMap.HasPlayer = miniMap.HasPlayer;
            MiniMap.HasPoop   = miniMap.HasPoop;

            this.UpdateUI();
        }
コード例 #3
0
ファイル: MiniMapComponent.cs プロジェクト: vkaike2/Joguito
        public void RemoveMapComponent(MapComponent map)
        {
            _mapComponentList.Remove(map);
            MiniMapDTO currentMinimap = _miniMapList.FirstOrDefault(e => e.MapComponent.GetInstanceID() == map.GetInstanceID());

            _miniMapList.Remove(currentMinimap);
        }
コード例 #4
0
        public void DrawMiniMap(MiniMapDTO miniMap)
        {
            if (_mapSlotComponentList is null)
            {
                _mapSlotComponentList = new List <MapSlotComponent>();
            }

            MapSlotComponent mapSlotComponent = _mapSlotComponentList.Where(e => e.MiniMap.Coordinates == miniMap.Coordinates).FirstOrDefault();

            // => SpawnNewMiniMap
            if (mapSlotComponent is null)
            {
                Transform spotToSpawn = _defaultSpawnPoint;
                // => GetAdjasentSpot
                if (_mapSlotComponentList.Any())
                {
                    spotToSpawn = _mapSlotComponentList
                                  .Where(e => e.MiniMap.SpawnPointDTOList.Any(s => s.Coordinates == miniMap.Coordinates))
                                  .Select(e => e.MiniMap.SpawnPointDTOList.FirstOrDefault(s => s.Coordinates == miniMap.Coordinates).SpawnPointTransform)
                                  .FirstOrDefault();
                }

                GameObject gameObjectMap = Instantiate(_mapSlotPrefab, spotToSpawn);
                gameObjectMap.transform.parent     = _defaultSpawnPoint.transform;
                gameObjectMap.transform.localScale = _mapSlotPrefab.transform.localScale;

                mapSlotComponent = gameObjectMap.GetComponent <MapSlotComponent>();
                mapSlotComponent.SetMiniMap(miniMap);

                _mapSlotComponentList.Add(mapSlotComponent);
            }
            // => UpdateCurrentMiniMapSlot;
            else
            {
                mapSlotComponent.UpdateMiniMap(miniMap);
            }
        }