コード例 #1
0
ファイル: Player.cs プロジェクト: luoyuntao1/Fun-Runner
    void OnTriggerEnter2D(Collider2D other)
    {
//		if (other.tag == "Obstacle") {
//			Application.LoadLevel (Application.loadedLevel);
//		}
//		transform.position = spawnPoint;

        if (other.gameObject.tag == "Obstacle")
        {
            Debug.Log("collided with " + other.gameObject.name);
            if (shielded > 0)
            {
                shielded--;
                GameObject.Find("Shield").SetActive(false);
            }
            else
            {
                Application.LoadLevel("Death");
            }
        }
        if (other.gameObject.tag == "finish")
        {
            DisplayHighScore.insert_Score();
            Application.LoadLevel("Finish");
        }
    }
コード例 #2
0
    void OnGUI()
    {
        string message = "Highest Score for this level: " + DisplayHighScore.return_highscore();

        message = message + "\n Your current score: " + DisplayHighScore.format(DisplayTime.playtime);
        message = message + "\n Your total amount of coins: " + coinScript.coins;

        GUI.color = Color.black;
        GUI.Label(new Rect(400, 120, 400, 500), message);
    }
コード例 #3
0
ファイル: DisplayHighScore.cs プロジェクト: Rabidus4k/MyGames
    void Start()
    {
        m_instance = this;
        for (int i = 0; i < m_highscoreFieldsText.Length; i++)
        {
            m_highscoreFieldsText[i].text = i + 1 + ". Loading...";
        }

        m_highscoresManager = GetComponent <LeaderBoard>();
        RefreshHighscores();
    }
コード例 #4
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        displayHighScore = GetComponent <DisplayHighScore>();
        Download();
    }
コード例 #5
0
    private void Update()
    {
        countOfPlayers = GameObject.FindGameObjectsWithTag("Player").Length;

        if (countOfPlayers == 0 && PhotonNetwork.IsMasterClient)
        {
            m_restartUI.SetActive(true);
        }



        if (Input.GetKeyDown(KeyCode.Tab))
        {
            DisplayHighScore.RefreshHighscores();
        }

        if (Input.GetKey(KeyCode.Tab))
        {
            m_leaderBoardUI.SetActive(true);
        }
        else
        {
            m_leaderBoardUI.SetActive(false);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!inMenu)
            {
                m_menuUI.SetActive(true);
                inMenu = true;
            }
            else
            {
                m_menuUI.SetActive(false);
                m_settingsUI.SetActive(false);
                m_helpUI.SetActive(false);
                m_leaderBoardUI.SetActive(false);
                inMenu = false;
            }
        }
    }
コード例 #6
0
 private void Awake()
 {
     instance         = this;
     highscoreDisplay = GetComponent <DisplayHighScore>();
 }
コード例 #7
0
 void Awake()
 {
     highScoreDisplay = GetComponent <DisplayHighScore>();
     //instance = this;
 }