Ejemplo n.º 1
0
    public void PlayDeadMusic(Const.DeadEnum deadType)
    {
        AudioSource source = this.GetComponent <AudioSource>();

        source.clip = cellBugDeadMusic[0];
        source.Play();
    }
Ejemplo n.º 2
0
    //死亡
    public void Dead(Const.DeadEnum deadEnum)
    {
        switch (deadEnum)
        {
        case Const.DeadEnum.KilledEnum:
            gameControl.AlertVision(this, "您被杀死了!");
            break;

        case Const.DeadEnum.PoisonEnum:
            gameControl.AlertVision(this, "您被毒死了!");
            break;

        case Const.DeadEnum.StarveEnum:
            gameControl.AlertVision(this, "您被饿死了!");
            break;

        case Const.DeadEnum.TimeRunOutEnum:
            gameControl.AlertVision(this, "您寿终正寝!");
            break;
        }

        this.GetComponent <CellBugMusic>().PlayDeadMusic(deadEnum);

        GameObject obj  = Instantiate(meatProfabs, new Vector3(transform.position.x, transform.position.y, meatProfabs.transform.position.z), Quaternion.identity) as GameObject;
        Meat       meat = obj.GetComponent <Meat>();

        meat.SetPoison(Const.GeneArray[(int)Const.GenesEnum.PoisonEnum].GetPoison(this));

        if (titleLabel)
        {
            Destroy(titleLabel.gameObject);
        }
        if (bloodSlider)
        {
            Destroy(bloodSlider.gameObject);
        }
        if (flagSprite)
        {
            Destroy(flagSprite.gameObject);
        }

        gameControl.DeleteCellBugAll(this);
        Destroy(this.gameObject, 1.5f);
        this.gameObject.SetActive(false);
    }