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


C# Fighter.SpawnVehicle方法代码示例

本文整理汇总了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);
        }
    }
开发者ID:talford2,项目名称:SpaceX,代码行数:27,代码来源:Spawner.cs

示例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;
    }
开发者ID:talford2,项目名称:SpaceX,代码行数:43,代码来源:PlayerSquadron.cs


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