Exemple #1
0
        public void Test_GetBestScoreByFamily_Duplicates()
        {
            var firstResult = new TestResults()
            {
                Id = "Sabin", FamilyId = "I", Score = 10
            };
            var secondResult = new TestResults()
            {
                Id = "Andra", FamilyId = "P", Score = 3
            };
            var thirdResult = new TestResults()
            {
                Id = "Sabin", FamilyId = "I", Score = 10
            };
            var lastResult = new TestResults()
            {
                Id = "Andra", FamilyId = "P", Score = 3
            };


            var list = new List <TestResults> {
                firstResult, secondResult, thirdResult, lastResult
            };

            var resultList   = new BestScore(list);
            var filteredList = resultList.GetBestScoreByFamily();


            Assert.Equal(new[] { firstResult, secondResult }, filteredList);
        }
Exemple #2
0
 private void Awake()
 {
     instance              = this;
     bestScore             = PlayerPrefs.GetInt("movesLevel" + SceneManager.GetActiveScene().buildIndex, 0);
     bestScoreMessage      = gameObject.GetComponent <TextMeshProUGUI>();
     bestScoreMessage.text = "Best: " + (bestScore == 0?"-": Convert.ToString(bestScore));
 }
        public BestScore UnloadBestScore(int currentLevel)
        {
            var userName      = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            var sqlExpression =
                $"SELECT * FROM BestScoresTable WHERE Level = {currentLevel} AND UserName = '******'";
            var con   = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            var score = new BestScore();

            using (var connection = new SqlConnection(con))
            {
                connection.Open();
                var command = new SqlCommand(sqlExpression, connection);
                var reader  = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        score.Id       = reader.GetInt32(0);
                        score.UserName = reader.GetString(1);
                        score.Level    = reader.GetInt32(2);
                        score.Score    = reader.GetInt32(3);
                    }
                }

                reader.Close();
            }

            return(score);
        }
Exemple #4
0
        public string Normalized(StringUtilities.StringConverter wordconv)
        {
            if (IsTerminal)
            {
                return(wordconv(name));
            }

            // choose max-probability sense
            BestScore <PhraseSense> strongest = new BestScore <PhraseSense>();

            foreach (KeyValuePair <PhraseSense, double> sense in senses)
            {
                strongest.Improve(sense.Value, sense.Key);
            }

            StringBuilder result = new StringBuilder();

            foreach (InformedPhrase subphr in strongest.Payload.Phrases)
            {
                string normal = subphr.Normalized(wordconv);
                if (normal == "")
                {
                    continue;   // skip it
                }
                if (result.Length > 0)
                {
                    result.Append(" ");
                }
                result.Append(normal);
            }

            return(result.ToString());
        }
Exemple #5
0
    // Use this for initialization
    void Start()
    {
        Defs.AudioSourceMusic = GetComponent <AudioSource> ();
        _screenAnimation      = screenAnimationObject.GetComponent <ScreenColorAnimation> ();
        _points    = GetComponent <Points> ();
        _coins     = GetComponent <Coins> ();
        _bestScore = GetComponent <BestScore> ();
//		_poinsBmScript = GetComponent<PointsBubbleManager> ();

        _state = 0;

        /*hintCounter = PlayerPrefs.GetInt ("hintCounter", 3);
         * if (hintCounter >= 3) {
         *      isHint = true;
         *      hint = (GameObject)Instantiate (hintPerefab, new Vector3(0.3f, -1.0f,1), Quaternion.identity);
         *      hintSprite = hint.GetComponent<SpriteRenderer>();
         *
         *      hint.SetActive (true);
         * } */

        _sndLose       = Resources.Load <AudioClip>("snd/fail");
        _sndShowScreen = Resources.Load <AudioClip>("snd/showScreen");
        _sndGrab       = Resources.Load <AudioClip>("snd/grab");
        _sndClose      = Resources.Load <AudioClip>("snd/button");
    }
Exemple #6
0
        static void Main(string[] args)
        {
            //eff mijn hersenen en mijn faalangst. oke// let's REDO this.

            //event 1:
            SportEvent event1 = new SportEvent("idk");

            event1.AddStudents(new Student("Raiden")); //en we hebben opeens een metal gear thema
            event1.AddStudents(new Student("Kazuhira"));
            event1.AddStudents(new Student("Adamska"));
            event1.AddStudents(new Student("Venom"));
            event1.AddStudents(new Student("DD")); //best boi

            event1.AddSRecord("Raiden", 32.1);
            event1.AddSRecord("Kazuhira", 20.2);
            event1.AddSRecord("Adamska", 15.3);
            event1.AddSRecord("Venom", 29.4);
            event1.AddSRecord("DD", 11.5);

            Console.WriteLine("Records for: " + event1.EventName);
            Console.WriteLine(event1.toString());

            //event 2:

            SportEvent event2 = new SportEvent("idk");

            event2.AddStudents(new Student("Raiden"));
            event2.AddStudents(new Student("Kazuhira"));
            event2.AddStudents(new Student("Adamska"));
            event2.AddStudents(new Student("Venom"));
            event2.AddStudents(new Student("DD")); //still best boi

            event2.AddSRecord("Raiden", 16.1);
            event2.AddSRecord("Kazuhira", 32.2);
            event2.AddSRecord("Adamska", 64.3);
            event2.AddSRecord("Venom", 128.4);
            event2.AddSRecord("DD", 256.5);

            Console.WriteLine("Records for: " + event2.EventName);
            Console.WriteLine(event2.toString());

            BestScore a = new BestScore();

            a.Compare(event1);
            a.Compare(event2);

            Console.WriteLine(a.toString());

            Console.ReadKey();

            /*Student s1 = new Student("Raiden"); //test
             * //Student s2 = new Student("Hal"); //test
             *
             * Console.WriteLine(s1.toString()); //test
             * Console.WriteLine(s2.toString()); //test
             *
             * //SportEvent event1 = new SportEvent("reee");
             * //Console.WriteLine(event1);*/
        }
Exemple #7
0
    public void SaveBestScore(BestScore bestScoreData)
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/bestScore.dat");

        bf.Serialize(file, bestScoreData);
        file.Close();
    }
 /// <summary>
 /// To the model.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns>the model</returns>
 public static BestScoreModel ToModel(this BestScore entity)
 {
     return(new BestScoreModel
     {
         GameCreationDate = entity.GameCreationDate,
         GroupType = entity.GroupType,
         Points = entity.Points,
         Time = entity.Time,
         User = entity.User.ToModel()
     });
 }
 void Start()
 {
     _winNum     = PlayerPrefs.GetInt("winNum", 5) - 1;
     _winName    = PlayerPrefs.GetString("winName", "Draw");
     _winChar    = PlayerPrefs.GetInt(_winName, 6);
     _winScore   = PlayerPrefs.GetInt("score", 0);
     _bs         = Load(BestScore.FilePath);
     _dailyScore = _bs.deily;
     _bestScore  = _bs.bestScore;
     StartCoroutine(ResultView());
 }
Exemple #10
0
 public BestScore LoadBestScore()
 {
     if (File.Exists(Application.persistentDataPath + "/bestScore.dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/bestScore.dat", FileMode.Open);
         BestScore       data = (BestScore)bf.Deserialize(file);
         file.Close();
         return(data);
     }
     return(null);
 }
Exemple #11
0
 // Update is called once per frame
 void Update()
 {
     SiapSharing();
     time++;
     if (time > 160 && score < Manager.Instance.MyScore && time % 5 == 0)
     {
         score++;
         SoundManager.Instance.PlaySoundCoin();
         myFont.SetString(" : " + score + "");
     }
     BestScore.SetString(" : " + PlayerPrefs.GetInt("score") + "");
 }
Exemple #12
0
    public void GetScore(int score)
    {
        NowScore += score;
        if (NowScore > BestScore)
        {
            BestScore = NowScore;
        }

        nowScore.text       = NowScore.ToString();
        bestScore.text      = BestScore.ToString();
        nowScoreClear.text  = NowScore.ToString();
        bestScoreClear.text = BestScore.ToString();
    }
Exemple #13
0
        protected override void OnInit()
        {
            var storage = this.GetUtility <IStorage>();

            BestScore.Value = storage.LoadInt(nameof(BestScore), 0);
            BestScore.Register(v => storage.SaveInt(nameof(BestScore), v));

            Life.Value = storage.LoadInt(nameof(Life), 3);
            Life.Register(v => storage.SaveInt(nameof(Life), v));

            Gold.Value = storage.LoadInt(nameof(Gold), 0);
            Gold.Register((v) => storage.SaveInt(nameof(Gold), v));
        }
    public void saveBestGame()
    {
        float best = timer;

        if (MyNetworkManager.instance.isMultiplayer)
        {
            BestScore.saveScore("multi", best);
        }
        else
        {
            BestScore.saveScore("single", best);
        }
    }
Exemple #15
0
    public void SetScore(int level, Text best, Text now, Text bestClear, Text nowClear)
    {
        levelNow       = level;
        bestScore      = best;
        nowScore       = now;
        bestScoreClear = bestClear;
        nowScoreClear  = nowClear;

        BestScore      = PlayerPrefs.GetInt("Level" + levelNow.ToString(), 0);
        NowScore       = 0;
        nowScore.text  = NowScore.ToString();
        bestScore.text = BestScore.ToString();
    }
Exemple #16
0
 public void RunSimulation()
 {
     for (int i = 0; i < 2000; i++)
     {
         int currentCol = -1;
         simMax = (int[])baseMax.Clone();
         simMap = baseMap.Select(a => a.ToArray()).ToArray();
         int        seed = i;
         List <int> last = new List <int>();
         foreach (Color c in colors)
         {
             Random rnd = new Random(seed++);
             int    col = rnd.Next(0, 5);
             int    j   = 0;
             if (PushPiece(c, col) == 0)
             {
                 PushPiece(c, 0);
             }
             if (currentCol == -1)
             {
                 currentCol = col;
             }
             else
             {
                 last.Add(col);
             }
         }
         //PrintMap(simMap);
         BestScore bs    = new BestScore(simMap, simMax);
         int       score = bs.score;
         //Console.Error.WriteLine("bestScore {0}", score);
         if (score > finalScore)
         {
             bestCol    = currentCol;
             finalScore = score;
             lastSim    = last;
             //PrintMap(simMap);
             lastMap = simMap.Select(a => a.ToArray()).ToArray();
         }
         //PrintMap(simMap);
     }
     //if (finalScore > 0)
     //    Console.Error.WriteLine("bestScore {0}", finalScore);
     //PrintMap(lastMap);
     //Console.Error.WriteLine(i + 1);
     //Console.Error.WriteLine("__ {0}", lastSim.First());
 }
Exemple #17
0
    // Varsa şifrelenip kayıt edilen kullanıcı bilgilerini deşifre edip atama yapan, yoksa bu bilgileri ilk oyun halinde atayan fonksiyon
    public static BestScore LoadPlayer()
    {
        string path = Path.Combine(Application.persistentDataPath, "score.fun");

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);
            BestScore       data      = formatter.Deserialize(stream) as BestScore;
            Debug.Log(path);
            stream.Close();
            PlayerPrefs.SetInt("Money", data.diamondCount);
            PlayerPrefs.SetFloat("BestScore", data.bestScore);
            PlayerPrefs.SetInt("PlayerIndex", data.planeIndex);
            PlayerPrefs.SetInt("StageCleared", data.stageCleared);
            PlayerPrefs.SetString("StageStars", data.stageStars);

            if (data.planeBought == null)
            {
                Debug.Log("PlaneBought null ");
                PlayerPrefs.SetString("PlaneBought", "1000000000000");
            }
            else
            {
                PlayerPrefs.SetString("PlaneBought", data.planeBought);
                Debug.Log("PlaneBought: " + PlayerPrefs.GetString("PlaneBought"));
            }
            if (PlayerPrefs.GetInt("StageCleared") < 1)
            {
                PlayerPrefs.SetInt("StageCleared", 1);
            }

            return(data);
        }
        else
        {
            PlayerPrefs.SetFloat("BestScore", 0f);
            PlayerPrefs.SetInt("Money", 0);
            PlayerPrefs.SetInt("PlayerIndex", 0);
            PlayerPrefs.SetInt("StageCleared", 1);
            PlayerPrefs.SetString("PlaneBought", "1000000000000");
            PlayerPrefs.SetString("StageStars", "000000000000000");
            Debug.LogError("Save file not found in " + path);

            return(null);
        }
    }
Exemple #18
0
    // BestScore adlı sınıfımızdaki bilgileri(Kullanıcı bilgileri) bir dosyaya şifreleyip kayıt eden fonksiyon
    public static bool SavePlayer()
    {
        if (PlayerPrefs.GetString("PlaneBought") == "")
        {
            return(false);
        }
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Path.Combine(Application.persistentDataPath, "score.fun");
        FileStream      stream    = new FileStream(path, FileMode.Create);

        BestScore data = new BestScore(PlayerPrefs.GetFloat("BestScore"), PlayerPrefs.GetInt("Money"), PlayerPrefs.GetInt("PlayerIndex"), PlayerPrefs.GetString("PlaneBought"), PlayerPrefs.GetInt("StageCleared"), PlayerPrefs.GetString("StageStars"));

        formatter.Serialize(stream, data);
        stream.Close();

        Debug.Log("Save Listesi\n------------\nBest Score: " + PlayerPrefs.GetFloat("BestScore") + "\nMoney: " + PlayerPrefs.GetInt("Money") + "\nPlane Index: " + PlayerPrefs.GetInt("PlayerIndex") + "\nPlane Bought: " + PlayerPrefs.GetString("PlaneBought") + "\nStage Cleared: " + PlayerPrefs.GetInt("StageCleared") + "\nStage Stars: " + PlayerPrefs.GetString("StageStars"));
        return(true);
    }
 BestScore Load(string path)
 {
     if (!File.Exists(path))
     {
         Debug.Log("kitenai");
         return(new BestScore());
     }
     using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) {
         using (StreamReader sr = new StreamReader(fs)) {
             BestScore b = JsonUtility.FromJson <BestScore>(sr.ReadToEnd());
             if (b == null)
             {
                 return(new BestScore());
             }
             return(b);
         }
     }
 }
        public void LoadBestScore(BestScore score)
        {
            var sql = $"SELECT * FROM BestScoresTable WHERE UserName='******' AND Level={score.Level}";
            var con = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            using (var connection = new SqlConnection(con))
            {
                connection.Open();
                var adapter = new SqlDataAdapter(sql, connection);
                var ds      = new DataSet();
                adapter.Fill(ds);

                var dt          = ds.Tables[0];
                var customerRow = ds.Tables[0].Select($" UserName='******' AND Level={score.Level}");
                if (customerRow.Length > 0)
                {
                    if ((int)customerRow[0]["Score"] < score.Score)
                    {
                        customerRow[0]["Score"] = score.Score;
                    }
                }
                else
                {
                    var newRow = dt.NewRow();
                    newRow["UserName"] = score.UserName;
                    newRow["Level"]    = score.Level;
                    newRow["Score"]    = score.Score;
                    dt.Rows.Add(newRow);
                }

                try
                {
                    var cb = new SqlCommandBuilder(adapter);
                    adapter.UpdateCommand = cb.GetUpdateCommand();
                    adapter.Update(ds);
                }
                catch (SqlException)
                {
                    MessageBox.Show(Constants.ConnectionErrorMessage);
                }

                ds.Clear();
            }
        }
    void OnEnable()
    {
        this.transform.Find("NewBestScore").gameObject.SetActive(false);
        this.transform.Find("BestScoreArea").gameObject.SetActive(false);
        GameScript gameScript = (GameScript)GameObject.Find("Information").gameObject.GetComponent(typeof(GameScript));

        float time          = gameScript.getTime();
        int   map           = gameScript.getMap();
        int   maxMap        = gameScript.getMaxMap();
        float penalityTotal = (maxMap - map) * penality;
        float finalTime     = time + penalityTotal;

        this.transform.Find("TextTime").gameObject.GetComponent <Text>().text      = time.ToString("0.00");
        this.transform.Find("TextMap").gameObject.GetComponent <Text>().text       = map + "/" + maxMap;
        this.transform.Find("TextPenality").gameObject.GetComponent <Text>().text  = penalityTotal.ToString("0.00");
        this.transform.Find("TextFinalTime").gameObject.GetComponent <Text>().text = finalTime.ToString("0.00");

        //string filePath = Application.dataPath + saveFile + SceneManager.GetActiveScene().name;
        string filePath = SceneManager.GetActiveScene().name;

        if (File.Exists(filePath))
        {
            string dataAsJson = File.ReadAllText(filePath);
            bestScore = BestScore.CreateFromJSON(dataAsJson);
            if (bestScore.time < finalTime)
            {
                GameObject bestscoreGO = this.transform.Find("BestScoreArea").gameObject;
                bestscoreGO.SetActive(true);
                bestscoreGO.transform.Find("TextName").gameObject.GetComponent <Text>().text     = bestScore.namePlayer;
                bestscoreGO.transform.Find("TextBestTime").gameObject.GetComponent <Text>().text = bestScore.time.ToString("0.00");
            }
            else
            {
                bestScore.time = finalTime;
                this.transform.Find("NewBestScore").gameObject.SetActive(true);
            }
        }
        else
        {
            bestScore      = new BestScore();
            bestScore.time = finalTime;
            this.transform.Find("NewBestScore").gameObject.SetActive(true);
        }
    }
    // Use this for initialization
    void Start()
    {
        float[]         multiScores  = BestScore.loadScore("multi");
        float[]         singleScores = BestScore.loadScore("single");
        System.TimeSpan t;

        for (int i = 0; i < 5; i++)
        {
            t = System.TimeSpan.FromSeconds(singleScores[i]);
            if (singleScores[i] > 3600)
            {
                singlePlayerScore[i].text = string.Format("{0:D2}h:{1:D2}:{2:D2}:{3:D2}",
                                                          t.Hours,
                                                          t.Minutes,
                                                          t.Seconds,
                                                          t.Milliseconds);
            }
            else
            {
                singlePlayerScore[i].text = string.Format("{0:D2}:{1:D2}:{2:D2}",
                                                          t.Minutes,
                                                          t.Seconds,
                                                          t.Milliseconds);
            }

            t = System.TimeSpan.FromSeconds(multiScores[i]);
            if (multiScores[i] > 3600)
            {
                multiPlayerScore[i].text = string.Format("{0:D2}h:{1:D2}:{2:D2}:{3:D2}",
                                                         t.Hours,
                                                         t.Minutes,
                                                         t.Seconds,
                                                         t.Milliseconds);
            }
            else
            {
                multiPlayerScore[i].text = string.Format("{0:D2}:{1:D2}:{2:D2}",
                                                         t.Minutes,
                                                         t.Seconds,
                                                         t.Milliseconds);
            }
        }
    }
Exemple #23
0
    public void RunLastBestSimulation()
    {
        int currentCol = -1;

        simMax = (int[])baseMax.Clone();
        simMap = baseMap.Select(a => a.ToArray()).ToArray();
        for (int i = 0; i < lastSim.Count; i++)
        {
            int col = lastSim.ElementAt(i);
            PushPiece(colors.ElementAt(i), col);
            if (currentCol == -1)
            {
                currentCol = col;
            }
        }
        BestScore bs = new BestScore(simMap, simMax);

        bs.CalculScore();
        bestCol = currentCol;
        //Console.Error.WriteLine("LOL {0}", bestCol);
        lastSim.RemoveAt(0);
    }
Exemple #24
0
        void ReleaseDesignerOutlets()
        {
            if (BestScore != null)
            {
                BestScore.Dispose();
                BestScore = null;
            }

            if (Changer != null)
            {
                Changer.Dispose();
                Changer = null;
            }

            if (InputText != null)
            {
                InputText.Dispose();
                InputText = null;
            }

            if (Score != null)
            {
                Score.Dispose();
                Score = null;
            }

            if (StatusImage != null)
            {
                StatusImage.Dispose();
                StatusImage = null;
            }

            if (Symbol != null)
            {
                Symbol.Dispose();
                Symbol = null;
            }
        }
Exemple #25
0
    public void ScoreUp()
    {
        //자신의 최대 치를 자신의 위치를 비교하여 스코어를 올림
        if (scoreKeep < (int)player.transform.position.z)
        {
            scoreKeep = (int)player.transform.position.z;

            Score++;
        }

        // 클릭 카운트가 베스트클릭카운트보다 높을시 갱신
        if (Score > BestScore)
        {
            BestScore = Score;

            uiPanel.bestClickScore.text = "TOP : " + BestScore.ToString();
        }
        // 클릭 카운트 표시
        uiPanel.clickScore.text = Score.ToString();

        // 베스트클릭 점수 저장
        PlayerPrefs.SetInt("BESTSCORE", BestScore);
    }
 private void Start()
 {
     hasDeleted = false;
     bestScore  = FindObjectOfType <BestScore>();
 }
Exemple #27
0
 // Use this for initialization
 void Start()
 {
     Reset_();
     m_bestScore = GameObject.FindObjectOfType <BestScore>();
 }
        public string Normalized(StringUtilities.StringConverter wordconv)
        {
            if (IsTerminal)
                return wordconv(name);

            // choose max-probability sense
            BestScore<PhraseSense> strongest = new BestScore<PhraseSense>();
            foreach (KeyValuePair<PhraseSense, double> sense in senses)
                strongest.Improve(sense.Value, sense.Key);

            StringBuilder result = new StringBuilder();
            foreach (InformedPhrase subphr in strongest.Payload.Phrases)
            {
                string normal = subphr.Normalized(wordconv);
                if (normal == "")
                    continue;   // skip it
                if (result.Length > 0)
                    result.Append(" ");
                result.Append(normal);
            }

            return result.ToString();
        }
        // refine should not be equality-- we could go in circles
        public double HasRelationTo(Memory memory, Concept find, Relations.Relation relation, Relations.Relation refine)
        {
            List<Datum> data = memory.GetData(this);
            BestScore<Datum> bestConnect = new BestScore<Datum>(0.0, null);

            foreach (Datum datum in data)
            {
                if (datum.Relation == relation && datum.Right == find)
                    return datum.Score;
                if (datum.Relation == relation || datum.Relation == refine)
                    bestConnect.Improve(datum.Right.HasRelationTo(memory, find, relation, refine) * datum.Score, datum);
            }

            return bestConnect.Score;
        }
        public Datum IsKnown(Datum datum)
        {
            // Is this datum represented?
            BestScore<Datum> match = new BestScore<Datum>();
            foreach (Datum check in GetData(datum.Left))
                if (datum.Relation == check.Relation)
                    match.Improve(datum.Right.SeemsSimilar(check.Right).ToDouble(1.0), check);

            return match.Payload;
        }
Exemple #31
0
    void GameStart()
    {
        for (int i = tower1.transform.childCount - 1; i >= 0; i--)
        {
            GameObject.Destroy(tower1.transform.GetChild(i).gameObject);
        }
        for (int j = tower2.transform.childCount - 1; j >= 0; j--)
        {
            GameObject.Destroy(tower2.transform.GetChild(j).gameObject);
        }
        for (int k = tower3.transform.childCount - 1; k >= 0; k--)
        {
            GameObject.Destroy(tower3.transform.GetChild(k).gameObject);
        }
        gameIsRuning = true;

        bgStartCanvasGroup.alpha             = 0;
        bgStartCanvasGroup.blocksRaycasts    = false;
        bgGameOverCanvasGroup.alpha          = 0;
        bgGameOverCanvasGroup.blocksRaycasts = false;

        round += 1;
        score  = 0;
        //scoreValueText.text = "0";
        bulletSpeed = 16;
        enemySpeed  = 4;
        level       = 1;
        enemyAlive  = 0;

        if (fileData.LoadBestScore() != null)
        {
            bestScoreData = fileData.LoadBestScore();
        }
        else
        {
            bestScoreData           = new BestScore();
            bestScoreData.bestScore = 0;
            fileData.SaveBestScore(bestScoreData);
        }
        colorGun1        = 1;
        colorGun2        = 2;
        colorGun3        = 3;
        stopReleaseEnemy = false;
        //bg.color = new Color32(71, 71, 67, 255);
        tower1.sprite = Resources.Load <Sprite>("switch_pink");
        tower2.sprite = Resources.Load <Sprite>("switch_blue");
        tower3.sprite = Resources.Load <Sprite>("switch_yellow");

        gun1.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Pink_Gun_Spritesheet_0");
        gun1.GetComponent <Animator>().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Pink_Gun_Spritesheet_0");
        gun2.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Blue_Gun_Spritesheet_0");
        gun2.GetComponent <Animator>().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Blue_Gun_Spritesheet_0");
        gun3.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Yellow_Gun_Spritesheet_0");
        gun3.GetComponent <Animator>().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Yellow_Gun_Spritesheet_0");

        bulletPrefab1 = (GameObject)Resources.Load("Bullet", typeof(GameObject));
        bulletPrefab2 = (GameObject)Resources.Load("Bullet", typeof(GameObject));
        bulletPrefab3 = (GameObject)Resources.Load("Bullet", typeof(GameObject));
        enemyPrefab1  = (GameObject)Resources.Load("Enemy", typeof(GameObject));
        enemyPrefab2  = (GameObject)Resources.Load("Enemy", typeof(GameObject));
        enemyPrefab3  = (GameObject)Resources.Load("Enemy", typeof(GameObject));

        InvokeRepeating("Shotgun", 0, 0.7f);
        InvokeRepeating("RepleaseEnemy", 0, 1.0f);
    }
 /// <summary>
 /// Inserts the best score.
 /// </summary>
 /// <param name="bestScore">The best score.</param>
 /// <returns>
 /// the task
 /// </returns>
 public async Task InsertBestScoreAsync(BestScore bestScore)
 {
     await this.bestScoreRepository.InsertAsync(bestScore);
 }