submarine dive/surface works
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
<Compile Include="Traits\RenderBuildingTurreted.cs" />
|
||||
<Compile Include="Traits\RenderBuildingWarFactory.cs" />
|
||||
<Compile Include="Traits\RenderSimple.cs" />
|
||||
<Compile Include="Traits\RenderSubmarine.cs" />
|
||||
<Compile Include="Traits\RenderUnit.cs" />
|
||||
<Compile Include="Traits\RenderUnitMuzzleFlash.cs" />
|
||||
<Compile Include="Traits\RenderUnitReload.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
|
||||
{
|
||||
|
||||
54
OpenRa.Game/Traits/RenderSubmarine.cs
Normal file
54
OpenRa.Game/Traits/RenderSubmarine.cs
Normal file
@@ -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<Unit>().Facing);
|
||||
}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
{
|
||||
if (remainingSurfaceTime <= 0)
|
||||
OnSurface();
|
||||
|
||||
remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 / 25);
|
||||
}
|
||||
|
||||
public override IEnumerable<Tuple<Sprite, float2, int>> 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?? */
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user