added durationbar indicator for chronoshift, closes #2287
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#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
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -18,13 +19,14 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly bool ExplodeInstead = false;
|
public readonly bool ExplodeInstead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Chronoshiftable : ITick, ISync
|
public class Chronoshiftable : ITick, ISync, ISelectionBar
|
||||||
{
|
{
|
||||||
// Return-to-sender logic
|
// Return-to-sender logic
|
||||||
[Sync] CPos chronoshiftOrigin;
|
[Sync] CPos chronoshiftOrigin;
|
||||||
[Sync] int chronoshiftReturnTicks = 0;
|
[Sync] int chronoshiftReturnTicks = 0;
|
||||||
Actor chronosphere;
|
Actor chronosphere;
|
||||||
bool killCargo;
|
bool killCargo;
|
||||||
|
int TotalTicks;
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -66,6 +68,7 @@ namespace OpenRA.Mods.RA
|
|||||||
/// Set up return-to-sender info
|
/// Set up return-to-sender info
|
||||||
chronoshiftOrigin = self.Location;
|
chronoshiftOrigin = self.Location;
|
||||||
chronoshiftReturnTicks = duration;
|
chronoshiftReturnTicks = duration;
|
||||||
|
TotalTicks = duration;
|
||||||
this.chronosphere = chronosphere;
|
this.chronosphere = chronosphere;
|
||||||
this.killCargo = killCargo;
|
this.killCargo = killCargo;
|
||||||
|
|
||||||
@@ -75,5 +78,13 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
return true;
|
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