예제 #1
0
 public void credits()
 {
     enemyScript.GetComponent <Enemy>().Reset();
     scoringScript.GetComponent <ScoreSystem>().RefreshScore();
     playerScript.GetComponent <Player>().RespawnPlayer();
     SceneManager.LoadScene(2);
 }
예제 #2
0
 /// <summary>
 /// Loads game HUD UI.
 /// </summary>
 private void LoadHUD()
 {
     scoreSystem.InitialiseScoreSystem(levelData.ConvertToScoreData());
     playerHUD.InitialiseHud(scoreSystem.GetComponent <IScoreEventAssigner>(), levelData, this);
     scoreSystem.IncrementScoreAmount(100);
     scoreSystem.ForceLabelUpdate();
     markerManager = locationManagerObject.GetComponent <IMarkerManager>();
     markerManager.InitialiseMarkerManager();
 }
예제 #3
0
    // Start is called before the first frame update
    void OnCollisionEnter2D(Collision2D collision)
    {
        //Debug.Log("Ouch!");
        if (collision.gameObject.name == "Bullet(Clone)")
        {
            Destroy(collision.gameObject);
            //Debug.Log(gameObject.name);
            if (gameObject.name == "Enemy")
            {
                GetComponent <Animator>().SetTrigger("Death");
                MainEnemy = gameObject;
                scoreScript.GetComponent <ScoreSystem>().addScore("MainEnemy");
                gameObject.SetActive(false);
            }

            else if (gameObject.name == "OrangeEnemy")
            {
                GetComponent <Animator>().SetTrigger("OrangeDeath");
                OrangeEnemy = gameObject;
                scoreScript.GetComponent <ScoreSystem>().addScore("OrangeEnemy");
                gameObject.SetActive(false);
            }

            else if (gameObject.name == "GreenEnemy")
            {
                GetComponent <Animator>().SetTrigger("GreenDeath");
                GreenEnemy = gameObject;
                scoreScript.GetComponent <ScoreSystem>().addScore("GreenEnemy");
                gameObject.SetActive(false);
            }

            else if (gameObject.name == "RedEnemy")
            {
                GetComponent <Animator>().SetTrigger("RedDeath");
                RedEnemy = gameObject;
                scoreScript.GetComponent <ScoreSystem>().addScore("RedEnemy");
                gameObject.SetActive(false);
            }
            //Debug.Log("Ouch!");
            //Debug.Log(EnemyCount);
        }
    }
예제 #4
0
    public void RpcUpdateScore(int nRight, int nLeft)
    {
        ScoreSystem scoreSys = FindObjectOfType <ScoreSystem>();
        Text        txtScore = scoreSys.GetComponent <Text>();

        if (txtScore != null)
        {
            string str = "";
            str           = string.Format("{0}:{1}", nRight, nLeft);
            txtScore.text = str;
        }
    }