1
DOTween & DOTween Pro / Re: Start a tween on another object from a trigger.
« on: April 11, 2016, 11:04:34 PM »
Aah ok
Thanks
Thanks
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
using UnityEngine;
using System.Collections;
using DG.Tweening;
using UnityEngine.UI;
public class MoveMenu : MonoBehaviour
{
public GameObject go;
public Transform tran;
public Button btnOut;
public Button btnIn;
public bool moveBool = false;
private float objectSize;
// Use this for initialization
void Start ()
{
objectSize = (float)go.GetComponent<Renderer>().bounds.size.x;
}
// Update is called once per frame
void Update () {
}
public void moveIt()
{
if (!moveBool)
{
tran.DOMoveX(Screen.width + objectSize , .5f).SetRelative();
moveBool = true;
btnOut.gameObject.SetActive(false);
btnIn.gameObject.SetActive(true);
}
else
{
tran.DOMoveX(-Screen.width + objectSize, .5f).SetRelative();
moveBool = false;
btnOut.gameObject.SetActive(true);
btnIn.gameObject.SetActive(false);
}
}
}