Ejemplo n.º 1
0
 public void OnUpdate(UpdateEvent e, UnpausedUserNode user, [JoinByUser] ActiveTankNode tank, [JoinByTank] WeaponNode weaponNode)
 {
     if (InputManager.GetActionKeyDown(BattleActions.PAUSE) && (this.IsNearZero(weaponNode.weaponRotationControl.Control) && (this.IsNearZero(tank.chassis.MoveAxis) && this.IsNearZero(tank.chassis.TurnAxis))))
     {
         this.EnterPause(user.Entity);
     }
 }
Ejemplo n.º 2
0
 public void ForcePauseActiveTankUserUser(NodeAddedEvent e, ActiveTankNode tank, [JoinByUser] UnpausedUnfocusedUserNode user)
 {
     if (this.ShouldPauseOnFocusLoss())
     {
         this.EnterPause(user.Entity);
     }
 }
        public void Reset(NodeAddedEvent evt, ActiveTankNode selfActiveTank, [JoinByTank] CompleteChargingWeaponControllerNode chargingWeaponNode)
        {
            Entity entity = chargingWeaponNode.Entity;

            entity.RemoveComponent <RailgunChargingStateComponent>();
            entity.AddComponent <ReadyRailgunChargingWeaponComponent>();
        }
Ejemplo n.º 4
0
 public void PlayShot(BaseShotEvent evt, ReadyHammerShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank)
 {
     if (weapon.magazineLocalStorage.CurrentCartridgeCount > 1)
     {
         weapon.hammerShotAnimation.PlayShot();
     }
     else
     {
         weapon.hammerShotAnimation.PlayShotAndReload();
     }
 }
Ejemplo n.º 5
0
        private bool IsPointOccluded(ActiveTankNode activeTank, Vector3 splashCenter, Vector3 tankPosition)
        {
            RaycastHit hit;
            Vector3    vector     = tankPosition - splashCenter;
            Vector3    normalized = vector.normalized;

            if (!Physics.Raycast(splashCenter, normalized, out hit, vector.magnitude, LayerMasks.GUN_TARGETING_WITHOUT_DEAD_UNITS))
            {
                return(false);
            }
            TargetBehaviour componentInParent = hit.transform.gameObject.GetComponentInParent <TargetBehaviour>();

            return(this.IsValidTarget(componentInParent) ? !ReferenceEquals(componentInParent.TargetEntity, activeTank.Entity) : true);
        }
Ejemplo n.º 6
0
 private bool IsValidSplashPoint(ActiveTankNode activeTank, Vector3 splashPositionForValidation, Vector3 splashCenter, ValidateSplashHitPointsEvent e, float radius)
 {
     if (!PhysicsUtil.ValidateVector3(splashCenter))
     {
         return(false);
     }
     if (!PhysicsUtil.ValidateVector3(splashPositionForValidation))
     {
         return(false);
     }
     using (new RaycastExclude(e.excludeObjects))
     {
         return(((splashPositionForValidation - splashCenter).magnitude <= radius) ? !this.IsPointOccluded(activeTank, splashCenter, splashPositionForValidation) : false);
     }
 }
        public void StartShotIfPossible(EarlyUpdateEvent evt, ReadyRailgunChargingWeaponControllerNode chargingWeaponController, [JoinSelf] SingleNode <ShootableComponent> node, [JoinByTank] ActiveTankNode selfActiveTank)
        {
            CooldownTimerComponent cooldownTimer = chargingWeaponController.cooldownTimer;

            if (((chargingWeaponController.weaponEnergy.Energy >= chargingWeaponController.discreteWeaponEnergy.UnloadEnergyPerShot) && (cooldownTimer.CooldownTimerSec <= 0f)) && InputManager.CheckAction(ShotActions.SHOT))
            {
                base.ScheduleEvent <SelfRailgunChargingShotEvent>(chargingWeaponController);
            }
        }
        public void SendShotPrepare(RailgunDelayedShotPrepareEvent evt, CompleteChargingWeaponControllerNode chargingWeaponNode, [JoinByTank] ActiveTankNode selfActiveTank)
        {
            Entity entity = chargingWeaponNode.Entity;

            entity.AddComponent <ReadyRailgunChargingWeaponComponent>();
            entity.RemoveComponent <RailgunChargingStateComponent>();
            if (chargingWeaponNode.Entity.HasComponent <ShootableComponent>())
            {
                base.ScheduleEvent <BeforeShotEvent>(entity);
                base.ScheduleEvent <ShotPrepareEvent>(entity);
            }
        }
Ejemplo n.º 9
0
 public void StartUnloading(NodeAddedEvent evt, ShaftEnergyNode weapon, [Context, JoinByTank] SingleNode <ShaftAimingWorkingStateComponent> state, [Context, JoinByTank] ActiveTankNode tank)
 {
     weapon.weaponEnergyEsm.Esm.ChangeState <WeaponEnergyStates.WeaponEnergyUnloadingState>();
 }
Ejemplo n.º 10
0
 public void StopAnyRailgunAnimation(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] RailgunAnimationReadyNode weapon)
 {
     weapon.railgunAnimation.StartChargingAnimation();
     weapon.animation.Animator.SetTrigger("shot");
 }
Ejemplo n.º 11
0
 public void Reset(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyHammerShotAnimationNode weapon)
 {
     weapon.hammerShotAnimation.Reset();
 }
Ejemplo n.º 12
0
 public void UnloadEnergy(TimeUpdateEvent evt, ShaftEnergyNode weapon, [JoinByTank] SingleNode <WeaponEnergyUnloadingStateComponent> unloading, [JoinByTank] ActiveTankNode tank)
 {
     this.UnloadEnergy(evt, weapon);
 }
Ejemplo n.º 13
0
        public void InitWeaponEnergyStates(NodeAddedEvent evt, WeaponEnergyNode weapon, [Context, JoinByTank] ActiveTankNode activeTank)
        {
            WeaponEnergyESMComponent component = new WeaponEnergyESMComponent();
            EntityStateMachine       esm       = component.Esm;

            weapon.weaponEnergy.Energy = 1f;
            esm.AddState <WeaponEnergyStates.WeaponEnergyFullState>();
            esm.AddState <WeaponEnergyStates.WeaponEnergyReloadingState>();
            esm.AddState <WeaponEnergyStates.WeaponEnergyUnloadingState>();
            weapon.Entity.AddComponent(component);
        }
Ejemplo n.º 14
0
 public void StopCooldown(ShaftShotAnimationCooldownEndEvent evt, ReadyShaftShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank)
 {
     weapon.shaftShotAnimationEsm.Esm.ChangeState <ShaftShotAnimationStates.ShaftShotAnimationIdleState>();
 }
 public void StopBandAnimationOnDeath(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyVulcanBandAnimationShootingNode weapon)
 {
     weapon.vulcanBandAnimation.StopBandAnimation();
 }
 public void StopShaftShotSoundEffects(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyShaftShotSoundEffectNode weapon)
 {
     weapon.shaftAimingShotSoundEffect.Stop();
     weapon.shaftQuickShotSoundEffect.Stop();
     this.StopCooldownSounds(weapon);
 }
 public void PlayShaftQuickShotEffect(BaseShotEvent evt, ReadyShaftShotSoundEffectNode weapon, [JoinByTank] SingleNode <ShaftIdleStateComponent> state, [JoinByTank] ActiveTankNode tank)
 {
     this.StopCooldownSounds(weapon);
     weapon.shaftAimingShotSoundEffect.Stop();
     weapon.shaftQuickShotSoundEffect.Play();
 }
Ejemplo n.º 18
0
 public void DestroyWeaponEnergyStates(NodeRemoveEvent evt, ActiveTankNode node, [JoinByTank] WeaponEnergyWithESMNode weapon)
 {
     weapon.Entity.RemoveComponent <WeaponEnergyESMComponent>();
 }
Ejemplo n.º 19
0
        public void ValidateSplashHitTargetByWeaponPoint(ValidateSplashHitPointsEvent evt, SplashWeaponNode weaponHit, ActiveTankNode targetTank, [JoinByTank] SingleNode <TankIncarnationComponent> targetIncarnation, [JoinByTank] WeaponBoundsNode weaponBoundsTarget)
        {
            TankCollidersComponent tankColliders  = targetTank.tankColliders;
            BoxCollider            boundsCollider = tankColliders.BoundsCollider;
            float             num      = weaponBoundsTarget.weaponBounds.WeaponBounds.size.y * 0.5f;
            Vector3           position = targetTank.mountPoint.MountPoint.position;
            float             radiusOfMinSplashDamage = weaponHit.splashWeapon.RadiusOfMinSplashDamage;
            SplashHitData     splashHit     = evt.SplashHit;
            Vector3           splashCenter  = splashHit.SplashCenter;
            List <HitTarget>  splashTargets = splashHit.SplashTargets;
            List <GameObject> exclusionGameObjectForSplashRaycast = splashHit.ExclusionGameObjectForSplashRaycast;
            List <GameObject> targetingColliders = tankColliders.TargetingColliders;
            Vector3           vector5            = targetTank.rigidbody.Rigidbody.position;
            Vector3           vector6            = vector5 - splashCenter;
            float             num3    = boundsCollider.size.z * 0.25f;
            Vector3           vector8 = boundsCollider.transform.forward * num3;
            Vector3           center  = boundsCollider.bounds.center;
            List <Vector3>    list5   = new List <Vector3> {
                position + (boundsCollider.transform.up * num),
                center,
                center - vector8,
                center + vector8,
                position
            };

            foreach (Vector3 vector12 in list5)
            {
                if (this.IsValidSplashPoint(targetTank, vector12, splashCenter, evt, radiusOfMinSplashDamage))
                {
                    HitTarget item = new HitTarget {
                        Entity            = targetTank.Entity,
                        IncarnationEntity = targetIncarnation.Entity,
                        LocalHitPoint     = Vector3.zero,
                        TargetPosition    = vector5,
                        HitDirection      = vector6.normalized,
                        HitDistance       = vector6.magnitude
                    };
                    splashTargets.Add(item);
                    exclusionGameObjectForSplashRaycast.AddRange(targetingColliders);
                    break;
                }
            }
        }
Ejemplo n.º 20
0
 public void AddGyroscopeComponentShootingState(NodeAddedEvent evt, VulcanShootingWithoutGyroscopeEnabledNode vulcanShooting, [JoinByTank] ActiveTankNode selfActiveTank)
 {
     SetupGyroscope(vulcanShooting, vulcanShooting.vulcanWeaponState.State);
 }
        public void ShowAndInitLaser(NodeAddedEvent evt, AimingLaserTargetPointNode weapon, [Context, JoinByTank] ActiveTankNode tank, [JoinAll, Context] CameraNode camera)
        {
            Vector3 barrelOriginWorld = new MuzzleVisualAccessor(weapon.muzzlePoint).GetBarrelOriginWorld();

            this.InterpolateLaser(weapon, barrelOriginWorld, Vector3.Normalize(weapon.shaftAimingTargetPoint.Point - barrelOriginWorld)).Show();
        }
Ejemplo n.º 22
0
 public void AddGyroscopeComponent(NodeAddedEvent evt, VulcanStartSpeedUpNode vulcanSpeedUp, [JoinByTank] ActiveTankNode selfActiveTank)
 {
     SetupGyroscope(vulcanSpeedUp, vulcanSpeedUp.vulcanWeaponState.State);
 }
Ejemplo n.º 23
0
 public void PlayShot(BaseShotEvent evt, ReadyShaftShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank)
 {
     weapon.shaftShotAnimation.PlayShot();
     weapon.shaftShotAnimationEsm.Esm.ChangeState <ShaftShotAnimationStates.ShaftShotAnimationBounceState>();
 }
 public void Init(NodeAddedEvent evt, ActiveTankNode tank, [Context, JoinByTank] ReadyFreezeMotionAnimationNode weapon)
 {
     weapon.freezeMotionAnimation.ResetMotion();
 }
Ejemplo n.º 25
0
 public void StopShaftShotAnimtionEffect(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyShaftShotAnimationNode weapon)
 {
     weapon.shaftShotAnimationEsm.Esm.ChangeState <ShaftShotAnimationStates.ShaftShotAnimationIdleState>();
 }
 public void StopMotion(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyFreezeMotionAnimationNode weapon)
 {
     weapon.freezeMotionAnimation.StopMotion();
 }
Ejemplo n.º 27
0
 public void OnApplicationFocusLost(ApplicationFocusEvent e, UnpausedUserNode user, [JoinByUser] ActiveTankNode tank)
 {
     if (!e.IsFocused && this.ShouldPauseOnFocusLoss())
     {
         this.EnterPause(user.Entity);
     }
 }
Ejemplo n.º 28
0
 public void ResetOnActivate(NodeAddedEvent e, ActiveTankNode activeTank, [JoinByTank] CooldownNode cooldown)
 {
     cooldown.cooldownTimer.CooldownTimerSec = 0f;
 }
        public void InitShaftAimingAnimation(NodeAddedEvent evt, ActiveTankNode tank, [JoinByTank] InititedShaftAimingAnimationNode weapon)
        {
            Animator animator = weapon.animation.Animator;

            weapon.shaftAimingAnimation.InitShaftAimingAnimation(animator);
        }
Ejemplo n.º 30
0
 public void Init(NodeAddedEvent evt, ActiveTankNode activeTank, [JoinByTank, Context] WeaponNode weaponNode)
 {
     StateUtils.SwitchEntityState <WeaponUnblockedComponent>(weaponNode.Entity, this.weaponStates);
 }