コード例 #1
0
 public void Explosion(Vector3 point, Quaternion rot, bool myself)
 {
     if (bUse)
     {
         colPoint = point;
         if (!bBoom && expolsion != null)
         {
             GameObject     gameObject = Object.Instantiate((Object)expolsion, point, rot) as GameObject;
             CheckBrickDead component  = gameObject.GetComponent <CheckBrickDead>();
             if (component != null)
             {
                 component.brickID = idBrick;
             }
             CheckMonDead component2 = gameObject.GetComponent <CheckMonDead>();
             if (component2 != null)
             {
                 component2.MonID = idMon;
             }
             if (myself)
             {
                 ParentFollow component3 = gameObject.GetComponent <ParentFollow>();
                 if (component3 != null)
                 {
                     component3.HitParent = GlobalVars.Instance.hitParent;
                     component3.ParentSeq = GlobalVars.Instance.hitBirckman;
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: ClothFactory.cs プロジェクト: kmlkmljkl2/Anarchy
    public static GameObject GetHair(GameObject reference, string name, Material material, Color color)
    {
        List <GameObject> list;
        bool       flag = ClothFactory.clothCache.TryGetValue(name, out list);
        GameObject result;

        if (flag)
        {
            for (int i = 0; i < list.Count; i++)
            {
                GameObject gameObject = list[i];
                bool       flag2      = gameObject == null;
                if (flag2)
                {
                    Debug.Log("Hair is null");
                    list.RemoveAt(i);
                    i = Mathf.Max(i - 1, 0);
                }
                else
                {
                    ParentFollow component = gameObject.GetComponent <ParentFollow>();
                    bool         flag3     = !component.isActiveInScene;
                    if (flag3)
                    {
                        component.isActiveInScene                 = true;
                        gameObject.renderer.material              = material;
                        gameObject.renderer.material.color        = color;
                        gameObject.GetComponent <Cloth>().enabled = true;
                        gameObject.GetComponent <SkinnedMeshRenderer>().enabled = true;
                        gameObject.GetComponent <ParentFollow>().SetParent(reference.transform);
                        ClothFactory.ReapplyClothBones(reference, gameObject);
                        return(gameObject);
                    }
                }
            }
            GameObject gameObject2 = ClothFactory.GenerateCloth(reference, name);
            gameObject2.renderer.material       = material;
            gameObject2.renderer.material.color = color;
            gameObject2.AddComponent <ParentFollow>().SetParent(reference.transform);
            list.Add(gameObject2);
            ClothFactory.clothCache[name] = list;
            result = gameObject2;
        }
        else
        {
            GameObject gameObject2 = ClothFactory.GenerateCloth(reference, name);
            gameObject2.renderer.material       = material;
            gameObject2.renderer.material.color = color;
            gameObject2.AddComponent <ParentFollow>().SetParent(reference.transform);
            list = new List <GameObject>
            {
                gameObject2
            };
            ClothFactory.clothCache.Add(name, list);
            result = gameObject2;
        }
        return(result);
    }
コード例 #3
0
ファイル: ClothFactory.cs プロジェクト: alerithe/guardian
    public static GameObject GetHair(GameObject reference, string name, Material material, Color color)
    {
        GameObject   gameObject2;
        ParentFollow parentFollow;

        if (ClothCache.TryGetValue(name, out List <GameObject> value))
        {
            for (int i = 0; i < value.Count; i++)
            {
                GameObject gameObject = value[i];
                if (gameObject == null)
                {
                    value.RemoveAt(i);
                    i = Mathf.Max(i - 1, 0);
                    continue;
                }
                ParentFollow component = gameObject.GetComponent <ParentFollow>();
                if (!component.isActiveInScene)
                {
                    component.isActiveInScene                 = true;
                    gameObject.renderer.material              = material;
                    gameObject.renderer.material.color        = color;
                    gameObject.GetComponent <Cloth>().enabled = true;
                    gameObject.GetComponent <SkinnedMeshRenderer>().enabled = true;
                    gameObject.GetComponent <ParentFollow>().SetParent(reference.transform);
                    ReapplyClothBones(reference, gameObject);
                    return(gameObject);
                }
            }
            gameObject2 = GenerateCloth(reference, name);
            gameObject2.renderer.material       = material;
            gameObject2.renderer.material.color = color;
            parentFollow = gameObject2.AddComponent <ParentFollow>();
            parentFollow.SetParent(reference.transform);
            value.Add(gameObject2);
            ClothCache[name] = value;
            return(gameObject2);
        }
        gameObject2 = GenerateCloth(reference, name);
        gameObject2.renderer.material       = material;
        gameObject2.renderer.material.color = color;
        parentFollow = gameObject2.AddComponent <ParentFollow>();
        parentFollow.SetParent(reference.transform);
        value = new List <GameObject>
        {
            gameObject2
        };
        ClothCache.Add(name, value);
        return(gameObject2);
    }
コード例 #4
0
    public static GameObject GetHair(GameObject reference, string name, Material material, Color color)
    {
        List <GameObject> list;
        GameObject        obj4;

        if (!clothCache.TryGetValue(name, out list))
        {
            obj4 = GenerateCloth(reference, name);
            obj4.GetComponent <Renderer>().material       = material;
            obj4.GetComponent <Renderer>().material.color = color;
            obj4.AddComponent <ParentFollow>().SetParent(reference.transform);
            list = new List <GameObject> {
                obj4
            };
            clothCache.Add(name, list);
            return(obj4);
        }
        for (int i = 0; i < list.Count; i++)
        {
            GameObject clothObject = list[i];
            if (clothObject == null)
            {
                list.RemoveAt(i);
                i = Mathf.Max(i - 1, 0);
            }
            else
            {
                ParentFollow component = clothObject.GetComponent <ParentFollow>();
                if (!component.isActiveInScene)
                {
                    component.isActiveInScene = true;
                    clothObject.GetComponent <Renderer>().material           = material;
                    clothObject.GetComponent <Renderer>().material.color     = color;
                    clothObject.GetComponent <Cloth>().enabled               = true;
                    clothObject.GetComponent <SkinnedMeshRenderer>().enabled = true;
                    clothObject.GetComponent <ParentFollow>().SetParent(reference.transform);
                    ReapplyClothBones(reference, clothObject);
                    return(clothObject);
                }
            }
        }
        obj4 = GenerateCloth(reference, name);
        obj4.GetComponent <Renderer>().material       = material;
        obj4.GetComponent <Renderer>().material.color = color;
        obj4.AddComponent <ParentFollow>().SetParent(reference.transform);
        list.Add(obj4);
        clothCache[name] = list;
        return(obj4);
    }
コード例 #5
0
 public static void DisposeObject(GameObject cachedObject)
 {
     if (cachedObject != null)
     {
         ParentFollow component = cachedObject.GetComponent <ParentFollow>();
         if (component != null)
         {
             if (component.isActiveInScene)
             {
                 cachedObject.GetComponent <SkinnedMeshRenderer>().enabled = false;
                 //cachedObject.GetComponent<Cloth>().enabled = false;
                 component.isActiveInScene       = false;
                 cachedObject.transform.position = new Vector3(0f, -99999f, 0f);
                 cachedObject.GetComponent <ParentFollow>().RemoveParent();
             }
         }
         else
         {
             UnityEngine.Object.Destroy(cachedObject);
         }
     }
 }
コード例 #6
0
ファイル: ClothFactory.cs プロジェクト: kmlkmljkl2/Anarchy
    public static void DisposeObject(GameObject cachedObject)
    {
        bool flag = cachedObject != null;

        if (flag)
        {
            ParentFollow component = cachedObject.GetComponent <ParentFollow>();
            bool         flag2     = component != null;
            if (flag2)
            {
                bool isActiveInScene = component.isActiveInScene;
                if (isActiveInScene)
                {
                    component.isActiveInScene       = false;
                    cachedObject.transform.position = new Vector3(0f, -99999f, 0f);
                    cachedObject.GetComponent <ParentFollow>().RemoveParent();
                }
            }
            else
            {
                UnityEngine.Object.Destroy(cachedObject);
            }
        }
    }
コード例 #7
0
 public void createBullet(Vector3 pnt, Vector3 nml, int brickSeq, int bulletId, int hitState)
 {
     if (!(bulletObj == null))
     {
         if (!isMuzzle)
         {
             if (dic.ContainsKey(bulletId))
             {
                 ProjectileWrap projectileWrap = dic[bulletId];
                 if (projectileWrap != null)
                 {
                     Object.DestroyImmediate(projectileWrap.projectile);
                     dic.Remove(bulletId);
                 }
             }
             if (!(bulletObj == null))
             {
                 GameObject gameObject = Object.Instantiate((Object)bulletObj) as GameObject;
                 gameObject.transform.position = pnt;
                 gameObject.transform.forward  = nml;
                 if (brickSeq >= 0 && hitState == 1)
                 {
                     CheckBrickDead component = gameObject.GetComponent <CheckBrickDead>();
                     component.brickID = brickSeq;
                 }
                 if (brickSeq >= 0 && hitState == 2)
                 {
                     CheckMonDead component2 = gameObject.GetComponent <CheckMonDead>();
                     component2.MonID = brickSeq;
                 }
                 if (hitState == 0 || hitState == 2)
                 {
                     ParentFollow component3 = gameObject.GetComponent <ParentFollow>();
                     if (component3 != null)
                     {
                         component3.HitParent            = GlobalVars.Instance.hitParent;
                         component3.ParentSeq            = GlobalVars.Instance.hitBirckman;
                         GlobalVars.Instance.hitParent   = null;
                         GlobalVars.Instance.hitBirckman = -1;
                     }
                 }
             }
         }
         else
         {
             GameObject gameObject2 = Object.Instantiate((Object)bulletObj) as GameObject;
             gameObject2.transform.position = pnt;
             gameObject2.transform.forward  = nml;
             if (brickSeq >= 0 && hitState == 1)
             {
                 CheckBrickDead component4 = gameObject2.GetComponent <CheckBrickDead>();
                 component4.brickID = brickSeq;
             }
             if (brickSeq >= 0 && hitState == 2)
             {
                 CheckMonDead component5 = gameObject2.GetComponent <CheckMonDead>();
                 component5.MonID = brickSeq;
             }
             if (hitState == 0 || hitState == 2)
             {
                 ParentFollow component6 = gameObject2.GetComponent <ParentFollow>();
                 if (component6 != null)
                 {
                     component6.HitParent            = GlobalVars.Instance.hitParent;
                     component6.ParentSeq            = GlobalVars.Instance.hitBirckman;
                     GlobalVars.Instance.hitParent   = null;
                     GlobalVars.Instance.hitBirckman = -1;
                 }
             }
         }
     }
 }