public void ReturnToPool(float time) { UnboundCoroutine.Start(ReturnToPoolRoutine(this, time)); /*if (SourcePool != null) * { * SourcePool.ReturnToPool(this, time); * } * else * { * Debug.Log("DESTROY C"); * Destroy(gameObject, time); * }*/ }
/// <summary> /// Teleports an entity to a specified destination /// </summary> /// <param name="entity">The entity to teleport</param> /// <param name="Destination">The destination of the entity</param> /// <param name="teleInTime">How long the entity will wait before it will teleport</param> /// <param name="teleOutTime">How long the entity will wait after it has teleported</param> /// <param name="teleportColor">The color of the teleportation effects. If left at the default, the teleport color will be white</param> /// <param name="flashSprite">Whether the sprite on the entity should flash or not. This only works if the entity has a <see cref="SpriteRenderer"/> and a <see cref="WeaverCore.Components.SpriteFlasher"/> If a <see cref="WeaverCore.Components.SpriteFlasher"/> is not already on the entity, one will be created</param> /// <param name="playEffects">Whether the teleportation effects should be played.</param> /// <returns>Returns the amount of time the teleportation will take. You can use this if you want to wait until the teleportation is done</returns> public static float TeleportEntity(GameObject entity, Vector3 Destination, float teleInTime, float teleOutTime, Color teleportColor = default(Color), bool flashSprite = true, bool playEffects = true, float audioPitch = 1f) { if (teleportColor == default(Color)) { teleportColor = Color.white; } if (teleInTime < 0f) { teleInTime = 0f; } if (teleOutTime < 0f) { teleOutTime = 0f; } var sprite = entity.GetComponent <SpriteRenderer>(); var flasher = entity.GetComponent <SpriteFlasher>(); if (flashSprite) { if (sprite == null) { throw new TeleportException("The entity to be teleported does not have a SpriteRenderer. Either add a sprite renderer to the entity, or set flashSprite to false"); } if (flasher == null) { flasher = entity.AddComponent <SpriteFlasher>(); } } float storedAlpha = sprite.color.a; UnboundCoroutine.Start(TeleportRoutine(entity, Destination, teleInTime, teleOutTime, teleportColor, flashSprite, playEffects, audioPitch, sprite, flasher, storedAlpha)); return(teleInTime + teleOutTime); }
public static void Stop(UnboundCoroutine coroutine) { impl.Stop(coroutine); }