コード例 #1
0
    void AddToTail(GameObject player)
    {
        var        obj = Pool.FromPool();
        GameObject frontObj;

        if (TailObjects.Count == 0)
        {
            frontObj = player;
            obj.GetComponent <TailScript>().FollowDistance = PlayerFollowDistance;
            obj.transform.position = frontObj.transform.position - frontObj.transform.forward * 5;
        }
        else
        {
            frontObj = TailObjects[TailObjects.Count - 1];
            obj.GetComponent <TailScript>().FollowDistance = TailFollowDistance;
            obj.transform.position = frontObj.transform.position;
        }
        TailObjects.Add(obj);
        obj.GetComponent <TailScript>().target = frontObj;
    }
コード例 #2
0
    private void RefreshHighScoreList()
    {
        HighScores = ScoreManager.HighScores;
        if (HighScores.Count > 1)
        {
            HighScores.Sort((hs1, hs2) => hs1.Value.CompareTo(hs2.Value));
        }
        foreach (var obj in ScoreObjects)
        {
            Pool.ReturnToPool(obj);
        }
        ScoreObjects.Clear();

        foreach (var score in HighScores)
        {
            var obj = Pool.FromPool();
            obj.transform.SetParent(ScoreParent);
            var ScoreObj = obj.GetComponent <HighScoreScript>();
            ScoreObj.InitScore(score);
            ScoreObjects.Add(obj);
        }
    }