public void SetLocalCamera(int cameraId, bool enable)
 {
     if (!enable)
     {
         Field.BroadcastPacket(LocalCameraPacket.Camera(cameraId, 0));
     }
 }
Beispiel #2
0
    public void MiniGameCameraDirection(int boxId, int cameraId)
    {
        MapTriggerBox box = MapEntityMetadataStorage.GetTriggerBox(Field.MapId, boxId);

        if (box is null)
        {
            return;
        }

        List <IFieldObject <Player> > boxPlayers = new();

        foreach (IFieldObject <Player> player in Field.State.Players.Values)
        {
            if (FieldManager.IsPlayerInBox(box, player))
            {
                boxPlayers.Add(player);
            }
        }

        Random random = Random.Shared;
        int    index  = random.Next(boxPlayers.Count);
        IFieldObject <Player> randomPlayer = boxPlayers[index];

        Field.BroadcastPacket(LocalCameraPacket.Camera(cameraId, 1, randomPlayer.ObjectId));
    }