Синтаксис:
Используется javascript
var rectButton : Rect;
var maxSizeWidht : float = 150;
var maxSizeHeight : float = 150;
var minSizeWidht : float = 50;
var minSizeHeight : float = 50;
var speedSmooth : int = 1;
var isZoomed : boolean = false;
function Start () {
}
function OnGUI(){
if (GUI.Button(rectButton, "Test") && isZoomed == false)
{
isZoomed = true;
}
if (GUI.Button(rectButton, "Test") && isZoomed == true)
{
isZoomed = false;
}
}
function Update () {
ZoomIn();
ZoomOut();
}
function ZoomIn(){
if (isZoomed == true){
if (rectButton.width < maxSizeWidht && rectButton.height < maxSizeHeight)
{
rectButton.width+=5+speedSmooth;
rectButton.height+=5+speedSmooth;
}
}
}
function ZoomOut(){
if (isZoomed == false){
if (rectButton.width > minSizeWidht && rectButton.height > minSizeWidht)
{
rectButton.width-=5+speedSmooth;
rectButton.height-=5+speedSmooth;
}
}
}
var maxSizeWidht : float = 150;
var maxSizeHeight : float = 150;
var minSizeWidht : float = 50;
var minSizeHeight : float = 50;
var speedSmooth : int = 1;
var isZoomed : boolean = false;
function Start () {
}
function OnGUI(){
if (GUI.Button(rectButton, "Test") && isZoomed == false)
{
isZoomed = true;
}
if (GUI.Button(rectButton, "Test") && isZoomed == true)
{
isZoomed = false;
}
}
function Update () {
ZoomIn();
ZoomOut();
}
function ZoomIn(){
if (isZoomed == true){
if (rectButton.width < maxSizeWidht && rectButton.height < maxSizeHeight)
{
rectButton.width+=5+speedSmooth;
rectButton.height+=5+speedSmooth;
}
}
}
function ZoomOut(){
if (isZoomed == false){
if (rectButton.width > minSizeWidht && rectButton.height > minSizeWidht)
{
rectButton.width-=5+speedSmooth;
rectButton.height-=5+speedSmooth;
}
}
}