void Awake()
        {
            // if the singleton hasn't been initialized yet
            if (instance != null && instance != this)
            {
                Destroy(this.gameObject);
            }

            instance = this;

            if (SaveData.CurrentMatchExists)
            {
                player = new PlayerMatchInstance(SaveData.current.playerSave);
                cpu    = new PlayerMatchInstance(SaveData.current.calendar.GetTournament().currentMatch.cpuPlayer);
            }
            else
            {
                player = new PlayerMatchInstance("JeanPlayer");
                cpu    = new PlayerMatchInstance("EdouardCPU");
            }

            pointHistory = new PointHistory();

            aIBehavior = new EasyAIBehavior(eventReader);
            StartGame();
        }
示例#2
0
        public Point(Score score, PointHistory history)
        {
            shotHistory = new List <HistoryShot>();
            pointOver   = false;
            advantage   = new Advantage();

            //TODO TOSS RIGHT THERE
            if (history.FirstPoint())
            {
                currentPlayerServing = 0;
                Serve serve = ShotMaker.CreateServe(currentPlayerServing, score);
                currentShot = serve;
            }
            else
            {
                currentPlayerServing = history.GetLastPointWinner();
                Serve serve = ShotMaker.CreateServe(currentPlayerServing, score);
                currentShot = serve;
            }
        }