// Use this for initialization
    void Start()
    {
        _rigidbody = GetComponent <Rigidbody>();

        var initialAngularDrag = _rigidbody.angularDrag;
        var torqueApplier      = new MultiTorquerTorqueAplier(_rigidbody, TorqueMultiplier, initialAngularDrag);

        _pilot = new RocketPilot(torqueApplier, _rigidbody, Engines, StartDelay)
        {
            LocationAimWeighting             = LocationAimWeighting,
            TurningStartDelay                = TurningStartDelay,
            VectorArrow                      = VectorArrow,
            TimeThresholdForMaximumEvasion   = TimeThresholdForMaximumEvasion,
            TimeThresholdForMediumEvasion    = TimeThresholdForMediumEvasion,
            TimeThresholdForMinimalEvasion   = TimeThresholdForMinimalEvasion,
            EvasionModeTime                  = EvasionModeTime,
            MinimumFriendlyDetectionDistance = MinimumFriendlyDetectionDistance
        };

        var exploder = new ShrapnelExploder(_rigidbody, Shrapnel, ExplosionEffect, ShrapnelCount)
        {
            EnemyTags             = TargetChoosingMechanism.EnemyTagKnower.KnownEnemyTags,
            TagShrapnel           = TagShrapnel,
            SetEnemyTagOnShrapnel = SetEnemyTagOnShrapnel,
            ShrapnelSpeed         = ShrapnelSpeed
        };

        _detonator = new ProximityApproachDetonator(exploder, _rigidbody, TimeToTargetForDetonation, ShrapnelSpeed);

        _runner = new RocketRunner(TargetChoosingMechanism, _pilot, _detonator, Tank)
        {
            name = transform.name
        };
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        OriginalHealth = Health;
        _rigidbody     = GetComponent <Rigidbody>();

        var exploder = new ShrapnelExploder(_rigidbody, Shrapnel, DeathExplosion, ShrapnelCount2)
        {
            ShrapnelSpeed = ShrapnelSpeed2
        };

        _destroyer = new WithChildrenDestroyer()
        {
            Exploder      = exploder,
            UntagChildren = false
        };

        if (!string.IsNullOrEmpty(TeamTagForceFieldSuffix))
        {
            IgnoredTags.Add(tag + TeamTagForceFieldSuffix);
        }
    }
    // Use this for initialization
    void Start()
    {
        StartCalled = true;
        _rigidbody  = GetComponent <Rigidbody>();

        var exploder = new ShrapnelExploder(_rigidbody, Shrapnel, DeathExplosion, ShrapnelCount2)
        {
            ShrapnelSpeed = ShrapnelSpeed2
        };

        _destroyer = new WithChildrenDestroyer()
        {
            Exploder      = exploder,
            UntagChildren = false
        };

        //if (_destroyer == null)
        //{
        //    Debug.LogWarning(gameObject + " has null destroyer");
        //    Start();
        //}
    }