Exemplo n.º 1
0
        public void UnloadEnergyPerShot(BaseShotEvent evt, DiscreteWeaponEnergyNode weapon)
        {
            float unloadEnergyPerShot = weapon.discreteWeaponEnergy.UnloadEnergyPerShot;

            weapon.weaponEnergy.Energy -= unloadEnergyPerShot;
            weapon.weaponEnergy.Energy  = Mathf.Clamp(weapon.weaponEnergy.Energy, 0f, 1f);
            weapon.weaponEnergyEsm.Esm.ChangeState <WeaponEnergyStates.WeaponEnergyReloadingState>();
        }
Exemplo n.º 2
0
        public void PlayShotEffect(BaseShotEvent evt, DiscreteWeaponSoundEffectReadyNode node)
        {
            DiscreteWeaponShotEffectComponent discreteWeaponShotEffect = node.discreteWeaponShotEffect;
            MuzzlePointComponent muzzlePoint = node.muzzlePoint;

            discreteWeaponShotEffect.AudioSources[muzzlePoint.CurrentIndex].Stop();
            discreteWeaponShotEffect.AudioSources[muzzlePoint.CurrentIndex].Play();
        }
Exemplo n.º 3
0
        public void StartKickback(BaseShotEvent evt, KickbackNode weapon, [JoinByTank] TankNode tank)
        {
            KickbackComponent   kickback      = weapon.kickback;
            MuzzleLogicAccessor accessor      = new MuzzleLogicAccessor(weapon.muzzlePoint, weapon.weaponInstance);
            Vector3             vector        = -accessor.GetFireDirectionWorld() * kickback.KickbackForce;
            Vector3             worldPosition = accessor.GetWorldPosition();

            tank.rigidbody.Rigidbody.AddForceAtPositionSafe(vector * WeaponConstants.WEAPON_FORCE_MULTIPLIER, worldPosition);
        }
Exemplo n.º 4
0
        public void ShotTrail(BaseShotEvent evt, WeaponNode weapon)
        {
            RailgunTrailComponent railgunTrail = weapon.railgunTrail;
            Vector3       worldPosition        = new MuzzleVisualAccessor(weapon.muzzlePoint).GetWorldPosition();
            Vector3       shotDirection        = evt.ShotDirection;
            DirectionData data        = weapon.targetCollector.Collect(worldPosition, shotDirection, 1000f, LayerMasks.VISUAL_STATIC);
            Vector3       hitPosition = !data.HasAnyHit() ? (worldPosition + (shotDirection * 1000f)) : data.FirstAnyHitPosition();

            this.DrawShotTrailEffect(worldPosition, hitPosition, railgunTrail.Prefab, railgunTrail.TipPrefab);
        }
Exemplo n.º 5
0
 public void PlayShot(BaseShotEvent evt, ReadyHammerShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank)
 {
     if (weapon.magazineLocalStorage.CurrentCartridgeCount > 1)
     {
         weapon.hammerShotAnimation.PlayShot();
     }
     else
     {
         weapon.hammerShotAnimation.PlayShotAndReload();
     }
 }
        public void CreateBlockedExplosionEffect(BaseShotEvent evt, BlockedWeaponNode node)
        {
            HitExplosionGraphicsComponent hitExplosionGraphics = node.hitExplosionGraphics;
            WeaponBlockedComponent        weaponBlocked        = node.weaponBlocked;
            Vector3 position = weaponBlocked.BlockPoint - (evt.ShotDirection * hitExplosionGraphics.ExplosionOffset);

            if (hitExplosionGraphics.UseForBlockedWeapon)
            {
                this.DrawExplosionEffect(position, weaponBlocked.BlockNormal, hitExplosionGraphics.ExplosionAsset, hitExplosionGraphics.ExplosionDuration, node);
            }
        }
Exemplo n.º 7
0
        public unsafe void InstantiatePellets(BaseShotEvent evt, SoleTracerGraphicsNode weapon)
        {
            RaycastHit hit;
            SoleTracerGraphicsComponent soleTracerGraphics = weapon.soleTracerGraphics;
            float radiusOfMinDamage = weapon.damageWeakeningByDistance.RadiusOfMinDamage;
            float num2 = radiusOfMinDamage / soleTracerGraphics.Tracer.startSpeed;

            ParticleSystem.Particle particle = new ParticleSystem.Particle {
                position = soleTracerGraphics.Tracer.transform.position,
                color    = soleTracerGraphics.Tracer.startColor,
                size     = soleTracerGraphics.Tracer.startSize
            };
            particle.randomSeed    = (uint)(Random.value * 4.294967E+09f);
            particle.velocity      = evt.ShotDirection * soleTracerGraphics.Tracer.startSpeed;
            particle.startLifetime = !Physics.Raycast(soleTracerGraphics.Tracer.transform.position, evt.ShotDirection, out hit, radiusOfMinDamage, LayerMasks.GUN_TARGETING_WITH_DEAD_UNITS) ? num2 : (Vector3.Distance(soleTracerGraphics.Tracer.transform.position, hit.point) / soleTracerGraphics.Tracer.startSpeed);
            if (particle.startLifetime > soleTracerGraphics.MaxTime)
            {
                ParticleSystem.Particle *particlePtr1 = &particle;
                particlePtr1.velocity *= particle.startLifetime / soleTracerGraphics.MaxTime;
                particle.startLifetime = soleTracerGraphics.MaxTime;
            }
            particle.remainingLifetime = particle.startLifetime;
            soleTracerGraphics.Tracer.Emit(particle);
        }
Exemplo n.º 8
0
        public void UpdateLocalMagazineStorage(BaseShotEvent evt, LocalHammerMagazineNode weapon)
        {
            int maxCartridgeCount = weapon.magazineWeapon.MaxCartridgeCount;

            weapon.magazineLocalStorage.CurrentCartridgeCount = (weapon.magazineLocalStorage.CurrentCartridgeCount != 1) ? (weapon.magazineLocalStorage.CurrentCartridgeCount - 1) : maxCartridgeCount;
        }
 public void PlayShot(BaseShotEvent evt, ReadyShaftShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank)
 {
     weapon.shaftShotAnimation.PlayShot();
     weapon.shaftShotAnimationEsm.Esm.ChangeState <ShaftShotAnimationStates.ShaftShotAnimationBounceState>();
 }
 public void PlayShaftQuickShotEffect(BaseShotEvent evt, ReadyShaftShotSoundEffectNode weapon, [JoinByTank] SingleNode <ShaftIdleStateComponent> state, [JoinByTank] ActiveTankNode tank)
 {
     this.StopCooldownSounds(weapon);
     weapon.shaftAimingShotSoundEffect.Stop();
     weapon.shaftQuickShotSoundEffect.Play();
 }
Exemplo n.º 11
0
        public void UpdateOnTrigger(BaseShotEvent evt, HammerReadyEnergyNode hammerEnergy, [JoinByTank] HUDNodes.ActiveSelfTankNode selfNode, [JoinAll] SingleNode <MainHUDComponent> hud)
        {
            float num = hammerEnergy.magazineStorage.CurrentCartridgeCount - 1;

            hud.component.CurrentEnergyValue = num;
        }
Exemplo n.º 12
0
 public void UnloadEnergyPerQuickShot(BaseShotEvent evt, ShaftEnergyNode weapon, [JoinByTank] SingleNode <ShaftIdleStateComponent> state)
 {
     this.UnloadEnergyByQuickShot(weapon);
 }
Exemplo n.º 13
0
 public void UnloadEnergyPerAimingShot(BaseShotEvent evt, ShaftEnergyNode weapon, [JoinByTank] SingleNode <ShaftAimingWorkFinishStateComponent> state)
 {
     this.UnloadEnergyByAimingShot(weapon);
 }
Exemplo n.º 14
0
        public void PlayTwinsShotAnimation(BaseShotEvent evt, ReadyTwinsAnimationNode weapon)
        {
            int currentIndex = new MuzzleVisualAccessor(weapon.muzzlePoint).GetCurrentIndex();

            weapon.twinsAnimation.Play(currentIndex);
        }
Exemplo n.º 15
0
 public void SetShotIdToBaseShotEvent(BaseShotEvent e, SingleNode <ShotIdComponent> shotId, [JoinByTank] SingleNode <TankSyncComponent> selfTank)
 {
     e.ShotId = shotId.component.ShotId;
 }
Exemplo n.º 16
0
        public void RequestBulletBuild(BaseShotEvent evt, BlockedWeaponNode weaponNode)
        {
            MuzzleVisualAccessor accessor = new MuzzleVisualAccessor(weaponNode.muzzlePoint);

            base.ScheduleEvent(new BulletBuildEvent(accessor.GetFireDirectionWorld()), weaponNode);
        }
Exemplo n.º 17
0
 public void StartShotAnimation(BaseShotEvent evt, ReadyShotAnimationNode weapon)
 {
     weapon.shotAnimation.Play();
 }
Exemplo n.º 18
0
 public void CreateMuzzleFlash(BaseShotEvent evt, MuzzleFlashNode muzzle)
 {
     this.InstantiateMuzzleEffect(muzzle.muzzleFlash.muzzleFlashPrefab, muzzle, muzzle.muzzleFlash.duration);
 }