コード例 #1
0
        public async Task UpdateBlip() => await AltAsync.Do(async() =>
        {
            if (!BlipVisable)
            {
                return;
            }

            string blipName = BuildingFactory.CreateName(DbModel.BuildingType);
            int blip        = BuildingFactory.CreateBlip(DbModel.BuildingType, DbModel.OnSale);
            int color       = BuildingFactory.CreateColor(DbModel.OnSale, DbModel.BuildingType);

            await BlipHelper.UpdateGlobalBlip($"BUILDING{DbModel.Id}", blip, blipName, color);
        });
コード例 #2
0
        public async Task Spawn()
        {
            InteriorColshape           = Alt.CreateColShapeCylinder(new Position(DbModel.InternalPickupPositionX, DbModel.InternalPickupPositionY, DbModel.InternalPickupPositionZ - 0.9f), 1f, 2f);
            ExteriorColshape           = Alt.CreateColShapeCylinder(new Position(DbModel.ExternalPickupPositionX, DbModel.ExternalPickupPositionY, DbModel.ExternalPickupPositionZ - 0.9f), 1f, 2f);
            ExteriorColshape.Dimension = DbModel.Id;

            InteriorMarker = new MarkerModel()
            {
                Type         = 1,
                Dimension    = 0,
                PosX         = DbModel.InternalPickupPositionX,
                PosY         = DbModel.InternalPickupPositionY,
                PosZ         = DbModel.InternalPickupPositionZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"BUILDING_MARKER{DbModel.Id}"
            };

            ExteriorMarker = new MarkerModel()
            {
                Type         = 1,
                Dimension    = DbModel.Id,
                PosX         = DbModel.ExternalPickupPositionX,
                PosY         = DbModel.ExternalPickupPositionY,
                PosZ         = DbModel.ExternalPickupPositionZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"BUILDING_MARKER{DbModel.Id}"
            };

            await MarkerHelper.CreateGlobalMarker(InteriorMarker);

            await MarkerHelper.CreateGlobalMarker(ExteriorMarker);

            // Później to zmienić i dodać do bazy może, ale to się zobaczy
            if (DbModel.BuildingType == BuildingType.Apartament)
            {
                BlipVisable = false;
            }


            if (BlipVisable)
            {
                string blipName = BuildingFactory.CreateName(DbModel.BuildingType);
                int    blip     = BuildingFactory.CreateBlip(DbModel.BuildingType, DbModel.OnSale);
                int    color    = BuildingFactory.CreateColor(DbModel.OnSale, DbModel.BuildingType);
                Blip = new BlipModel()
                {
                    PosX       = DbModel.InternalPickupPositionX,
                    PosY       = DbModel.InternalPickupPositionY,
                    PosZ       = DbModel.InternalPickupPositionZ + 1,
                    Blip       = blip,
                    Color      = color, // Kolor pózniej do zmiany jak budynek będzie kupiony
                    Size       = EBlipSize.Medium,
                    Name       = blipName,
                    ShortRange = true,
                    UniqueID   = $"BUILDING{DbModel.Id}"
                };
                Alt.Log("Tworze blipa z budynkiem");
                await BlipHelper.CreateGlobalBlip(Blip);
            }
            EntityHelper.Add(this);
            InteriorColshape.SetData("building:data", this);
            ExteriorColshape.SetData("building:data", this);
        }