Skip to content

Instantly share code, notes, and snippets.

@klutch
Created March 30, 2015 19:43
Show Gist options
  • Save klutch/956f6c608d62dd29f991 to your computer and use it in GitHub Desktop.
Save klutch/956f6c608d62dd29f991 to your computer and use it in GitHub Desktop.
ShrinkAndDestroyScript
using UnityEngine;
using System.Collections;
public class ShrinkAndDestroyScript : MonoBehaviour
{
public float time = 0.75f;
public iTween.EaseType easeType;
public float delay = 0f;
public bool destroyParent = false;
void Start()
{
iTween.ScaleTo(
gameObject,
iTween.Hash(
"x", 0f,
"y", 0f,
"easeType", easeType,
"time", time,
"delay", delay,
"oncomplete", "done",
"oncompletetarget", gameObject));
}
public void done()
{
if (destroyParent)
{
Destroy(transform.parent.gameObject);
}
else
{
Destroy(gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment