Scripted lose condition

This commit is contained in:
alzeih
2010-08-22 00:27:37 +12:00
committed by Paul Chote
parent 70a92b80cf
commit c433ca77c4
2 changed files with 30 additions and 3 deletions

View File

@@ -64,7 +64,30 @@ namespace OpenRA.Mods.RA
Sound.StopMusic();
w.DisableTick = true;
var player = Widget.RootWidget.OpenWindow("FMVPLAYER").GetWidget<VqaPlayerWidget>("PLAYER");
player.Load("gunboat.vqa");
player.Load("consyard.vqa");
player.PlayThen(() =>
{
Widget.RootWidget.CloseWindow();
w.DisableTick = false;
Game.Disconnect();
});
}));
}
public void OnLose(World w)
{
started = false;
Sound.PlayToPlayer(w.LocalPlayer, "fail1.aud");
w.LocalPlayer.WinState = WinState.Lost;
w.WorldActor.CancelActivity();
w.WorldActor.QueueActivity(new Wait(125));
w.WorldActor.QueueActivity(new CallFunc(() =>
{
Sound.StopMusic();
w.DisableTick = true;
var player = Widget.RootWidget.OpenWindow("FMVPLAYER").GetWidget<VqaPlayerWidget>("PLAYER");
player.Load("gameover.vqa");
player.PlayThen(() =>
{
Widget.RootWidget.CloseWindow();
@@ -96,7 +119,11 @@ namespace OpenRA.Mods.RA
if (badcount == 0)
OnVictory(self.World);
}
}
//GoodGuy lose conditions
if (self.World.Queries.OwnedBy[Players["GoodGuy"]].Count( a => a.IsInWorld && !a.IsDead()) == 0)
OnLose(self.World);
// GoodGuy reinforcements
if (ticks == 25*5)