Remove AftermathInfo and move some Rules.GeneralInfo settings onto traits

This commit is contained in:
Paul Chote
2010-02-07 14:15:05 +13:00
parent 31881edade
commit 2e97f3d308
10 changed files with 66 additions and 56 deletions

View File

@@ -6,6 +6,9 @@ namespace OpenRa.Traits
{
class CloakInfo : ITraitInfo
{
public readonly float CloakDelay = 1.2f; // Seconds
public readonly string CloakSound = "ironcur9.aud";
public readonly string UncloakSound = "ironcur9.aud";
public object Create(Actor self) { return new Cloak(self); }
}
@@ -14,14 +17,18 @@ namespace OpenRa.Traits
[Sync]
int remainingUncloakTime = 2; /* setup for initial cloak */
public Cloak(Actor self) {}
Actor self;
public Cloak(Actor self)
{
this.self = self;
}
public void Attacking(Actor self)
{
if (remainingUncloakTime <= 0)
OnCloak();
remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
remainingUncloakTime = (int)(self.Info.Traits.Get<CloakInfo>().CloakDelay * 25);
}
public IEnumerable<Renderable>
@@ -45,12 +52,12 @@ namespace OpenRa.Traits
void OnCloak()
{
Sound.Play("ironcur9.aud");
Sound.Play(self.Info.Traits.Get<CloakInfo>().CloakSound);
}
void OnUncloak()
{
Sound.Play("ironcur9.aud"); /* is this the right sound?? */
Sound.Play(self.Info.Traits.Get<CloakInfo>().UncloakSound);
}
}
}