本文整理汇总了C#中Vehicle.SetPrimaryWeapon方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.SetPrimaryWeapon方法的具体用法?C# Vehicle.SetPrimaryWeapon怎么用?C# Vehicle.SetPrimaryWeapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.SetPrimaryWeapon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitVehicle
public override void InitVehicle(Vehicle vehiclePrefab, VehicleGun weaponPrefab, Vector3 position, Quaternion rotation)
{
vehicle = ((GameObject)Instantiate(vehiclePrefab.gameObject, position, rotation)).GetComponent<Vehicle>();
vehicle.transform.parent = transform;
Utility.SetLayerRecursively(vehicle.transform, LayerMask.NameToLayer("Player"));
vehicle.OnDamage += OnVehicleDamage;
vehicle.OnDie += OnVehicleDie;
vehicle.Initialize();
if (weaponPrefab != null)
vehicle.SetPrimaryWeapon(weaponPrefab);
vehicle.MaxHealth *= 2f;
vehicle.Health = vehicle.MaxHealth;
Targeting.AddTargetable(Team, vehicle);
}
示例2: InitVehicle
public override void InitVehicle(Vehicle vehiclePrefab, VehicleGun weaponPrefab, Vector3 position, Quaternion rotation)
{
vehicle = ((GameObject)Instantiate(vehiclePrefab.gameObject, position, rotation)).GetComponent<Vehicle>();
vehicle.transform.parent = transform;
vehicle.OnDamage += OnVehicleDamage;
vehicle.OnDie += OnVehicleDie;
vehicle.Initialize();
if (weaponPrefab != null)
vehicle.SetPrimaryWeapon(weaponPrefab);
Targeting.AddTargetable(Team, vehicle);
var neighrbourSensor = GetComponentInChildren<NeighbourSensor>();
if (neighrbourSensor != null)
neighrbourSensor.transform.parent = vehicle.transform;
var soundSensor = GetComponentInChildren<SoundSensor>();
if (soundSensor != null)
soundSensor.transform.parent = vehicle.transform;
var missileSensor = GetComponentInChildren<MissileSensor>();
if (missileSensor != null)
missileSensor.transform.parent = vehicle.transform;
}
示例3: SpawnVehicle
public void SpawnVehicle(Vehicle vehiclePrefab, UniversePosition universePosition, Quaternion rotation)
{
_playVehicleInstance = ((GameObject)Instantiate(vehiclePrefab.gameObject, universePosition.CellLocalPosition, rotation)).GetComponent<Vehicle>();
_playVehicleInstance.Controller = gameObject;
_playVehicleInstance.Shiftable.SetShiftPosition(universePosition);
_playVehicleInstance.GetComponent<Targetable>().Team = Team;
var member = GetComponent<Fighter>();
member.SetVehicleInstance(_playVehicleInstance);
_playVehicleInstance.Initialize();
var playerCurrent = Squadron.GetMember(Squadron.GetCurrentIndex()).GetComponent<ShipProfile>();
if (playerCurrent.PrimaryWeapon != null)
_playVehicleInstance.SetPrimaryWeapon(playerCurrent.PrimaryWeapon.gameObject);
if (playerCurrent.SecondaryWeapon != null)
_playVehicleInstance.SetSecondaryWeapon(playerCurrent.SecondaryWeapon.gameObject);
_playVehicleInstance.UTurnPath = UTurnPath;
_playVehicleInstance.UTurnDuration = UTurnDuration;
//Destroy(_playVehicleInstance.GetComponent<Tracker>());
Destroy(_playVehicleInstance.GetComponent<VehicleTracker>());
var squadronTracker = _playVehicleInstance.gameObject.AddComponent<SquadronTracker>();
squadronTracker.ArrowSprite = Squadron.ArrowSprite;
//squadronTracker.TrackerSprite = Squadron.TrackerSprite;
//squadronTracker.FarTrackerSprite = Squadron.FarTrackerSprite;
//squadronTracker.VeryFarTrackerSprite = Squadron.VeryFarTrackerSprite;
squadronTracker.LockingSprite = Squadron.LockingTrackerSprite;
squadronTracker.LockedSprite = Squadron.LockedTrackerSprite;
squadronTracker.CallSign = CallSign;
squadronTracker.TrackerColor = TrackerColor;
squadronTracker.LabelFont = Squadron.SquadronTrackerFont;
squadronTracker.IsDisabled = true;
var mapPin = VehicleInstance.gameObject.AddComponent<MapPin>();
mapPin.ActivePin = PlayerPinPrefab;
mapPin.InactivePin = Squadron.SquadronPinPrefab;
_playVehicleInstance.gameObject.layer = LayerMask.NameToLayer("Player");
_playVehicleInstance.Killable.OnDamage += PlayerController_OnDamage;
_playVehicleInstance.Killable.OnDie += PlayerController_OnDie;
// Apply power profile
var powerProfile = GetComponent<ShipProfile>();
_playVehicleInstance.Killable.MaxShield = powerProfile.GetShield();
_playVehicleInstance.Killable.Shield = _playVehicleInstance.Killable.MaxShield;
var shieldRegenerator = _playVehicleInstance.gameObject.GetComponent<ShieldRegenerator>();
shieldRegenerator.RegenerationDelay = Squadron.ShieldRegenerateDelay;
shieldRegenerator.RegenerationRate = Squadron.ShieldRegenerateRate;
shieldRegenerator.OnRegenerate += PlayerController_OnRegenerate;
}