Exemplo n.º 1
0
        private bool DiskLost()
        {
            if (((gameObject.AssumedWorldPosServer() - MatrixManager.MainStationMatrix.GameObject.AssumedWorldPosServer())
                 .magnitude < boundRadius))
            {
                return(false);
            }

            if (escapeShuttle != null && escapeShuttle.Status != EscapeShuttleStatus.DockedCentcom)
            {
                var matrixInfo = escapeShuttle.MatrixInfo;
                if (matrixInfo == null || BoundsExtensions.Contains(matrixInfo.LocalBounds, registerTile.WorldPositionServer))
                {
                    return(false);
                }
            }
            else
            {
                ItemSlot slot = pick.ItemSlot;
                if (slot == null)
                {
                    return(true);
                }

                RegisterPlayer player = slot.Player;
                if (player == null)
                {
                    return(true);
                }

                if (player.GetComponent <PlayerHealthV2>().IsDead)
                {
                    return(true);
                }

                var checkPlayer = PlayerList.Instance.Get(player.gameObject, true);
                if (checkPlayer.Equals(ConnectedPlayer.Invalid))
                {
                    return(true);
                }

                if (PlayerList.Instance.AntagPlayers.Contains(checkPlayer) == false)
                {
                    return(true);
                }
            }
            return(false);
        }
        public override void OnEventStartTimed()
        {
            var stationBounds = MatrixManager.MainStationMatrix.LocalBounds;

            float width  = 0.35f * (stationBounds.xMax - stationBounds.xMin);
            float height = 0.35f * (stationBounds.yMax - stationBounds.yMin);
            float minX   = Random.Range(stationBounds.xMin, stationBounds.xMax - width);
            float minY   = Random.Range(stationBounds.yMin, stationBounds.yMax - height);

            var region = new Bounds();

            region.SetMinMax(new Vector2(minX, minY), new Vector2(minX + width, minY + height));

            foreach (var light in FindObjectsOfType <LightSource>())
            {
                if (BoundsExtensions.Contains(region, light.gameObject.RegisterTile().WorldPositionServer))
                {
                    StartCoroutine(BreakLight(light));
                }
            }
        }