using UnityEngine;
using System.Collections;
using Verse;


namespace RimWorld{
public class CompLifespan : ThingComp
{
	public int age = -1;

	public override void PostExposeData()
	{
		base.PostExposeData();
		Scribe_Values.LookValue(ref age, "age");
	}

	public override void CompTick()
	{
		age++;
		if( age >= props.lifespanTicks )
			parent.Destroy();
	}

	public override string CompInspectStringExtra() 
	{
		string descStr = base.CompInspectStringExtra();

		int ticksLeft = props.lifespanTicks - age;
		if ( ticksLeft > 0 )
			descStr = "LifespanExpiry".Translate() + " " + ticksLeft.TickstoDaysAndHoursString() + "\n" + descStr;

		return descStr; 
	}
}}