本文整理汇总了C#中Fighter.SpawnVehicle方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.SpawnVehicle方法的具体用法?C# Fighter.SpawnVehicle怎么用?C# Fighter.SpawnVehicle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fighter
的用法示例。
在下文中一共展示了Fighter.SpawnVehicle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSpawn
private IEnumerator DoSpawn(float delay, Action callback, Transform targetTransform)
{
yield return new WaitForSeconds(delay);
if (!_hasSpawned)
{
_fighterInst = Instantiate<Fighter>(FighterPrefab);
_fighterInst.SpawnVehicle(_fighterInst.gameObject, _fighterInst.VehiclePrefab, Universe.Current.GetUniversePosition(transform.position), transform.rotation);
if (targetTransform != null)
_fighterInst.SetTarget(targetTransform);
if (AddWarpEffect)
{
_warpEffect = _fighterInst.VehicleInstance.gameObject.AddComponent<WarpEffect>();
_warpEffect.transform.position = transform.position;
_warpEffect.transform.forward = transform.forward;
_warpEffect.WarpEffectPrefab = SpawnEffect;
_warpEffect.Timeout = 0.4f;
_warpEffect.Distance = 20f;
}
_hasSpawned = true;
if (callback != null)
callback();
if (OnSpawn != null)
OnSpawn(_fighterInst.gameObject);
}
}
示例2: SpawnSquadronVehicle
public void SpawnSquadronVehicle(Fighter member, UniversePosition position, Quaternion rotation)
{
member.SpawnVehicle(member.gameObject, member.VehiclePrefab, position, rotation);
var memberTracker = member.VehicleInstance.GetComponent<VehicleTracker>();
var profile = member.GetComponent<ShipProfile>();
if (profile.PrimaryWeapon != null)
member.VehicleInstance.SetPrimaryWeapon(profile.PrimaryWeapon.gameObject);
if (profile.SecondaryWeapon != null)
member.VehicleInstance.SetSecondaryWeapon(profile.SecondaryWeapon.gameObject);
var squadronTracker = member.VehicleInstance.gameObject.AddComponent<SquadronTracker>();
squadronTracker.ArrowSprite = memberTracker.ArrowSprite;
//squadronTracker.TrackerSprite = memberTracker.TrackerSprite;
//squadronTracker.FarTrackerSprite = memberTracker.FarTrackerSprite;
//squadronTracker.VeryFarTrackerSprite = memberTracker.VeryFarTrackerSprite;
squadronTracker.LockingSprite = memberTracker.LockingSprite;
squadronTracker.LockedSprite = memberTracker.LockedSprite;
squadronTracker.TrackerPlanePrefab = TrackerPlanePrefab;
Destroy(memberTracker);
squadronTracker.CallSign = profile.CallSign;
squadronTracker.TrackerColor = TrackerColor;
squadronTracker.LabelFont = SquadronTrackerFont;
squadronTracker.IsDisabled = false;
member.IsFollowIdleDestination = true;
var mapPin = member.VehicleInstance.gameObject.AddComponent<MapPin>();
mapPin.ActivePin = PlayerController.Current.PlayerPinPrefab;
mapPin.InactivePin = SquadronPinPrefab;
mapPin.SetPinState(MapPin.MapPinState.Inactive);
// Apply power profile
member.VehicleInstance.Killable.MaxShield = profile.GetShield();
member.VehicleInstance.Killable.Shield = member.VehicleInstance.Killable.MaxShield;
var squadronShieldRegenerator = member.VehicleInstance.gameObject.AddComponent<ShieldRegenerator>();
squadronShieldRegenerator.RegenerationDelay = ShieldRegenerateDelay;
squadronShieldRegenerator.RegenerationRate = ShieldRegenerateRate;
BindMemberEvents(member);
member.enabled = true;
}