Пример #1
0
        public IPlayer Local()
        {
            if (playerPool.GetOrCreate((JSObject)player.GetObjectProperty("local"), out var playerEntity))
            {
                return(playerEntity);
            }

            return(null);
        }
Пример #2
0
        public bool GetOrCreate(IntPtr entityPointer, BaseObjectType baseObjectType, out IBaseObject entity)
        {
            bool result;

            switch (baseObjectType)
            {
            case BaseObjectType.Player:
                result = playerPool.GetOrCreate(entityPointer, out var player);
                entity = player;
                return(result);

            case BaseObjectType.Vehicle:
                result = vehiclePool.GetOrCreate(entityPointer, out var vehicle);
                entity = vehicle;
                return(result);

            case BaseObjectType.Blip:
                result = blipPool.GetOrCreate(entityPointer, out var blip);
                entity = blip;
                return(result);

            case BaseObjectType.Checkpoint:
                result = checkpointPool.GetOrCreate(entityPointer, out var checkpoint);
                entity = checkpoint;
                return(result);

            case BaseObjectType.VoiceChannel:
                result = voiceChannelPool.GetOrCreate(entityPointer, out var voiceChannel);
                entity = voiceChannel;
                return(result);

            case BaseObjectType.ColShape:
                result = colShapePool.GetOrCreate(entityPointer, out var colShape);
                entity = colShape;
                return(result);

            default:
                entity = default;
                return(false);
            }
        }
Пример #3
0
        public void OnCheckpoint(IntPtr checkpointPointer, IntPtr entityPointer, BaseObjectType baseObjectType,
                                 bool state)
        {
            if (!CheckpointPool.GetOrCreate(checkpointPointer, out var checkpoint))
            {
                return;
            }

            if (!BaseEntityPool.GetOrCreate(entityPointer, baseObjectType, out var entity))
            {
                return;
            }

            OnCheckPointEvent(checkpoint, entity, state);
        }