Prechádzať zdrojové kódy

拍照:碰撞盒计算

zhaoyang 3 rokov pred
rodič
commit
630d08f06b

+ 11 - 5
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -1,6 +1,8 @@
 using UnityEngine;
 using System.Collections;
 using System;
+using UnityEditor;
+
 namespace GFGGame
 {
     public class SceneController
@@ -74,7 +76,8 @@ namespace GFGGame
             Sprite sp = GFGAsset.Load<Sprite>(resPath);
             spr.sprite = sp;
             spr.size = spr.sprite.bounds.size;//将节点设置为原图大小
-
+            // TextureImporter ti = (TextureImporter)TextureImporter.GetAtPath(AssetDatabase.GetAssetPath(spr));
+            // ti.isReadable = true;
 
             if (type == EnumPhotographType.BG)
             {
@@ -88,12 +91,15 @@ namespace GFGGame
         }
         public static void PhotographAddCollider(GameObject gameObject)
         {
-            if (gameObject.GetComponent<PolygonCollider2D>() == null)
+            PolygonCollider2D polygonCollider2D = gameObject.GetComponent<PolygonCollider2D>();
+            if (polygonCollider2D != null)
             {
-                gameObject.AddComponent<PolygonCollider2D>();
-                gameObject.GetComponent<PolygonCollider2D>().isTrigger = true;
-                gameObject.GetComponent<PolygonCollider2D>().autoTiling = true;
+                GameObject.Destroy(polygonCollider2D);
             }
+
+            polygonCollider2D = gameObject.AddComponent<PolygonCollider2D>();
+            polygonCollider2D.isTrigger = true;
+
         }
 
         public static void UpdateRole(int[] equipDatas, GameObject sceneObj, bool needSetMask = false, int[] exceptTypes = null, bool showAni = true, GameObject parentObj = null)

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -40,6 +40,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            Input.multiTouchEnabled = true;
 
 
             if (_sceneObject == null)