status/ZoomStatus.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
[Status(3, 0, 0.4f, 0, false )]
public class ZoomStatus : Status
{
public ZoomStatus()
{
Title = "Eagle Eye";
IconPath = "textures/icons/zoom_camera.png";
}
public override void Init(Player player)
{
base.Init(player);
}
public override void Refresh()
{
Description = GetDescription(Level);
Player.Modify(this, PlayerStat.ZoomAmount, GetAmountForLevel(Level), ModifierType.Add);
float zoom = 1f + GetAmountForLevel( Level );
Manager.Instance.Camera.OrthographicHeight = 10f * zoom;
}
public override string GetDescription(int newLevel)
{
return string.Format("Zoom camera out by {0}%", GetPercentForLevel( Level));
}
public override string GetUpgradeDescription(int newLevel)
{
return newLevel > 1 ? string.Format( "Zoom camera out by {0}%→{1}%", GetPercentForLevel( newLevel - 1), GetPercentForLevel( newLevel)) : GetDescription(newLevel);
}
public float GetAmountForLevel(int level)
{
return level * 0.1f + (level == 3 ? 0.05f : 0f);
}
public float GetPercentForLevel( int level )
{
return level * 10f + (level == 3 ? 5f : 0);
}
}