private static bool SetSpawnerMatrixFrame( object target, string propertyName, MatrixFrame value) { value.Fill(); FieldInfo field = target.GetType().GetField(propertyName); if (!(field != (FieldInfo)null)) { return(false); } field.SetValue(target, (object)value); return(true); }
public override void OnFormationUnitsSpawned(Team team) { base.OnFormationUnitsSpawned(team); using (IEnumerator <Formation> enumerator = team.FormationsIncludingSpecial.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.ApplyActionOnEachUnit(delegate(Agent agent) { if (!agent.IsAIControlled) { return; } agent.SetIsAIPaused(true); }); } } if (team.IsPlayerTeam) { /* To Do: Figure out how to disable combat while formations are set, as the method below is not available. * base.Mission.MainAgent.SetIsCombatActionsDisabled(true); */ base.Mission.MainAgent.Controller = Agent.ControllerType.AI; } this.formationSpawned++; if (this.formationSpawned >= base.Mission.Teams.Count) { base.Mission.IsTeleportingAgents = true; base.Mission.CameraIsFirstPerson = false; this.SetDeploymentBoundary(); Vec3 position = base.Mission.MainAgent.Position; float lookDirectionAsAngle = base.Mission.MainAgent.LookDirectionAsAngle; Vec2 vec = new Vec2(0f, -30f); vec.RotateCCW(lookDirectionAsAngle); MatrixFrame frame = new MatrixFrame(0f, 1f, 0f, 1f, 0f, 0f, -MathF.Sin(lookDirectionAsAngle + 3.14159274f), MathF.Cos(lookDirectionAsAngle + 3.14159274f), -MathF.Cos(1.04719758f), position.X + vec.X, position.Y + vec.Y, position.Z + 40f); frame.Fill(); (ScreenManager.TopScreen as MissionScreen).UpdateFreeCamera(frame); MissionMode mode = base.Mission.Mode; InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=opsdeploy-start}Deployment Phase. Press E to Start Battle.", null).ToString(), new Color(0f, 0.8f, 0f, 1f))); } base.Mission.AllowAiTicking = false; }