Esempio n. 1
0
        public static void ragdollZombie(Vector3 point, Quaternion rotation, Transform skeleton, Vector3 ragdoll, byte type, byte shirt, byte pants, byte hat, byte gear, bool isMega)
        {
            if (!GraphicsSettings.ragdolls)
            {
                return;
            }
            ragdoll.y += 8f;
            ragdoll.x += Random.Range(-16f, 16f);
            ragdoll.z += Random.Range(-16f, 16f);
            ragdoll   *= (float)((!(Player.player != null) || Player.player.skills.boost != EPlayerBoost.FLIGHT) ? 32 : 256);
            Transform transform = ((GameObject)Object.Instantiate(Resources.Load("Characters/Ragdoll_Zombie"), point + Vector3.up * 0.1f, rotation * Quaternion.Euler(90f, 0f, 0f))).transform;

            transform.name   = "Ragdoll";
            transform.parent = Level.effects;
            if (isMega)
            {
                transform.localScale = Vector3.one * 1.5f;
            }
            else
            {
                transform.localScale = Vector3.one;
            }
            if (skeleton != null)
            {
                RagdollTool.applySkeleton(skeleton, transform.FindChild("Skeleton"));
            }
            transform.FindChild("Skeleton").FindChild("Spine").GetComponent <Rigidbody>().AddForce(ragdoll);
            Object.Destroy(transform.gameObject, GraphicsSettings.effect);
            Transform transform2;
            Transform transform3;

            ZombieClothing.apply(transform, isMega, null, transform.FindChild("Model_1").GetComponent <SkinnedMeshRenderer>(), type, shirt, pants, hat, gear, out transform2, out transform3);
        }
Esempio n. 2
0
        public static void build()
        {
            if (ZombieClothing.ghostMaterial == null)
            {
                ZombieClothing.ghostMaterial = (Material)Resources.Load("Characters/Ghost");
            }
            if (ZombieClothing.megaMesh_0 == null)
            {
                ZombieClothing.megaMesh_0 = ((GameObject)Resources.Load("Characters/Mega_0")).GetComponent <MeshFilter>().sharedMesh;
            }
            if (ZombieClothing.megaMesh_1 == null)
            {
                ZombieClothing.megaMesh_1 = ((GameObject)Resources.Load("Characters/Mega_1")).GetComponent <MeshFilter>().sharedMesh;
            }
            if (ZombieClothing.zombieMesh_0 == null)
            {
                ZombieClothing.zombieMesh_0 = ((GameObject)Resources.Load("Characters/Zombie_0")).GetComponent <MeshFilter>().sharedMesh;
            }
            if (ZombieClothing.zombieMesh_1 == null)
            {
                ZombieClothing.zombieMesh_1 = ((GameObject)Resources.Load("Characters/Zombie_1")).GetComponent <MeshFilter>().sharedMesh;
            }
            if (ZombieClothing.megaTexture == null)
            {
                ZombieClothing.megaTexture = (Texture2D)Resources.Load("Characters/Mega");
            }
            if (ZombieClothing.zombieTexture == null)
            {
                ZombieClothing.zombieTexture = (Texture2D)Resources.Load("Characters/Zombie");
            }
            if (ZombieClothing.shader == null)
            {
                ZombieClothing.shader = Shader.Find("Standard");
            }
            if (ZombieClothing.clothes != null)
            {
                for (int i = 0; i < ZombieClothing.clothes.GetLength(0); i++)
                {
                    for (int j = 0; j < ZombieClothing.clothes[i].GetLength(0); j++)
                    {
                        for (int k = 0; k < ZombieClothing.clothes[i].GetLength(1); k++)
                        {
                            if (ZombieClothing.clothes[i][j, k] != null)
                            {
                                Object.DestroyImmediate(ZombieClothing.clothes[i][j, k].mainTexture);
                                Object.DestroyImmediate(ZombieClothing.clothes[i][j, k]);
                                ZombieClothing.clothes[i][j, k] = null;
                            }
                        }
                    }
                }
            }
            if (LevelZombies.tables == null)
            {
                ZombieClothing.clothes = null;
                return;
            }
            ZombieClothing.clothes = new Material[LevelZombies.tables.Count][, ];
            byte b = 0;

            while ((int)b < LevelZombies.tables.Count)
            {
                ZombieTable zombieTable = LevelZombies.tables[(int)b];
                ZombieClothing.clothes[(int)b] = new Material[zombieTable.slots[0].table.Count + 1, zombieTable.slots[1].table.Count + 1];
                byte b2 = 0;
                while ((int)b2 < zombieTable.slots[0].table.Count + 1)
                {
                    ushort shirt = 0;
                    if ((int)b2 < zombieTable.slots[0].table.Count)
                    {
                        shirt = zombieTable.slots[0].table[(int)b2].item;
                    }
                    byte b3 = 0;
                    while ((int)b3 < zombieTable.slots[1].table.Count + 1)
                    {
                        ushort pants = 0;
                        if ((int)b3 < zombieTable.slots[1].table.Count)
                        {
                            pants = zombieTable.slots[1].table[(int)b3].item;
                        }
                        ZombieClothing.clothes[(int)b][(int)b2, (int)b3] = ZombieClothing.paint(shirt, pants, zombieTable.isMega);
                        b3 += 1;
                    }
                    b2 += 1;
                }
                b += 1;
            }
        }