本文整理汇总了C#中OTSprite.GetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C# OTSprite.GetInstanceID方法的具体用法?C# OTSprite.GetInstanceID怎么用?C# OTSprite.GetInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTSprite
的用法示例。
在下文中一共展示了OTSprite.GetInstanceID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSprite
/// <summary>
/// Add a sprite to the SpriteBatch
/// </summary>
/// <param name="sprite">Sprite to add</param>
/// <remarks>
/// The sprite is added while it stays in its
/// original scene hierarchy location. It will not be
/// moved as a child of the batch object.
/// </remarks>
public void AddSprite(OTSprite sprite)
{
if (linked.Contains(sprite))
return;
if (!lookup.ContainsKey(sprite.GetInstanceID()))
{
if (sprite.otTransform.parent!=transform)
linked.Add(sprite);
sprite.onObjectChanged += SpriteChanged;
sprite._iMsg = "batched";
meshDirty = true;
}
}
示例2: RemoveSprite
/// <summary>
/// Will remove a sprite from the SpriteBatch
/// </summary>
/// <param name="sprite">Sprite to remove</param>
/// <param name="newParent">Move sprite to this parent</param>
public void RemoveSprite(OTSprite sprite, GameObject newParent)
{
meshDirty = true;
#if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
sprite.gameObject.SetActiveRecursively(true);
#else
sprite.gameObject.SetActive(true);
#endif
if (lookup.ContainsKey(sprite.GetInstanceID()))
{
spriteData[lookup[sprite.GetInstanceID()]] = new SpriteData();
lookup.Remove(sprite.GetInstanceID());
}
sprites.Remove(sprite);
if (linked.Contains(sprite))
linked.Remove(sprite);
sprite.onObjectChanged -= SpriteChanged;
sprite._iMsg = "show";
sprite._iMsg = "!batched";
sprite.StartUp();
}