|
@@ -167,7 +167,7 @@ namespace GFGGame
|
|
|
|
|
|
//清理旧的
|
|
//清理旧的
|
|
TryClearSpriteObj(parentObj, BODY_SPRITE_NAME);
|
|
TryClearSpriteObj(parentObj, BODY_SPRITE_NAME);
|
|
- TryRemoveObj(parentObj, BODY_ANIMATION_NAME);
|
|
|
|
|
|
+ var removeBodyAni = TryRemoveObj(parentObj, BODY_ANIMATION_NAME);
|
|
TryRemoveObj(parentObj, BODY_EFFECT_OBJ_NAME);
|
|
TryRemoveObj(parentObj, BODY_EFFECT_OBJ_NAME);
|
|
|
|
|
|
if (isAni)
|
|
if (isAni)
|
|
@@ -177,7 +177,10 @@ namespace GFGGame
|
|
else
|
|
else
|
|
{
|
|
{
|
|
AddSpriteObj(res, "png", BODY_SPRITE_NAME, parentObj, 0, needSetMask);
|
|
AddSpriteObj(res, "png", BODY_SPRITE_NAME, parentObj, 0, needSetMask);
|
|
- parentObj.transform.SetPositionAndRotation(new Vector3(), new Quaternion());
|
|
|
|
|
|
+ if(removeBodyAni)
|
|
|
|
+ {
|
|
|
|
+ parentObj.transform.SetPositionAndRotation(new Vector3(), new Quaternion());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//特效
|
|
//特效
|
|
if (!string.IsNullOrEmpty(effRes))
|
|
if (!string.IsNullOrEmpty(effRes))
|
|
@@ -379,11 +382,11 @@ namespace GFGGame
|
|
return gameObj;
|
|
return gameObj;
|
|
}
|
|
}
|
|
|
|
|
|
- private static void TryRemoveObj(GameObject parentObj, string aniObjName)
|
|
|
|
|
|
+ private static bool TryRemoveObj(GameObject parentObj, string aniObjName)
|
|
{
|
|
{
|
|
if (parentObj == null)
|
|
if (parentObj == null)
|
|
{
|
|
{
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
Transform transform = parentObj.transform.Find(aniObjName);
|
|
Transform transform = parentObj.transform.Find(aniObjName);
|
|
if (transform != null)
|
|
if (transform != null)
|
|
@@ -392,8 +395,10 @@ namespace GFGGame
|
|
if (gameObj != null)
|
|
if (gameObj != null)
|
|
{
|
|
{
|
|
GameObject.DestroyImmediate(gameObj);
|
|
GameObject.DestroyImmediate(gameObj);
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
public static GameObject CreateAnimationObj(string resPath)
|
|
public static GameObject CreateAnimationObj(string resPath)
|