Example #1
0
    void SendPoint(int id, string name, int score)
    {
        ScorePoint point1 = new ScorePoint(id, name, score);

        pointList.Add(point1);
        result_num++;
    }
        public CompetitorTemplate(string filePath,
                                  CompetitorPoint competitor1,
                                  CompetitorPoint competitor2,
                                  ScorePoint score1, ScorePoint score2,
                                  TournamentPoint tournamentNameRound)
            : base(filePath)
        {
            if (competitor1 == null)
            {
                throw new Exception("Competitor Template: Competitor 1 must have a point on template");
            }
            if (competitor2 == null)
            {
                throw new Exception("Competitor Template: Competitor 2 must have a point on template");
            }
            if (score1 == null)
            {
                throw new Exception("Competitor Template: Score 1 must have a point on template");
            }
            if (score2 == null)
            {
                throw new Exception("Competitor Template: Score 2 must have a point on template");
            }
            if (tournamentNameRound == null)
            {
                throw new Exception("Competitor Template: Tournament Name must have a point on template");
            }

            this.competitor1Point         = competitor1;
            this.competitor2Point         = competitor2;
            this.score1Point              = score1;
            this.score2Point              = score2;
            this.tournamentNameRoundPoint = tournamentNameRound;
        }
        public CompetitorTemplate(string filePath,
                                  CompetitorPoint competitor1,
                                  CompetitorPoint competitor2,
                                  CompetitorPoint competitor1Webcam,
                                  CompetitorPoint competitor2Webcam,
                                  ScorePoint score1, ScorePoint score2,
                                  RoundPoint round,
                                  TournamentPoint tournamentNameRound,
                                  DatePoint datePoint)
            : base(filePath)
        {
            if (competitor1 == null)
            {
                throw new Exception("Competitor Template: Competitor 1 must have a point on template");
            }
            if (competitor2 == null)
            {
                throw new Exception("Competitor Template: Competitor 2 must have a point on template");
            }
            if (competitor1Webcam == null)
            {
                throw new Exception("Competitor Template: Competitor 1's Webcam must have a point on template");
            }
            if (competitor2Webcam == null)
            {
                throw new Exception("Competitor Template: Competitor 2's Webcam must have a point on template");
            }
            if (score1 == null)
            {
                throw new Exception("Competitor Template: Score 1 must have a point on template");
            }
            if (score2 == null)
            {
                throw new Exception("Competitor Template: Score 2 must have a point on template");
            }
            if (round == null)
            {
                throw new Exception("Competitor Template: Round must have a point on template");
            }
            if (tournamentNameRound == null)
            {
                throw new Exception("Competitor Template: Tournament Name must have a point on template");
            }
            if (datePoint == null)
            {
                throw new Exception("Competitor Template: Date must have a point on template");
            }

            this.competitor1Point         = competitor1;
            this.competitor2Point         = competitor2;
            this.competitor1WebcamPoint   = competitor1Webcam;
            this.competitor2WebcamPoint   = competitor2Webcam;
            this.score1Point              = score1;
            this.score2Point              = score2;
            this.roundPoint               = round;
            this.tournamentNameRoundPoint = tournamentNameRound;
            this.datePoint = datePoint;
        }
Example #4
0
    // Construction
    private void Awake()
    {
        // TODO: Implement speed difficulty level switch
        speed = 5f;

        ballRB = GetComponent <Rigidbody>();

        scorePoint = GetComponent <ScorePoint>();
    }
Example #5
0
        public static CompetitorTemplate GetCompTemplate(string fileName)
        {
            string qry =
                "SELECT * FROM tbl_CompetitorTemplates WHERE FileName = '" + fileName + "';";
            SQLiteCommand cmd = new SQLiteCommand(qry, conn);

            try
            {
                DBOpen();
                SQLiteDataReader cur = cmd.ExecuteReader();
                while (cur.Read())
                {
                    string name  = cur.GetString(0);
                    int    tpx   = cur.GetInt32(1);
                    int    tpy   = cur.GetInt32(2);
                    int    rpx   = cur.GetInt32(3);
                    int    rpy   = cur.GetInt32(4);
                    int    p1px  = cur.GetInt32(5);
                    int    p1py  = cur.GetInt32(6);
                    int    p2px  = cur.GetInt32(7);
                    int    p2py  = cur.GetInt32(8);
                    int    p1cpx = cur.GetInt32(9);
                    int    p1cpy = cur.GetInt32(10);
                    int    p2cpx = cur.GetInt32(11);
                    int    p2cpy = cur.GetInt32(12);
                    int    p1spx = cur.GetInt32(13);
                    int    p1spy = cur.GetInt32(14);
                    int    p2spx = cur.GetInt32(15);
                    int    p2spy = cur.GetInt32(16);
                    int    dpx   = cur.GetInt32(17);
                    int    dpy   = cur.GetInt32(18);
                    string opt   = cur.GetString(19).Replace("\n", "");

                    CompetitorPoint player1pt    = new CompetitorPoint(p1px, p1py);
                    CompetitorPoint player2pt    = new CompetitorPoint(p2px, p2py);
                    CompetitorPoint player1CamPt = new CompetitorPoint(p1cpx, p1cpy);
                    CompetitorPoint player2CamPt = new CompetitorPoint(p2cpx, p2cpy);
                    ScorePoint      score1pt     = new ScorePoint(p1spx, p1spy);
                    ScorePoint      score2pt     = new ScorePoint(p2spx, p2spy);
                    RoundPoint      roundpt      = new RoundPoint(rpx, rpy);
                    TournamentPoint tourneypt    = new TournamentPoint(tpx, tpy);
                    DatePoint       datePoint    = new DatePoint(dpx, dpy);

                    DBClose();
                    return(new CompetitorTemplate(name, player1pt, player2pt, player1CamPt, player2CamPt, score1pt, score2pt, roundpt, tourneypt, datePoint, opt));
                }
                return(null);
            }
            catch (Exception ex)
            {
                DBClose();
                return(null);
            }
        }
        public void AddPointToReceiver()
        {
            var newScore = GetNewScore(ReceiverScore, ServerScore);

            ReceiverScore = newScore;

            if (newScore == ScorePoint.Deuce)
            {
                ServerScore = ScorePoint.Deuce;
            }

            if (newScore == ScorePoint.Advantage)
            {
                ServerScore = ScorePoint.Disadvantage;
            }
        }
        private void LookAhead()
        {
            RaycastHit2D[] hits = Physics2D.CircleCastAll(transform.position, diameter / 2, Vector2.up, distance, mask);

            CheckForCollectables(hits);

            RaycastHit2D barHit = CheckForBars(hits);

            if (barHit.collider == null)
            {
                hitBar = false;
                ScorePoint?.Invoke();
            }
            else
            {
                hitBar = true;
                LookAheadCollision?.Invoke(barHit);
            }
        }
        private ScorePoint GetNewScore(ScorePoint scoreIncreasing, ScorePoint otherScore)
        {
            if (scoreIncreasing == ScorePoint.Game || scoreIncreasing == ScorePoint.Game)
            {
                return(ScorePoint.Game);
            }

            if (scoreIncreasing > ScorePoint.Thirty)
            {
                if (scoreIncreasing == ScorePoint.Deuce)
                {
                    return(ScorePoint.Advantage);
                }

                if (otherScore < scoreIncreasing)
                {
                    return(ScorePoint.Game);
                }

                return(ScorePoint.Deuce);
            }

            return(scoreIncreasing + 1);
        }
Example #9
0
 private void Awake()
 {
     scorePoint = this; //Singleton
 }
 private void Awake()
 {
     playerScore = new ScorePoint();
 }
Example #11
0
    void Start()
    {
        Debug.Log("currentLevel " + ApplicationModel.currentLevel);
        InputController.instance.SetTimeToReachMax(time_to_reach_max);
        leaderboard = new Leaderboard();
        //Leaderboard.instance.Init(ApplicationModel.currentLevel);
        leaderboard.Init(ApplicationModel.currentLevel);
        if (gameConfiguration != null)
        {
            if (scorePointsParent)
            {
                foreach (Transform xform in scorePointsParent)
                {
                    Destroy(xform.gameObject);
                }

                List <ScorePointItem> list = gameConfiguration.scorePointList;
                foreach (ScorePointItem item in list)
                {
                    ScorePoint point = null;
                    switch (item.type)
                    {
                    case ScorePointType.TYPE_O:
                    {
                        if (scorePointOPrefab)
                        {
                            point = GameObject.Instantiate(scorePointOPrefab, new Vector3(item.x, item.y, item.z), Quaternion.identity) as ScorePoint;
                        }
                        break;
                    }

                    case ScorePointType.TYPE_BIG_O:
                    {
                        if (scorePointBigOPrefab)
                        {
                            point = GameObject.Instantiate(scorePointBigOPrefab, new Vector3(item.x, item.y, item.z), Quaternion.identity) as ScorePoint;
                        }
                        break;
                    }

                    case ScorePointType.TYPE_U:
                    {
                        if (scorePointUPrefab)
                        {
                            point = GameObject.Instantiate(scorePointUPrefab, new Vector3(item.x, item.y, item.z), Quaternion.Euler(90, 0, 0)) as ScorePoint;
                        }
                        break;
                    }

                    default:
                    {
                        if (scorePointOPrefab)
                        {
                            point = GameObject.Instantiate(scorePointOPrefab, new Vector3(item.x, item.y, item.z), Quaternion.identity) as ScorePoint;
                        }
                        break;
                    }
                    }
                    if (point)
                    {
                        point.transform.SetParent(scorePointsParent, false);
                        point.SetScore(item.score);
                    }
                }
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     spn = GameObject.FindGameObjectWithTag("Bin").GetComponent <SpawnBall>();
     scr = GameObject.FindGameObjectWithTag("Hit").GetComponent <ScorePoint>();
 }