Defeat Player

public void DefeatPlayer(Player player)

Call this method to defeat the given player. Useful, if you want to add custom win/lose conditions in your game.

Kills all units currently owned by the player, marks the player as defeated (Player.IsDefeated) and fires the PlayerDefeated event.

[Inject] PlayersService players;

// this example code can be run from any script

players.DefeatPlayer(players.LocalPlayer); // defeats the local player