You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
999 B
48 lines
999 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Two_D_Games_Explosions_VFX {
|
|
|
|
public class ButtonAnimation : MonoBehaviour {
|
|
float initial_size_x;
|
|
float initial_size_y;
|
|
public float factor = 0.5f;
|
|
public float speed = 1.15f;
|
|
bool GO = false;
|
|
|
|
void Awake () {
|
|
initial_size_x = transform.localScale.x;
|
|
initial_size_y = transform.localScale.y;
|
|
}
|
|
|
|
void FixedUpdate () {
|
|
if(GO)
|
|
{
|
|
float aux_x = transform.localScale.x;
|
|
float aux_y = transform.localScale.y;
|
|
if(transform.localScale.y < initial_size_y)
|
|
{
|
|
aux_x *= speed;
|
|
aux_y *= speed;
|
|
transform.localScale = new Vector3 (aux_x, aux_y, 1.0f);
|
|
}
|
|
else
|
|
{
|
|
aux_x = initial_size_x;
|
|
aux_y = initial_size_y;
|
|
transform.localScale = new Vector3 (aux_x, aux_y, 1.0f);
|
|
GO = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void Go()
|
|
{
|
|
GO = true;
|
|
transform.localScale = new Vector3 (initial_size_x*factor, initial_size_y*factor, 1.0f);
|
|
}
|
|
}
|
|
}
|