コード例 #1
0
ファイル: GuardedCrate.cs プロジェクト: bazz3l/GuardedCrate
            private void SpawnCrate()
            {
                _marker = GameManager.server.CreateEntity(MARKER_PREFAB, _position) as MapMarkerGenericRadius;
                if (_marker == null)
                {
                    return;
                }

                _marker.enableSaving = false;
                _marker.color1       = GetColor(_settings.MarkerColor);
                _marker.color2       = GetColor(_settings.MarkerBorderColor);
                _marker.alpha        = _settings.MarkerOpacity;
                _marker.radius       = 0.5f;
                _marker.Spawn();

                _crate = GameManager.server.CreateEntity(CRATE_PREFAB, _position, Quaternion.identity) as HackableLockedCrate;
                if (_crate == null)
                {
                    return;
                }

                _crate.enableSaving = false;
                _crate.shouldDecay  = false;
                _crate.SetWasDropped();
                _crate.Spawn();
                _crate.gameObject.GetOrAddComponent <DropComponent>();

                _marker.SetParent(_crate);
                _marker.transform.localPosition = Vector3.zero;
                _marker.SendUpdate();
            }
コード例 #2
0
        // MAP MARKERS
        private void PutTCMarksOnMap(Vector3 tcPos, string markerAuthNames)
        {
            MapMarkerGenericRadius m = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", tcPos) as MapMarkerGenericRadius;

            m.alpha  = 1.0f;
            m.color1 = Color.black;
            m.color2 = Color.black;
            m.radius = 2.5f;

            MapMarkerGenericRadius m2 = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", tcPos) as MapMarkerGenericRadius;

            m2.alpha  = 1.0f;
            m2.color1 = Color.cyan;
            m2.color2 = Color.black;
            m2.radius = 2.0f;

            VendingMachineMapMarker m3 = GameManager.server.CreateEntity("assets/prefabs/deployable/vendingmachine/vending_mapmarker.prefab", tcPos) as VendingMachineMapMarker;

            m3.markerShopName = markerAuthNames;

            m3.Spawn();
            m.Spawn();
            m.SendUpdate();
            m2.Spawn();
            m2.SendUpdate();

            listMarkersIDs.Add(m.GetInstanceID());
            listMarkersIDs.Add(m2.GetInstanceID());
            listMarkersIDs.Add(m3.GetInstanceID());
        }
コード例 #3
0
        private MapMarkerGenericRadius GetOrAddMarker(BasePlayer player, Vector3 pos)
        {
            if (!permission.UserHasPermission(player.UserIDString, permUse))
            {
                return(null);
            }
            List <MapMarkerGenericRadius> playerMarkers;

            if (!_mapMarker.TryGetValue(player.userID, out playerMarkers))
            {
                _mapMarker.Add(player.userID, playerMarkers = new List <MapMarkerGenericRadius>());
            }
            MapMarkerGenericRadius marker = playerMarkers.FirstOrDefault(m => m.transform.position == pos);

            marker = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", pos) as MapMarkerGenericRadius;
            if (marker == null)
            {
                return(null);
            }
            marker.alpha = _config.markerAlpha;
            string colorMarker  = _config.markerColor;
            string colorOutline = _config.markerColorOutline;

            ColorUtility.TryParseHtmlString($"#{colorMarker}", out marker.color1);
            ColorUtility.TryParseHtmlString($"#{colorOutline}", out marker.color2);
            marker.radius  = _config.markerRadius;
            marker.OwnerID = player.userID;
            playerMarkers.Add(marker);
            marker.Spawn();
            return(marker);
        }
コード例 #4
0
 private void OnServerInitialized()
 {
     _marker        = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", new Vector3(0, 100, 0)) as MapMarkerGenericRadius;
     _marker.alpha  = 1;
     _marker.color1 = Color.black;
     _marker.color2 = Color.black;
     _marker.radius = ConVar.Server.worldsize;
     _marker.Spawn();
     _marker.SendUpdate();
 }
コード例 #5
0
 private void UpdateMarker(Vector3 position)
 {
     mapMarker?.Kill();
     mapMarker        = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", position) as MapMarkerGenericRadius;
     mapMarker.alpha  = 0.8f;
     mapMarker.color1 = Color.red;
     mapMarker.color2 = Color.red;
     mapMarker.radius = 2;
     mapMarker.Spawn();
     mapMarker.SendUpdate();
 }
コード例 #6
0
 private void UpdateMarker()
 {
     _marker.Kill();
     _marker.Spawn();
     _marker.SendUpdate();
 }