Пример #1
0
    public bool CustomUpdate(float time)
    {
        for (int i = 0; i < trailerParts.Count; i++)
        {
            TrailerPart trailerPart = trailerParts[i];

            trailerPart.spriteRenderer.transform.localScale -= Vector3.one * scaleDecreasePerSecond * time;

            if (trailerPart.CustomUpdate(time))
            {
                trailerParts.Remove(trailerPart);
                Trailer.GiveTrailerPart(trailerPart);
                Debug.Log("Test");
            }
        }
        if ((timeLastPart -= time) <= 0.0f)
        {
            TrailerPart trailerPart = Trailer.TakeTrailerPart();
            trailerPart.Init(originalRenderer, lifeTime);
            trailerPart.transform.parent = transform;

            trailerParts.Add(trailerPart);
            timeLastPart = partDistance;
        }
        if ((duration -= time) <= 0.0f)
        {
            return(true);
        }
        return(false);
    }