mergemilitary/Assets/ThirdPlugins/EasyTouchBundle/EasyTouchControls/Plugins/ComponentExtensions.cs

21 lines
602 B
C#

/***********************************************
EasyTouch Controls
Copyright © 2016 The Hedgehog Team
http://www.thehedgehogteam.com/Forum/
The.Hedgehog.Team@gmail.com
**********************************************/
using UnityEngine;
using System.Collections;
public static class ComponentExtensions{
public static RectTransform rectTransform(this Component cp){
return cp.transform as RectTransform;
}
public static float Remap (this float value, float from1, float to1, float from2, float to2) {
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
}
}