Ejemplo n.º 1
0
    public static GoTween ScaleOut(this GameObject self, float duration = 0.5f, ScaleOutEndAction action = ScaleOutEndAction.Destroy, float scale = 0, bool isRelative = false, GoEaseType ease = GoEaseType.Linear)
    {
        if (duration == 0)
        {
            Debug.LogWarning("Invalid parameter duration on ScaleOut call");
        }

        GoTween tween = self.transform.scaleTo(duration, scale, isRelative);

        if (tween != null)
        {
            switch (action)
            {
            case ScaleOutEndAction.DoNothing: break;

            case ScaleOutEndAction.Inactive:
                tween.setOnCompleteHandler(c => self.SetActive(false));
                break;

            case ScaleOutEndAction.Destroy:
                tween.setOnCompleteHandler(c => self.DestroySelf());
                break;
            }
            tween.eases(ease);
        }
        else
        {
            switch (action)
            {
            case ScaleOutEndAction.DoNothing: break;

            case ScaleOutEndAction.Inactive:
                self.SetActive(false);
                break;

            case ScaleOutEndAction.Destroy:
                self.DestroySelf();
                break;
            }
        }
        return(tween);
    }