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); } }
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>(); }
public void PlayShot(BaseShotEvent evt, ReadyHammerShotAnimationNode weapon, [JoinByTank] ActiveTankNode tank) { if (weapon.magazineLocalStorage.CurrentCartridgeCount > 1) { weapon.hammerShotAnimation.PlayShot(); } else { weapon.hammerShotAnimation.PlayShotAndReload(); } }
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); }
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); } }
public void StartUnloading(NodeAddedEvent evt, ShaftEnergyNode weapon, [Context, JoinByTank] SingleNode <ShaftAimingWorkingStateComponent> state, [Context, JoinByTank] ActiveTankNode tank) { weapon.weaponEnergyEsm.Esm.ChangeState <WeaponEnergyStates.WeaponEnergyUnloadingState>(); }
public void StopAnyRailgunAnimation(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] RailgunAnimationReadyNode weapon) { weapon.railgunAnimation.StartChargingAnimation(); weapon.animation.Animator.SetTrigger("shot"); }
public void Reset(NodeRemoveEvent evt, ActiveTankNode tank, [JoinByTank] ReadyHammerShotAnimationNode weapon) { weapon.hammerShotAnimation.Reset(); }
public void UnloadEnergy(TimeUpdateEvent evt, ShaftEnergyNode weapon, [JoinByTank] SingleNode <WeaponEnergyUnloadingStateComponent> unloading, [JoinByTank] ActiveTankNode tank) { this.UnloadEnergy(evt, weapon); }
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); }
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(); }
public void DestroyWeaponEnergyStates(NodeRemoveEvent evt, ActiveTankNode node, [JoinByTank] WeaponEnergyWithESMNode weapon) { weapon.Entity.RemoveComponent <WeaponEnergyESMComponent>(); }
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; } } }
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(); }
public void AddGyroscopeComponent(NodeAddedEvent evt, VulcanStartSpeedUpNode vulcanSpeedUp, [JoinByTank] ActiveTankNode selfActiveTank) { SetupGyroscope(vulcanSpeedUp, vulcanSpeedUp.vulcanWeaponState.State); }
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(); }
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(); }
public void OnApplicationFocusLost(ApplicationFocusEvent e, UnpausedUserNode user, [JoinByUser] ActiveTankNode tank) { if (!e.IsFocused && this.ShouldPauseOnFocusLoss()) { this.EnterPause(user.Entity); } }
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); }
public void Init(NodeAddedEvent evt, ActiveTankNode activeTank, [JoinByTank, Context] WeaponNode weaponNode) { StateUtils.SwitchEntityState <WeaponUnblockedComponent>(weaponNode.Entity, this.weaponStates); }