diff --git a/OpenRa.Game/Effects/Bullet.cs b/OpenRa.Game/Effects/Bullet.cs index a33e549980..f5f72cebe5 100644 --- a/OpenRa.Game/Effects/Bullet.cs +++ b/OpenRa.Game/Effects/Bullet.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using OpenRa.Game.GameRules; using OpenRa.Game.Graphics; diff --git a/OpenRa.Game/Effects/Missile.cs b/OpenRa.Game/Effects/Missile.cs index d34a86954d..bb6fb8e302 100644 --- a/OpenRa.Game/Effects/Missile.cs +++ b/OpenRa.Game/Effects/Missile.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OpenRa.Game.Graphics; +using System.Collections.Generic; using OpenRa.Game.GameRules; +using OpenRa.Game.Graphics; namespace OpenRa.Game.Effects { diff --git a/OpenRa.Game/Effects/Smoke.cs b/OpenRa.Game/Effects/Smoke.cs index f1990665ea..f13f3fe6cd 100644 --- a/OpenRa.Game/Effects/Smoke.cs +++ b/OpenRa.Game/Effects/Smoke.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using OpenRa.Game.Graphics; namespace OpenRa.Game.Effects diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index e9cbb0011a..474d89a03a 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -52,7 +52,7 @@ namespace OpenRa.Game Rules.LoadRules(mapName, useAftermath); for (int i = 0; i < 8; i++) - players[i] = new Player(i, i, "Multi{0}".F(i), Race.Allies); + players[i] = new Player(i, i, "Multi{0}".F(i), Race.Soviet); localPlayerIndex = localPlayer; diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 33e2cbc10b..f1b5bec396 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -171,6 +171,7 @@ + diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index 131d288469..815bf85337 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -1,8 +1,7 @@ using System; -using System.Linq; -using OpenRa.Game.Effects; using System.Collections.Generic; using IjwFramework.Types; +using OpenRa.Game.Effects; namespace OpenRa.Game.Traits { diff --git a/OpenRa.Game/Traits/RenderSubmarine.cs b/OpenRa.Game/Traits/RenderSubmarine.cs new file mode 100644 index 0000000000..73d0fd64c1 --- /dev/null +++ b/OpenRa.Game/Traits/RenderSubmarine.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using OpenRa.Game.Graphics; + +namespace OpenRa.Game.Traits +{ + class RenderSubmarine : RenderSimple, INotifyAttack, ITick + { + int remainingSurfaceTime = 2; /* setup for initial dive */ + + public RenderSubmarine(Actor self) + : base(self) + { + anim.PlayFacing("idle", () => self.traits.Get().Facing); + } + + public void Attacking(Actor self) + { + if (remainingSurfaceTime <= 0) + OnSurface(); + + remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 / 25); + } + + public override IEnumerable> Render(Actor self) + { + var s = Util.Centered(self, anim.Image, self.CenterLocation); + if (remainingSurfaceTime <= 0) + { + s.c = 8; /* shadow only palette */ + if (self.Owner != Game.LocalPlayer) + yield break; /* can't see someone else's submerged subs */ + } + yield return s; + } + + public override void Tick(Actor self) + { + base.Tick(self); + if (remainingSurfaceTime > 0) + if (--remainingSurfaceTime <= 0) + OnDive(); + } + + void OnSurface() + { + Sound.Play("subshow1.aud"); + } + + void OnDive() + { + Sound.Play("subshow1.aud"); /* is this the right sound?? */ + } + } +} diff --git a/units.ini b/units.ini index 2ae79f0881..6690292869 100755 --- a/units.ini +++ b/units.ini @@ -94,7 +94,7 @@ PT Description=Submarine WaterBound=yes BuiltAt=spen -Traits=Unit, Mobile, RenderUnit +Traits=Unit, Mobile, RenderSubmarine [DD] Description=Destroyer WaterBound=yes