当前位置: 首页>>代码示例>>C#>>正文


C# Vehicle.AttachBlip方法代码示例

本文整理汇总了C#中Vehicle.AttachBlip方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.AttachBlip方法的具体用法?C# Vehicle.AttachBlip怎么用?C# Vehicle.AttachBlip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle.AttachBlip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadMission

        public void LoadMission(MissionData tmpMiss)
        {

            if(tmpMiss.Cutscenes == null)
                tmpMiss.Cutscenes = new List<SerializableCutscene>();


            GameFiber.StartNew(delegate
            {
                LoadInteriors(tmpMiss);

                foreach (var vehicle in tmpMiss.Vehicles)
                {
                    var newv = new Vehicle(Util.RequestModel(vehicle.ModelHash), vehicle.Position)
                    {
                        PrimaryColor = Color.FromArgb((int)vehicle.PrimaryColor.X, (int)vehicle.PrimaryColor.Y,
                            (int)vehicle.PrimaryColor.Z),
                        SecondaryColor = Color.FromArgb((int)vehicle.SecondaryColor.X, (int)vehicle.SecondaryColor.Y,
                            (int)vehicle.SecondaryColor.Z),
                    };

                    var blip = newv.AttachBlip();
                    blip.Color = Color.Orange;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);

                    newv.Rotation = vehicle.Rotation;
                    vehicle.SetEntity(newv);
                }

                foreach (var ped in tmpMiss.Actors)
                {
                    ped.SetEntity(new Ped(Util.RequestModel(ped.ModelHash), ped.Position - new Vector3(0,0,1), ped.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    var blip = ped.GetEntity().AttachBlip();
                    blip.Color = Color.Orange;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);
                    if (ped.WeaponHash != 0)
                        ((Ped)ped.GetEntity()).GiveNewWeapon(ped.WeaponHash, ped.WeaponAmmo, true);

                }

                foreach (var o in tmpMiss.Objects)
                {
                    var newo = new Object(o.ModelHash, o.Position);
                    newo.Position = o.Position;
                    o.SetEntity(newo);
                }

                foreach (var spawnpoint in tmpMiss.Spawnpoints)
                {
                    spawnpoint.SetEntity(new Ped(spawnpoint.ModelHash, spawnpoint.Position - new Vector3(0,0,1), spawnpoint.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    if(spawnpoint.WeaponHash != 0)
                    ((Ped)spawnpoint.GetEntity()).GiveNewWeapon(spawnpoint.WeaponHash, spawnpoint.WeaponAmmo, true);
                    var blip = spawnpoint.GetEntity().AttachBlip();
                    blip.Color = Color.White;
                    _blips.Add(blip);
                }

                foreach (var pickup in tmpMiss.Pickups)
                {
                    var tmpObject = new Rage.Object("prop_mp_repair", pickup.Position);
                    tmpObject.Rotation = pickup.Rotation;
                    tmpObject.Position = pickup.Position;
                    tmpObject.IsPositionFrozen = true;
                    pickup.SetEntity(tmpObject);
                }

                foreach (var ped in tmpMiss.Objectives.OfType<SerializableActorObjective>())
                {
                    ped.SetPed(new Ped(Util.RequestModel(ped.ModelHash), ped.Position - new Vector3(0,0,1), ped.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    if (ped.WeaponHash != 0)
                        ((Ped)ped.GetPed()).GiveNewWeapon(ped.WeaponHash, ped.WeaponAmmo, true);
                    var blip = ped.GetPed().AttachBlip();
                    blip.Color = Color.Red;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);
                }

                foreach (var vehicle in tmpMiss.Objectives.OfType<SerializableVehicleObjective>())
                {
                    var newv = new Vehicle(Util.RequestModel(vehicle.ModelHash), vehicle.Position)
                    {
                        PrimaryColor = Color.FromArgb((int)vehicle.PrimaryColor.X, (int)vehicle.PrimaryColor.Y,
                            (int)vehicle.PrimaryColor.Z),
                        SecondaryColor = Color.FromArgb((int)vehicle.SecondaryColor.X, (int)vehicle.SecondaryColor.Y,
                            (int)vehicle.SecondaryColor.Z),
                    };
                    newv.Rotation = vehicle.Rotation;
                    var blip = newv.AttachBlip();
                    blip.Color = Color.Red;
//.........这里部分代码省略.........
开发者ID:LordRevan2,项目名称:MissionCreator,代码行数:101,代码来源:Editor.cs

示例2: CreateVehicle

        public SerializableVehicle CreateVehicle(SerializableVehicle orig)
        {
            var tmpVeh = new Vehicle(orig.GetEntity().Model, orig.GetEntity().Position, orig.GetEntity().Heading)
            {
                PrimaryColor = ((Vehicle)orig.GetEntity()).PrimaryColor,
                SecondaryColor = ((Vehicle)orig.GetEntity()).SecondaryColor,
            };

            var blip = tmpVeh.AttachBlip();
            blip.Color = Color.Orange;
            blip.Scale = 0.7f;
            _blips.Add(blip);

            tmpVeh.IsPositionFrozen = false;
            tmpVeh.Rotation = orig.GetEntity().Rotation;
            var tmpObj = (SerializableVehicle)orig.Clone();
            tmpObj.SetEntity(tmpVeh);
            CurrentMission.Vehicles.Add(tmpObj);
            return tmpObj;
        }
开发者ID:LordRevan2,项目名称:MissionCreator,代码行数:20,代码来源:Editor.cs

示例3: CreateVehicleObjective

        public SerializableVehicleObjective CreateVehicleObjective(SerializableVehicleObjective orig)
        {
            var tmpVeh = new Vehicle(orig.GetVehicle().Model, orig.GetVehicle().Position)
            {
                PrimaryColor = orig.GetVehicle().PrimaryColor,
                SecondaryColor = orig.GetVehicle().SecondaryColor,
            };
            var blip = tmpVeh.AttachBlip();
            blip.Color = Color.Red;
            blip.Scale = 0.7f;
            _blips.Add(blip);

            tmpVeh.IsPositionFrozen = false;
            tmpVeh.Rotation = orig.GetVehicle().Rotation;
            var tmpObj = (SerializableVehicleObjective)orig.Clone();
            tmpObj.SetVehicle(tmpVeh);
            CurrentMission.Objectives.Add(tmpObj);
            return tmpObj;
        }
开发者ID:LordRevan2,项目名称:MissionCreator,代码行数:19,代码来源:Editor.cs

示例4: AdvanceStage

        private void AdvanceStage()
        {
            TimerBars = new TimerBars();
            CurrentStage++;
            CurrentObjectives.Clear();


            foreach (var veh in CurrentMission.Vehicles.Where(v => v.SpawnAfter == CurrentStage))
            {
                var newv = new Vehicle(Util.RequestModel(veh.ModelHash), veh.Position)
                {
                    PrimaryColor = Color.FromArgb((int)veh.PrimaryColor.X, (int)veh.PrimaryColor.Y,
                    (int)veh.PrimaryColor.Z),
                    SecondaryColor = Color.FromArgb((int)veh.SecondaryColor.X, (int)veh.SecondaryColor.Y,
                    (int)veh.SecondaryColor.Z),
                };
                newv.Health = veh.Health;
                newv.Rotation = veh.Rotation;
                GameFiber.StartNew(delegate
                {
                    while (IsMissionPlaying && (veh.RemoveAfter == 0 || veh.RemoveAfter > CurrentStage))
                    {
                        if (veh.FailMissionOnDeath && newv.IsDead)
                        {
                            FailMission(reason: "The vehicle has been destroyed.");
                        }
                        GameFiber.Yield();
                    }

                    if(newv.IsValid())
                        newv.Delete();
                });
            }

            foreach (var veh in CurrentMission.Objectives.OfType<SerializableVehicleObjective>().Where(v => v.SpawnAfter == CurrentStage))
            {
                
                var newv = new Vehicle(Util.RequestModel(veh.ModelHash), veh.Position)
                {
                    PrimaryColor = Color.FromArgb((int)veh.PrimaryColor.X, (int)veh.PrimaryColor.Y,
                    (int)veh.PrimaryColor.Z),
                    SecondaryColor = Color.FromArgb((int)veh.SecondaryColor.X, (int)veh.SecondaryColor.Y,
                    (int)veh.SecondaryColor.Z),
                };
                newv.Health = veh.Health;
                newv.Rotation = veh.Rotation;

                var hasActivated = false;

                if (veh.ActivateAfter == CurrentStage)
                {
                    CurrentObjectives.Add(veh);
                    hasActivated = true;
                }

                GameFiber.StartNew(delegate
                {
                    if(!hasActivated)
                    {
                        while (CurrentStage != veh.ActivateAfter && IsMissionPlaying)
                        {
                            GameFiber.Yield();
                        }
                        CurrentObjectives.Add(veh);
                    }


                    var blip = newv.AttachBlip();
                    

                    if(veh.ObjectiveType == 0)
                    {
                        blip.Color = Color.DarkRed;
                        while (!newv.IsDead && IsMissionPlaying)
                        {
                            if (veh.ShowHealthBar)
                            {
                                TimerBars.UpdateValue(newv.Handle.Value.ToString(), veh.Name, true, (100f*newv.Health / veh.Health).ToString("###") + "%");
                            }
                            GameFiber.Yield();
                        }
                        TimerBars.UpdateValue(newv.Handle.Value.ToString(), veh.Name, true, "0%");
                    }

                    if (veh.ObjectiveType == 1)
                    {
                        blip.Color = Color.CornflowerBlue;
                        while (!Game.LocalPlayer.Character.IsInVehicle(newv, false) && IsMissionPlaying)
                        {
                            GameFiber.Yield();
                        }
                    }


                    CurrentObjectives.Remove(veh);

                    if(blip.IsValid())
                        blip.Delete();

                    while (IsMissionPlaying)
//.........这里部分代码省略.........
开发者ID:LordRevan2,项目名称:MissionCreator,代码行数:101,代码来源:MissionPlayer.cs


注:本文中的Vehicle.AttachBlip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。