コード例 #1
0
    public FloatingScoreGolf CreateFloatingScore(int amt, List <Vector2> pts)
    {
        GameObject go = Instantiate <GameObject>(prefabFloatingScore);

        go.transform.SetParent(canvasTrans);
        FloatingScoreGolf fs = go.GetComponent <FloatingScoreGolf>();

        fs.score          = amt;
        fs.reportFinishTo = this.gameObject;
        fs.Init(pts);
        return(fs);
    }
コード例 #2
0
    void FloatingScoreHandler(eScoreEventGolf evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        case eScoreEventGolf.gameWin:
        case eScoreEventGolf.gameLoss:
            if (fsRun != null)
            {
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = ScoreboardGolf.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;
            }
            break;

        case eScoreEventGolf.putt:
        case eScoreEventGolf.draw:
            FloatingScoreGolf fs;
            Vector2           p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            if (evt == eScoreEventGolf.draw)
            {
                fs = ScoreboardGolf.S.CreateFloatingScore(1, fsPts);
            }
            else
            {
                fs = ScoreboardGolf.S.CreateFloatingScore(-1, fsPts);
            }
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });
            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
    }