private void CenterCameraOnSpeaker() { List <SpeakerPriority> ListSpeakerPriority = GetSpeakerPriorities(); CenterOnSquadCutscene CenterCamera = new CenterOnSquadCutscene(null, Map, new Microsoft.Xna.Framework.Vector3()); foreach (SpeakerPriority ActiveSpeaker in ListSpeakerPriority) { if (ActiveSpeaker.PriorityType == SpeakerPriority.PriorityTypes.Character) { foreach (Player ActivePlayer in Map.ListPlayer) { foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { for (int U = 0; U < ActiveSquad.UnitsInSquad; ++U) { foreach (Character ActiveCharacter in ActiveSquad.At(U).ArrayCharacterActive) { if (ActiveCharacter.FullName == ActiveSpeaker.Name) { Map.PushScreen(new CenterOnSquadCutscene(null, Map, ActiveSquad.Position)); return; } } } } } } else if (ActiveSpeaker.PriorityType == SpeakerPriority.PriorityTypes.Location) { string[] ArrayPosition = ActiveSpeaker.Name.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries); float X = float.Parse(ArrayPosition[0]); float Y = float.Parse(ArrayPosition[1]); float Z = 0; if (ArrayPosition.Length > 2) { Z = float.Parse(ArrayPosition[2]); } Map.PushScreen(new CenterOnSquadCutscene(null, Map, new Microsoft.Xna.Framework.Vector3(X, Y, Z))); return; } else if (ActiveSpeaker.PriorityType == SpeakerPriority.PriorityTypes.ID) { foreach (Player ActivePlayer in Map.ListPlayer) { foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { uint RealID = uint.Parse(ActiveSpeaker.Name); if (ActiveSquad.ID == RealID) { Map.PushScreen(new CenterOnSquadCutscene(null, Map, ActiveSquad.Position)); return; } } } } } }
public override byte[] GetSnapshotData() { ByteWriter BW = new ByteWriter(); BW.AppendInt32(ListAllPlayer.Count); foreach (Player ActivePlayer in ListAllPlayer) { BW.AppendString(ActivePlayer.ConnectionID); BW.AppendString(ActivePlayer.Name); BW.AppendInt32(ActivePlayer.Team); BW.AppendBoolean(ActivePlayer.IsPlayerControlled); BW.AppendByte(ActivePlayer.Color.R); BW.AppendByte(ActivePlayer.Color.G); BW.AppendByte(ActivePlayer.Color.B); BW.AppendByte(ActivePlayer.LocalPlayerIndex); BW.AppendInt32(ActivePlayer.ListSquad.Count); foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { BW.AppendFloat(ActiveSquad.X); BW.AppendFloat(ActiveSquad.Y); BW.AppendFloat(ActiveSquad.Z); BW.AppendBoolean(ActiveSquad.IsPlayerControlled); BW.AppendInt32(ActiveSquad.UnitsInSquad); for (int U = 0; U < ActiveSquad.UnitsInSquad; ++U) { Unit ActiveUnit = ActiveSquad.At(U); BW.AppendString(ActiveUnit.UnitTypeName); BW.AppendString(ActiveUnit.RelativePath); BW.AppendInt32(ActiveUnit.ArrayCharacterActive.Length); for (int C = 0; C < ActiveUnit.ArrayCharacterActive.Length; ++C) { BW.AppendString(ActiveUnit.ArrayCharacterActive[C].FullName); } } } } BW.AppendString(BattleMapPath); byte[] Data = BW.GetBytes(); BW.ClearWriteBuffer(); return(Data); }
public override bool CanActivatePassive() { if (Context.EffectOwnerCharacter != Context.EffectOwnerUnit.Pilot) { return(false); } foreach (Player ActivePlayer in Context.Map.ListPlayer) { foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { float X1 = Context.EffectOwnerSquad.X; float Y1 = Context.EffectOwnerSquad.Y; float X2 = ActiveSquad.X; float Y2 = ActiveSquad.Y; for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; ++U) { Unit ActiveUnit = ActiveSquad.At(U); foreach (Character ActiveCharacter in ActiveUnit.ArrayCharacterActive) { if (ActiveCharacter.Name == _CharacterName) { int Distance = 0; if (IncludeDiagonals) { Distance = (int)Math.Ceiling(Math.Sqrt(Math.Pow(X2 - X1, 2) + Math.Pow(Y2 - Y1, 2))); } else { Distance = (int)((X2 - X1) + (Y2 - Y1)); } if (Distance < DistanceToEnemy) { return(true); } } } } } } return(false); }
protected override void DoWrite(OnlineWriter WriteBuffer) { WriteBuffer.AppendByte(ActivePlayer.LocalPlayerIndex); WriteBuffer.AppendInt32(ActivePlayer.Inventory.ActiveLoadout.ListSquad.Count); foreach (Squad ActiveSquad in ActivePlayer.Inventory.ActiveLoadout.ListSquad) { WriteBuffer.AppendInt32(ActiveSquad.UnitsInSquad); for (int U = 0; U < ActiveSquad.UnitsInSquad; ++U) { Unit ActiveUnit = ActiveSquad.At(U); WriteBuffer.AppendString(ActiveUnit.UnitTypeName); WriteBuffer.AppendString(ActiveUnit.RelativePath); WriteBuffer.AppendInt32(ActiveUnit.ArrayCharacterActive.Length); for (int C = 0; C < ActiveUnit.ArrayCharacterActive.Length; ++C) { WriteBuffer.AppendString(ActiveUnit.ArrayCharacterActive[C].FullName); } } } }
public override void SaveTemporaryMap() { FileStream FS = new FileStream("TempSave.sav", FileMode.Create, FileAccess.Write); BinaryWriter BW = new BinaryWriter(FS); BW.Write(BattleMapPath); BW.Write(typeof(DeathmatchMap).AssemblyQualifiedName); BW.Write(DicMapVariables.Count); foreach (KeyValuePair <string, double> Variables in DicMapVariables) { BW.Write(Variables.Key); BW.Write(Variables.Value); } BW.Write(CursorPosition.X); BW.Write(CursorPosition.Y); BW.Write(CameraPosition.X); BW.Write(CameraPosition.Y); BW.Write(ActivePlayerIndex); BW.Write(GameMode); BW.Write(GameTurn); BW.Write(VictoryCondition); BW.Write(LossCondition); BW.Write(SkillPoint); BW.Write(sndBattleThemeName); BW.Write(FMODSystem.sndActiveBGMName); BW.Write(FMODSystem.GetPosition(FMODSystem.sndActiveBGM)); BW.Write(ListPlayer.Count); foreach (Player ActivePlayer in ListPlayer) { BW.Write(ActivePlayer.Name); BW.Write(ActivePlayer.PlayerType); BW.Write(ActivePlayer.IsHuman); BW.Write(ActivePlayer.Team); BW.Write(ActivePlayer.Color.R); BW.Write(ActivePlayer.Color.G); BW.Write(ActivePlayer.Color.B); BW.Write(ActivePlayer.ListSquad.Count); foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { BW.Write(ActiveSquad.ID); BW.Write(ActiveSquad.CanMove); BW.Write(ActiveSquad.ActionsRemaining); BW.Write(ActiveSquad.X); BW.Write(ActiveSquad.Y); BW.Write(ActiveSquad.Z); BW.Write(ActiveSquad.SquadName); int UnitInSquad = ActiveSquad.UnitsInSquad; BW.Write(UnitInSquad); BW.Write(ActiveSquad.CurrentLeaderIndex); BW.Write(ActiveSquad.CurrentWingmanAIndex); BW.Write(ActiveSquad.CurrentWingmanBIndex); for (int U = 0; U < UnitInSquad; ++U) { ActiveSquad.At(U).QuickSave(BW); } //List of Attacked Teams. BW.Write(ActiveSquad.ListAttackedTeam.Count); for (int U = 0; U < ActiveSquad.ListAttackedTeam.Count; ++U) { BW.Write(ActiveSquad.ListAttackedTeam[U]); } } } BW.Write(ListMapScript.Count); for (int S = 0; S < ListMapScript.Count; S++) { ListMapScript[S].Save(BW); } FS.Close(); BW.Close(); }
public override void SaveTemporaryMap() { FileStream FS = new FileStream("User Data/Saves/TempSave.sav", FileMode.Create, FileAccess.Write); BinaryWriter BW = new BinaryWriter(FS); BW.Write(BattleMapPath); BW.Write(typeof(DeathmatchMap).AssemblyQualifiedName); DataScreen.SaveProgression(BW, PlayerRoster); BW.Write(DicMapVariables.Count); foreach (KeyValuePair <string, double> Variables in DicMapVariables) { BW.Write(Variables.Key); BW.Write(Variables.Value); } BW.Write(CursorPosition.X); BW.Write(CursorPosition.Y); BW.Write(CameraPosition.X); BW.Write(CameraPosition.Y); BW.Write(ActivePlayerIndex); BW.Write(GameTurn); BW.Write(VictoryCondition); BW.Write(LossCondition); BW.Write(SkillPoint); BW.Write(ListBackground.Count); for (int B = 0; B < ListBackground.Count; ++B) { BW.Write(ListBackground[B].AnimationFullPath); } BW.Write(ListForeground.Count); for (int F = 0; F < ListForeground.Count; ++F) { BW.Write(ListForeground[F].AnimationFullPath); } BW.Write(sndBattleThemeName); BW.Write(FMODSystem.sndActiveBGMName); BW.Write(FMODSystem.GetPosition(FMODSystem.sndActiveBGM)); BW.Write(ListPlayer.Count); foreach (Player ActivePlayer in ListPlayer) { BW.Write(ActivePlayer.Name); BW.Write(ActivePlayer.OnlinePlayerType); BW.Write(ActivePlayer.IsPlayerControlled); BW.Write(ActivePlayer.Team); BW.Write(ActivePlayer.Color.R); BW.Write(ActivePlayer.Color.G); BW.Write(ActivePlayer.Color.B); BW.Write(ActivePlayer.ListSquad.Count); foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { BW.Write(ActiveSquad.ID); BW.Write(ActiveSquad.CanMove); BW.Write(ActiveSquad.ActionsRemaining); BW.Write(ActiveSquad.X); BW.Write(ActiveSquad.Y); BW.Write(ActiveSquad.Z); BW.Write(ActiveSquad.SquadName); BW.Write(ActiveSquad.CurrentMovement); BW.Write(ActiveSquad.IsFlying); BW.Write(ActiveSquad.IsUnderTerrain); BW.Write(ActiveSquad.IsPlayerControlled); if (ActiveSquad.SquadAI == null || ActiveSquad.SquadAI.Path == null) { BW.Write(string.Empty); } else { BW.Write(ActiveSquad.SquadAI.Path); } int UnitsInSquad = ActiveSquad.UnitsInSquad; BW.Write(UnitsInSquad); BW.Write(ActiveSquad.CurrentLeaderIndex); BW.Write(ActiveSquad.CurrentWingmanAIndex); BW.Write(ActiveSquad.CurrentWingmanBIndex); for (int U = 0; U < UnitsInSquad; ++U) { ActiveSquad.At(U).QuickSave(BW); } //List of Attacked Teams. BW.Write(ActiveSquad.ListAttackedTeam.Count); for (int U = 0; U < ActiveSquad.ListAttackedTeam.Count; ++U) { BW.Write(ActiveSquad.ListAttackedTeam[U]); } } } for (int P = 0; P < ListPlayer.Count; P++) { for (int S = 0; S < ListPlayer[P].ListSquad.Count; S++) { if (!ListPlayer[P].ListSquad[S].IsDead) { for (int U = 0; U < ListPlayer[P].ListSquad[S].UnitsInSquad; ++U) { for (int C = 0; C < ListPlayer[P].ListSquad[S].At(U).ArrayCharacterActive.Length; C++) { Character ActiveCharacter = ListPlayer[P].ListSquad[S].At(U).ArrayCharacterActive[C]; ActiveCharacter.Effects.QuickSave(BW); } } } } } BW.Write(ListMapScript.Count); for (int S = 0; S < ListMapScript.Count; S++) { ListMapScript[S].Save(BW); } FS.Close(); BW.Close(); }