added durationbar indicator for chronoshift, closes #2287
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2013 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 System.Drawing;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -18,13 +19,14 @@ namespace OpenRA.Mods.RA
|
||||
public readonly bool ExplodeInstead = false;
|
||||
}
|
||||
|
||||
public class Chronoshiftable : ITick, ISync
|
||||
public class Chronoshiftable : ITick, ISync, ISelectionBar
|
||||
{
|
||||
// Return-to-sender logic
|
||||
[Sync] CPos chronoshiftOrigin;
|
||||
[Sync] int chronoshiftReturnTicks = 0;
|
||||
Actor chronosphere;
|
||||
bool killCargo;
|
||||
int TotalTicks;
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
@@ -66,6 +68,7 @@ namespace OpenRA.Mods.RA
|
||||
/// Set up return-to-sender info
|
||||
chronoshiftOrigin = self.Location;
|
||||
chronoshiftReturnTicks = duration;
|
||||
TotalTicks = duration;
|
||||
this.chronosphere = chronosphere;
|
||||
this.killCargo = killCargo;
|
||||
|
||||
@@ -75,5 +78,13 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Show the remaining time as a bar
|
||||
public float GetValue()
|
||||
{
|
||||
return (float)chronoshiftReturnTicks / TotalTicks;
|
||||
}
|
||||
|
||||
public Color GetColor() { return Color.White; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user