Пример #1
0
        public void Die(Transform tf)
        {
            if (!Alive)
            {
                return;
            }

            Alive = false;
            Destroy(gameObject);

            if (DemoStage.Playing)
            {
                GameObject o = Instantiate <GameObject>(RagDoll.gameObject);
                o.transform.position = transform.position;
                o.transform.rotation = transform.rotation;
                o.transform.Rotate(new Vector3(Random.Range(-20f, 20f), Random.Range(0f, 40f), Random.Range(-20f, 20f)));

                Rigidbody rig = o.GetComponent <Rigidbody>();
                if (rig)
                {
                    rig.AddExplosionForce(10000f, tf.position, 100f);
                }

                Collider[] cs = o.GetComponentsInChildren <Collider>(true);

                for (int i = 0; i < cs.Length; i++)
                {
                    Destroy(cs[i], 5f);
                }

                Destroy(o, 10f);

                int len = Random.Range(28, 40);
                for (int i = 0; i < len; i++)
                {
                    Blood(tf, BloodCube);
                    if (i < len * 0.6f)
                    {
                        Blood(tf, RedBloodCube);
                    }
                }
                DemoStage.CurrentEnemyNum--;
                DemoStage.Main.FreshBar();
                DemoStage.AddKillNum();
                CameraBehaviour.CameraShake();
                DemoStage.PlaySound(1);
                DemoStage.Main.Invoke("PlayDieoutSound", 0.6f);
            }
        }
Пример #2
0
        public void Die(Transform tf)
        {
            if (!Alive)
            {
                return;
            }

            Alive = false;
            Destroy(gameObject);

            if (DemoStage.Playing)
            {
                GameObject o = Instantiate <GameObject>(RagDoll.gameObject);
                o.transform.position = transform.position;
                o.transform.rotation = transform.rotation;
                o.transform.Rotate(new Vector3(Random.Range(-20f, 20f), Random.Range(0f, 40f), Random.Range(-20f, 20f)));

                Rigidbody rig = o.GetComponent <Rigidbody>();
                if (rig)
                {
                    rig.AddExplosionForce(10000f, tf.position, 100f);
                }

                Collider[] cs = o.GetComponentsInChildren <Collider>(true);

                for (int i = 0; i < cs.Length; i++)
                {
                    Destroy(cs[i], 5f);
                }

                Destroy(o, 10f);

                int len = Random.Range(28, 40);
                for (int i = 0; i < len; i++)
                {
                    Blood(tf, BloodCube);
                    if (i < len * 0.6f)
                    {
                        Blood(tf, RedBloodCube);
                    }
                }
                if (DemoStage.Main.bossPlaying && !isBoss)
                {
                    if (DemoStage.Main.IsCorrect(sign))
                    {
                        DemoStage.Main.bossDamageImmune = false;
                    }
                }

//			DemoStage.Main.FreshBar2();

                CameraBehaviour.CameraShake();
                DemoStage.PlaySound(1);
                DemoStage.Main.Invoke("PlayDieoutSound", 0.6f);

                if (isBoss)
                {
                    DemoStage.numOfBoss--;
                }
                else
                {
                    if (DemoStage.Main.IsCorrect(sign))
                    {
                        DemoStage.Main.NextStage();
                    }
                    else
                    {
                        DemoStage.Main.UpdateMsg("Wrong! \n You're Damaged!!");
                        DemoStage.Main.Damage();
                    }
                }

                Destroy(EnemySign.gameObject);
            }
        }