use TickRender() for RenderSprites and PaletteModifier
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -43,9 +44,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
|
||||
if (!dirty)
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITick, INotifyProduction, INotifySold, ISync
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITickRender, INotifyProduction, INotifySold, ISync
|
||||
{
|
||||
Animation roof;
|
||||
[Sync] bool isOpen;
|
||||
@@ -62,9 +62,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
buildComplete = true;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any( a => a != self ))
|
||||
{
|
||||
isOpen = false;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
intendedSprite = disguise.AsSprite;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (disguise.AsSprite != intendedSprite)
|
||||
{
|
||||
@@ -40,7 +41,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
UpdatePalette();
|
||||
}
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
new Animation(self.World, image);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
var desiredState = harv.Fullness * (info.ImagesByFullness.Length - 1) / 100;
|
||||
var desiredImage = info.ImagesByFullness[desiredState];
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
if (DefaultAnimation.Name != desiredImage)
|
||||
DefaultAnimation.ChangeImage(desiredImage, "idle");
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
|
||||
public void Harvested(Actor self, ResourceType resource)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -79,9 +80,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
Attacking(self, target);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
|
||||
if ((State == AnimationState.Moving || dirty) && !move.IsMoving)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -43,13 +44,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
return base.AllowIdleAnimation(self) && !sc.Panicking;
|
||||
}
|
||||
|
||||
public override void Tick (Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wasPanic != sc.Panicking)
|
||||
dirty = true;
|
||||
|
||||
wasPanic = sc.Panicking;
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -41,7 +42,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public bool ShouldBeOpen()
|
||||
{
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving)
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving || cargo.CurrentAdjacentCells == null)
|
||||
return false;
|
||||
|
||||
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
|
||||
@@ -70,14 +71,14 @@ namespace OpenRA.Mods.RA.Render
|
||||
PlayCustomAnimBackwards(self, info.OpenAnim, null);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (ShouldBeOpen())
|
||||
Open();
|
||||
else
|
||||
Close();
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -34,13 +35,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
.Single(a => a.Info.Name == info.Armament);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
var sequence = (armament.IsReloading ? "empty-" : "") + (attack.IsAttacking ? "aim" : "idle");
|
||||
if (sequence != DefaultAnimation.CurrentSequence.Name)
|
||||
DefaultAnimation.ReplaceAnim(sequence);
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
|
||||
}
|
||||
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITick
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITickRender
|
||||
{
|
||||
Dictionary<Barrel, bool> visible = new Dictionary<Barrel, bool>();
|
||||
Dictionary<Barrel, AnimationWithOffset> anims = new Dictionary<Barrel, AnimationWithOffset>();
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
foreach (var a in anims.Values)
|
||||
a.Animation.Tick();
|
||||
|
||||
Reference in New Issue
Block a user