Created
March 30, 2015 19:43
-
-
Save klutch/956f6c608d62dd29f991 to your computer and use it in GitHub Desktop.
ShrinkAndDestroyScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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