-
-
Save Yazir/2fafdc73e6d765363dfe7635cbe6a530 to your computer and use it in GitHub Desktop.
Tweens problem
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
private void Destructible_OnDeath(GameObject source) | |
{ | |
transform.parent = GameManager.Misc.transform; | |
Vector3 initialScale = transform.localScale; | |
Vector3 initialPosition = transform.position; | |
System.Action<ITween<float>> animUpdate = (t) => | |
{ | |
transform.localScale = initialScale * (1 + t.CurrentProgress * 0.5f); | |
baseRenderer.material.color = new Color(1, 1, 1, 1 * (1 - t.CurrentProgress)); | |
transform.position = initialPosition + new Vector3(0, 0.35f, 0) * t.CurrentProgress; | |
}; | |
System.Action<ITween<float>> animFinish = (t) => //This doesn't get called sometimes, leaving half transparent object in the scene | |
{ | |
Destroy(gameObject); | |
}; | |
gameObject.Tween("updatePos", 0f, 1f, 0.6f, TweenScaleFunctions.CubicEaseOut, animUpdate, animFinish); | |
//StartCoroutine("DestroyDelayed", 0.65f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment