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


C# Vehicle.SetSecondaryWeapon方法代码示例

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


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

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


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