public void Deploy(SiegeWeapon s) { this.DeployedWeapon = (SynchedMissionObject)s; this.DisbandedWeapon = (SynchedMissionObject)null; this.OnDeploymentStateChangedAux((SynchedMissionObject)s); this.ToggleDeploymentPointVisibility(false); this.ToggleDeployedWeaponVisibility(true); }
public void FlagXCapturedByTeamX(SynchedMissionObject flag, Team capturingTeam) { int num = flag is FlagCapturePoint flagCapturePoint ? flagCapturePoint.FlagChar : 65; Team syncToTeam = capturingTeam.Side == BattleSideEnum.Attacker ? this.Mission.Teams.Defender : this.Mission.Teams.Attacker; this.HandleNewNotification(MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXCapturedByYourTeam, num, syncToTeam: capturingTeam); this.HandleNewNotification(MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum.FlagXCapturedByOtherTeam, num, syncToTeam: syncToTeam); }
protected internal override void OnInit() { List <SynchedMissionObject> synchedMissionObjectList = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("rope"); if (synchedMissionObjectList.Count > 0) { this._rope = synchedMissionObjectList[0]; } this._body = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("body")[0]; this.RotationObject = this._body; this._verticalAdjuster = this.GameEntity.CollectChildrenEntitiesWithTag("vertical_adjuster")[0]; if ((NativeObject)this._verticalAdjuster.Skeleton != (NativeObject)null) { this._verticalAdjuster.Skeleton.SetAnimationAtChannel(this.MangonelAimAnimation, 0); } this._verticalAdjusterStartingLocalFrame = this._verticalAdjuster.GetFrame(); this._verticalAdjusterStartingLocalFrame = this._body.GameEntity.GetBoneEntitialFrameWithIndex((byte)0).TransformToLocal(this._verticalAdjusterStartingLocalFrame); base.OnInit(); this.timeGapBetweenShootActionAndProjectileLeaving = 0.23f; this.timeGapBetweenShootingEndAndReloadingStart = 0.0f; this._rotateStandingPoints = new List <StandingPoint>(); if (this.StandingPoints != null) { foreach (StandingPoint standingPoint in this.StandingPoints) { if (standingPoint.GameEntity.HasTag("rotate")) { if (standingPoint.GameEntity.HasTag("left") && this._rotateStandingPoints.Count > 0) { this._rotateStandingPoints.Insert(0, standingPoint); } else { this._rotateStandingPoints.Add(standingPoint); } } } MatrixFrame globalFrame = this._body.GameEntity.GetGlobalFrame(); this._standingPointLocalIKFrames = new MatrixFrame[this.StandingPoints.Count]; for (int index = 0; index < this.StandingPoints.Count; ++index) { this._standingPointLocalIKFrames[index] = this.StandingPoints[index].GameEntity.GetGlobalFrame().TransformToLocal(globalFrame); this.StandingPoints[index].AddComponent((UsableMissionObjectComponent) new ClearHandInverseKinematicsOnStopUsageComponent()); } } this._missileBoneIndex = (byte)Skeleton.GetBoneIndexFromName(this.SkeletonOwnerObjects[0].GameEntity.Skeleton.GetName(), this.MissileBoneName); this.ApplyAimChange(); foreach (StandingPoint reloadStandingPoint in this.ReloadStandingPoints) { if (reloadStandingPoint != this.PilotStandingPoint) { this._reloadWithoutPilot = reloadStandingPoint; } } this.EnemyRangeToStopUsing = 7f; this.SetScriptComponentToTick(this.GetTickRequirement()); }
public ScriptComponentBehaviour Disband() { this.ToggleDeploymentPointVisibility(true); this.ToggleDeployedWeaponVisibility(false); this.DisbandedWeapon = this.DeployedWeapon; this.DeployedWeapon = (SynchedMissionObject)null; this.OnDeploymentStateChangedAux(this.DisbandedWeapon); return((ScriptComponentBehaviour)this.DisbandedWeapon); }
public void ToggleWeaponVisibility(bool visible, SynchedMissionObject weapon) { if ((NativeObject)weapon.GameEntity.Parent != (NativeObject)null && weapon.GameEntity.Parent.HasScriptOfType <SynchedMissionObject>()) { weapon.GameEntity.Parent.GetScriptComponents <SynchedMissionObject>().First <SynchedMissionObject>().SetVisibleSynched(visible); weapon.GameEntity.Parent.GetScriptComponents <SynchedMissionObject>().First <SynchedMissionObject>().SetPhysicsStateSynched(visible); } else { weapon?.SetVisibleSynched(visible); weapon?.SetPhysicsStateSynched(visible); } }
protected internal override void OnInit() { this.ballistaBody = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>(this.BodyTag)[0]; this.ballistaNavel = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>(this.NavelTag)[0]; this.RotationObject = (SynchedMissionObject)this; base.OnInit(); this.UsesMouseForAiming = true; this.GetSoundEventIndices(); this._ballistaNavelInitialFrame = this.ballistaNavel.GameEntity.GetFrame(); MatrixFrame globalFrame1 = this.ballistaBody.GameEntity.GetGlobalFrame(); this._ballistaBodyInitialLocalFrame = this.ballistaBody.GameEntity.GetFrame(); MatrixFrame globalFrame2 = this.PilotStandingPoint.GameEntity.GetGlobalFrame(); this._pilotInitialLocalFrame = this.PilotStandingPoint.GameEntity.GetFrame(); this._pilotInitialLocalIKFrame = globalFrame2.TransformToLocal(globalFrame1); this._missileInitialLocalFrame = this.Projectile.GameEntity.GetFrame(); this.PilotStandingPoint.AddComponent((UsableMissionObjectComponent) new ClearHandInverseKinematicsOnStopUsageComponent()); this.EnemyRangeToStopUsing = 5f; this.AttackClickWillReload = true; this.WeaponNeedsClickToReload = true; this.SetScriptComponentToTick(this.GetTickRequirement()); }
private void OnDeploymentStateChangedAux(SynchedMissionObject targetObject) { if (this.IsDeployed) { targetObject.SetVisibleSynched(true); targetObject.SetPhysicsStateSynched(true); } else { targetObject.SetVisibleSynched(false); targetObject.SetPhysicsStateSynched(false); } Action <DeploymentPoint> deploymentStateChanged = this.OnDeploymentStateChanged; if (deploymentStateChanged != null) { deploymentStateChanged(this); } if (!(targetObject is SiegeWeapon siegeWeapon)) { return; } siegeWeapon.OnDeploymentStateChanged(this.IsDeployed); }
protected internal override void OnInit() { this._body = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("body")[0]; this._sling = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("sling")[0]; this._rope = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("rope")[0]; this._verticalAdjuster = this.GameEntity.CollectChildrenEntitiesWithTag("vertical_adjuster")[0]; this._verticalAdjusterStartingLocalFrame = this._verticalAdjuster.GetFrame(); this._verticalAdjusterStartingLocalFrame = this._body.GameEntity.GetBoneEntitialFrameWithIndex((byte)0).TransformToLocal(this._verticalAdjusterStartingLocalFrame); this.RotationObject = this.GameEntity.CollectObjectsWithTag <SynchedMissionObject>("rotate_entity")[0]; base.OnInit(); this.timeGapBetweenShootActionAndProjectileLeaving = this.TimeGapBetweenShootActionAndProjectileLeaving; this.timeGapBetweenShootingEndAndReloadingStart = 0.0f; this._ammoLoadPoints = new List <StandingPointWithWeaponRequirement>(); if (this.StandingPoints != null) { int index1 = -1; for (int index2 = 0; index2 < this.StandingPoints.Count; ++index2) { if (this.StandingPoints[index2].GameEntity.HasTag(this.AIAmmoLoadTag)) { if (index1 >= 0) { this._ammoLoadPoints.Add(this.StandingPoints[index2] as StandingPointWithWeaponRequirement); } else { index1 = index2; } } else if (this.StandingPoints[index2].GameEntity.HasTag(this.AmmoLoadTag)) { this._ammoLoadPoints.Add(this.StandingPoints[index2] as StandingPointWithWeaponRequirement); } } if (index1 >= 0) { this.LoadAmmoStandingPoint = this.StandingPoints[index1] as StandingPointWithWeaponRequirement; this._ammoLoadPoints.Add(this.LoadAmmoStandingPoint); } else { this.LoadAmmoStandingPoint = this._ammoLoadPoints[this._ammoLoadPoints.Count - 1]; } MatrixFrame globalFrame = this._body.GameEntity.GetGlobalFrame(); this._standingPointLocalIKFrames = new MatrixFrame[this.StandingPoints.Count]; for (int index2 = 0; index2 < this.StandingPoints.Count; ++index2) { this._standingPointLocalIKFrames[index2] = this.StandingPoints[index2].GameEntity.GetGlobalFrame().TransformToLocal(globalFrame); this.StandingPoints[index2].AddComponent((UsableMissionObjectComponent) new ClearHandInverseKinematicsOnStopUsageComponent()); } } this.ApplyAimChange(); if (!GameNetwork.IsClientOrReplay) { this.EnemyRangeToStopUsing = 7f; if (this.State == RangedSiegeWeapon.WeaponState.Idle) { this._sling.SetAnimationAtChannelSynched(this.IdleWithAmmoAnimation, 0); } else { this._sling.SetAnimationAtChannelSynched(this.IdleEmptyAnimation, 0); } } this._missileBoneIndex = (byte)Skeleton.GetBoneIndexFromName(this._sling.GameEntity.Skeleton.GetName(), "bn_projectile_holder"); this._shootAnimPlayed = false; this.UpdateAmmoMesh(); this.SetScriptComponentToTick(this.GetTickRequirement()); this.UpdateProjectilePosition(); }