private void SendWave(Tree startTree, Tree targetTree) { ContentLoader.Load <Sound>("GhostWaveStart").Play(0.5f); var ghostsToSend = Math.Min(startTree.NumberOfGhosts, 5); startTree.NumberOfGhosts -= ghostsToSend; UpdateBars(); if (targetTree == null) { return; } var wave = new GhostWave(startTree.Center, targetTree.Center, ghostsToSend, startTree.CurrentTeam.ToColor()); wave.Attacker = startTree.CurrentTeam; wave.TargetReached += (attacker, waveSize) => { targetTree.Attack((Team)attacker, waveSize); UpdateBars(); }; }
private void SendWave(Tree startTree, Tree targetTree) { ContentLoader.Load<Sound>("GhostWaveStart").Play(0.5f); var ghostsToSend = Math.Min(startTree.NumberOfGhosts, 5); startTree.NumberOfGhosts -= ghostsToSend; UpdateBars(); if (targetTree == null) return; var wave = new GhostWave(startTree.Center, targetTree.Center, ghostsToSend, startTree.Team.ToColor()); wave.Attacker = startTree.Team; wave.TargetReached += (attacker, waveSize) => { targetTree.Attack((Team)attacker, waveSize); UpdateBars(); }; }