コード例 #1
0
    // Despawnt den Gegner und Spawnt den Punktetext
    public void DestroyEnemy()
    {
        if (health == 0)
        {
            pointsText = Instantiate(Resources.Load("Punkte-Text"),
                                     gameObject.transform.position,
                                     Quaternion.identity) as GameObject;
            pointsText.AddComponent <UIPoints>();

            uicontroller.AddToScore(30);
            pointsText.GetComponent <UIPoints>().Points(30, gameObject.transform.position);

            GameObject.Find("Player").GetComponent <AudioFX>().duck.Play();

            ors.DeleteEnemy(gameObject);
            Destroy(gameObject);
        }
    }
コード例 #2
0
ファイル: Movement.cs プロジェクト: samy2509/gdv-tapbox
    // Despawnt den Gegner und Spawnt den Punktetext
    public void DestroyEnemy()
    {
        if (health == 0)
        {
            pointsText = Instantiate(Resources.Load("Punkte-Text"),
                                     gameObject.transform.position,
                                     Quaternion.identity) as GameObject;
            pointsText.AddComponent <UIPoints>();

            if (gameObject.tag != "Boss")
            {
                uicontroller.AddToScore(10);
                pointsText.GetComponent <UIPoints>().Points(10, gameObject.transform.position);
            }
            else
            {
                uicontroller.AddToScore(100);
                pointsText.GetComponent <UIPoints>().Points(100, gameObject.transform.position);
            }

            if (gameObject.name == "Cow(Clone)")
            {
                GameObject.Find("Player").GetComponent <AudioFX>().cow.Play();
            }
            else if (gameObject.name == "Sheep(Clone)")
            {
                GameObject.Find("Player").GetComponent <AudioFX>().sheep.Play();
            }
            else if (gameObject.name == "Cow large(Clone)")
            {
                GameObject.Find("Player").GetComponent <AudioFX>().megaCow.Play();
            }

            ors.DeleteEnemy(gameObject);
            Destroy(gameObject);
        }
    }
コード例 #3
0
    // Despawnt den Gegner und Spawnt den Punktetext
    public void DestroyEnemy()
    {
        if (health == 0)
        {
            pointsText = Instantiate(Resources.Load("Punkte-Text"),
                                     gameObject.transform.position,
                                     Quaternion.identity) as GameObject;
            pointsText.AddComponent <UIPoints>();

            if (gameObject.tag != "Boss")
            {
                uicontroller.AddToScore(10);
                pointsText.GetComponent <UIPoints>().Points(10, gameObject.transform.position);
            }
            else
            {
                uicontroller.AddToScore(100);
                pointsText.GetComponent <UIPoints>().Points(100, gameObject.transform.position);
            }

            ors.DeleteEnemy(gameObject);
            Destroy(gameObject);
        }
    }