public Jeux(Jedi _jedi)
 {
     InitializeComponent();
     jedi = _jedi;
     pm   = new PlayingManager(new BusinessManager());
     pm.LancerMatch(jedi);
 }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp;
            GameManager.money     += PlayingManager.getMoney;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            AudioSource.PlayClipAtPoint(boomSE, Vector3.one + Vector3.one, 0.5f);
            Destroy(this.gameObject);
            Instantiate(boom, transform.position, Quaternion.identity);
        }
    }
Exemplo n.º 3
0
 void OnTriggerEnter(Collider other)
 {
     if (Time.timeScale != 0)
     {
         //被棒子揮到時
         if (other.tag == "sticks" && hitCD <= 0)
         {
             //所有元件閃紅 往上位移
             for (int i = 0; i < this.transform.childCount; i++)
             {
                 this.transform.GetChild(i).renderer.material.color = Color.red;
             }
             blinkRed = true;
             transform.Translate(0, 1, 0, Space.World);
             //加HP
             int addHP = PlayingManager.addHP * 5;
             if (GameManager.wearSk1 == 6 || GameManager.wearSk2 == 6 || GameManager.wearSk3 == 6)
             {
                 addHP += GameManager.skLv[5] * 50 + (int)((float)addHP * Random.Range(-0.1f, 0.1f));
             }
             else
             {
                 addHP += (int)((float)addHP * Random.Range(-0.1f, 0.1f));
             }
             PlayingManager.stageHp += addHP;
             PlayingManager.ShowPlus(addHP, this.transform.position);
             AudioSource.PlayClipAtPoint(hitSE, Vector3.one);
             hitCD = 0.2f;
         }
     }
 }
Exemplo n.º 4
0
 public void End()
 {
     Debug.Log("End School");
     GameManager.Instance.ChangeBackground("RabbitRoom");
     state = ScheduleState.Finish;
     PlayingManager.PlusCurrentScheduleIndex();
     gameObject.SetActive(false);
     DialogueManager.Instance.ReceiveCommandsFile("EndSchedule");
 }
Exemplo n.º 5
0
 void Start()
 {
     GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY
                                              | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY |
                                              RigidbodyConstraints.FreezePositionZ;
     GetComponent <Rigidbody>().drag                   = 0;
     GetComponent <Rigidbody>().angularDrag            = 0;
     GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous;
     Manager = GameObject.FindWithTag("Manager");
     pm      = Manager.GetComponent <PlayingManager>();
     freezeComponent(GetComponent <Rigidbody>(), true);
 }
    void Start()
    {
        m   = GameObject.FindWithTag("Manager");
        img = GetComponent <Image>();
        pm  = m.GetComponent <PlayingManager>();
        rt  = GetComponent <RectTransform>();

        var tempColor = img.color;

        tempColor.a = 1f;
        img.color   = tempColor;

        rt.sizeDelta = new Vector2(50, 50f);

        img.sprite = ps;
    }
Exemplo n.º 7
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP = PlayingManager.addHP / 2 + (int)((float)PlayingManager.addHP * 0.5f * Random.Range(-0.1f, 0.1f));
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp / 2;
            GameManager.money     += PlayingManager.getMoney / 2;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            AudioSource.PlayClipAtPoint(boomSE, Vector3.one + Vector3.one, 0.5f);
            Destroy(this.gameObject);
            Instantiate(boom, transform.position, Quaternion.identity);
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP / 2 + (int)((float)PlayingManager.minusHP * 0.5f * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            //玻璃球
            if (this.name == "GlassBall" || this.name == "TopGlassBall")
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
    }
Exemplo n.º 8
0
    // Start is called before the first frame update
    private void Awake()
    {
        gameMaster  = FindObjectOfType <GameMaster>();
        audioSource = gameObject.AddComponent <AudioSource>();
        audioSource.outputAudioMixerGroup = amgSE;

        if (gameMaster == null) //デバッグ用(シーン直実行)
        {
            gameObject.AddComponent <RankingManager>();
            gameMaster = gameObject.AddComponent <GameMaster>();
            if (SceneManager.GetActiveScene().name != "Training")
            {
                gameMaster.gameMode = new GameMode(-1, "テスト", 3, true, true, testTrapezeLengs, -1f, "");
            }
            else
            {
                gameMaster.gameMode = gameMaster.gmTraining;
            }
            gameMaster.settings   = new Settings("加藤純一", true, 1f, true, 0, Application.version, 100000f);
            gameMaster.am         = am;
            gameMaster.isTutorial = isDebugTutorial;
        }
        if (gameMaster.gameMode.id == 99)
        {
            isTraining = true;
        }
        isTutorial = gameMaster.isTutorial;
        if (isTutorial)
        {
            GetComponent <Tutorial>().enabled = true;
        }
        //コメントテキストデータロード
        allComments = new List <CommentsData>();
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData0"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData1"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData2"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData3"));
        allComments.Add(Resources.Load <CommentsData>("Comments/CommentsData4"));

        playingManager = this;

        Stat       = Stat_global.init;
        _oldStat   = Stat;
        _oldPcStat = playerController.stat;
    }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            BusinessManager      businessManager = new BusinessManager();
            int                  input;
            bool                 end = false;
            IEnumerable <string> res;

            List <Jedi> jedis = businessManager.getJedis();

            while (!end)
            {
                Console.Out.WriteLine("Menu");
                Console.Out.WriteLine("1 - All matches");
                Console.Out.WriteLine("2 - All stades");
                Console.Out.WriteLine("3 - All siths");
                Console.Out.WriteLine("4 - Jedi 3 F 50 HP");
                Console.Out.WriteLine("5 - Match 200 places siths");
                Console.Out.WriteLine("6 - Play !");
                Console.Out.WriteLine("7 - Bet !");
                Console.Out.WriteLine("8 - Exit");
                input = int.Parse(Console.In.ReadLine());
                switch (input)
                {
                case 1:
                    List <Match> matches = businessManager.getMatches();
                    foreach (Match match in matches)
                    {
                        Console.Out.Write(match.ToString());
                    }
                    break;

                case 2:
                    res = businessManager.getStringStades();
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 3:
                    res = businessManager.getStringObscurJedis();           //Ce sont des Sith pas des jedis obscurs !!
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 4:
                    res = businessManager.getStringJedis(3, 50);
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 5:
                    res = businessManager.getStringSithMatchesOver200();
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 6:
                    Jedi           choosenJedi = null;
                    PlayingManager pm          = new PlayingManager(businessManager);
                    while (choosenJedi == null)
                    {
                        Console.Out.WriteLine("Choose your jedi ! (put id) ");
                        foreach (Jedi jedi in jedis)
                        {
                            Console.Out.WriteLine(jedi.Id + "\t: " + jedi.Nom);
                        }
                        int choixJedi = int.Parse(Console.In.ReadLine());

                        choosenJedi = jedis.Find(x => x.Id == choixJedi);
                    }

                    pm.LancerMatch(choosenJedi, 8);

                    while (pm.End != true)
                    {
                        bool cont = false;
                        while (!cont)
                        {
                            cont = true;
                            pm.title();
                            Console.Out.WriteLine("Choose your attack :");
                            Console.Out.WriteLine("\t1 - Force");
                            Console.Out.WriteLine("\t2 - Chance");
                            Console.Out.WriteLine("\t3 - Defense !");
                            int choixAttack = int.Parse(Console.In.ReadLine());

                            switch (choixAttack)
                            {
                            case 1:
                                pm.utiliserForce();
                                break;

                            case 2:
                                pm.utiliserChance();
                                break;

                            case 3:
                                pm.utiliserDefense();
                                break;

                            default:
                                cont = false;
                                break;
                            }
                        }
                        Console.Out.WriteLine(pm.StatLastTurn);
                    }
                    if (pm.Win)
                    {
                        Console.Out.WriteLine("Vous avez gagne !");
                    }
                    else
                    {
                        Console.Out.WriteLine("Vous avez perdu !");
                    }
                    break;

                case 7:
                    BettingManager bettingManager = new BettingManager(businessManager, 2);

                    Console.Out.WriteLine("List Jedi :");
                    foreach (Match match in bettingManager.Pool.Matches)
                    {
                        Console.Out.WriteLine(match.Jedi1.Id + "\t: " + match.Jedi1.Nom);
                        Console.Out.WriteLine(match.Jedi2.Id + "\t: " + match.Jedi2.Nom);
                    }
                    while (!bettingManager.End)
                    {
                        int  choixJedi1;
                        int  bet1;
                        Jedi choosenJediBet1 = null;

                        int  choixJedi2;
                        int  bet2;
                        Jedi choosenJediBet2 = null;


                        while (choosenJediBet1 == null)
                        {
                            Console.Out.WriteLine("Player 1 your jedi ! (put id) ");
                            choixJedi1      = int.Parse(Console.In.ReadLine());
                            choosenJediBet1 = jedis.Find(x => x.Id == choixJedi1);
                        }
                        Console.Out.WriteLine("Player 1 choose your bet : ");
                        bet1 = int.Parse(Console.In.ReadLine());

                        while (choosenJediBet1 == null)
                        {
                            Console.Out.WriteLine("Player 2 your jedi ! (put id) ");
                            choixJedi2      = int.Parse(Console.In.ReadLine());
                            choosenJediBet2 = jedis.Find(x => x.Id == choixJedi2);
                        }
                        Console.Out.WriteLine("Player 2 choose your bet : ");
                        bet2 = int.Parse(Console.In.ReadLine());

                        bettingManager.lancerPhaseTournoi(new List <int> {
                            bet1, bet2
                        }, new List <Jedi> {
                            choosenJediBet1, choosenJediBet2
                        });
                        Console.Out.WriteLine(bettingManager.toString());
                    }
                    break;

                case 8:
                    end = true;
                    break;

                default:
                    Console.Out.WriteLine("Bad input");
                    break;
                }
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            BusinessManager      businessManager = new BusinessManager();
            int                  input;
            bool                 end = false;
            IEnumerable <string> res;

            /*Console.Out.WriteLine("Test connection");
             * Jedi jedi = businessManager.testBDD();
             * Console.Out.WriteLine(jedi.ToString());
             *
             * // TEST CARACTERISTIQUE
             *
             * List<Caracteristique> caracts = businessManager.getCaracteristique();
             *
             * List<Caracteristique> cj = new List<Caracteristique>();
             * cj.Add(new Caracteristique( EDefCaracteristique.Sante, "TEST JEDI 1", ETypeCaracteristique.Jedi, 90));
             *
             * List<Caracteristique> cs = new List<Caracteristique>();
             * cs.Add(new Caracteristique( EDefCaracteristique.Chance, "TEST STADE 1", ETypeCaracteristique.Stade, 10));
             *
             * //Test ajout
             * caracts.Add(new Caracteristique(EDefCaracteristique.Chance,"TEST CARACT 1",ETypeCaracteristique.Jedi,0));
             * caracts.Add(cj[0]);
             * caracts.Add(cs[0]);
             * //Test suppression
             * caracts.Remove(caracts[2]);
             * //Test update
             * caracts[2].Nom = "toto";
             * businessManager.updateCaracteristique(caracts);
             *
             * // TEST UTILISATEUR
             *
             * List<Utilisateur> users = businessManager.getUtilisateur();
             * //Test ajout
             * users.Add(new Utilisateur("jean", "jaque", "j", "j"));
             * //Test suppression
             * users.Remove(users[2]);
             * //Test update
             * users[0].Prenom = "toto";
             * businessManager.updateUtilisateur(users);
             *
             *
             * //    TEST JEDI
             *
             * List<Jedi> jedis = businessManager.getJedis();
             *
             * //Test ajout jedi
             * jedis.Add(new Jedi("Michel", false, cj));
             *
             * //Test suppression Jedi
             * jedis.Remove(jedis[1]);
             * //Test update Jedi
             * jedis[2].Nom = "Stan Smith";
             * //Test suppression Caract
             * jedis[2].Caracteristiques.Remove(jedis[2].Caracteristiques[0]);
             * //Test ajout Caract
             * jedis[2].Caracteristiques.Add(cj[0]);
             * //Test update Caract
             * jedis[2].Caracteristiques[1].Nom = "TEST JEDI 3";
             *
             * businessManager.updateJedi(jedis);
             *
             * //  TEST STADES
             *
             * List<Stade> stades = businessManager.getStades();
             * //Test ajout stade
             * stades.Add(new Stade(300, "Jakku", cs));
             *
             * //Test suppression stade
             * stades.Remove(stades[1]);
             * //Test update stade
             * stades[2].Planete = "Ta maman";
             * //Test suppression Caract
             * stades[2].Caracteristiques.Remove(jedis[2].Caracteristiques[0]);
             * //Test ajout Caract
             * stades[2].Caracteristiques.Add(cs[0]);
             * //Test update Caract
             * stades[2].Caracteristiques[1].Nom = "TEST STADE 3";
             *
             * businessManager.updateStades(stades);
             *
             * //  TEST MATCH
             *
             * List<Match> matches = businessManager.getMatches();
             * //Test ajout
             * matches.Add(new Match(jedis[0], jedis[2], EPhaseTournoi.Finale, stades[0]));
             * matches.Add(new Match(jedis[0], jedis[2], EPhaseTournoi.Finale, stades[0]));
             * //Test suppression
             * matches.Remove(matches[0]);
             * //Test update
             * matches[0].Jedi1 = jedis[1];
             *
             * businessManager.updateMatch(matches);*/

            List <Jedi> jedis = businessManager.getJedis();

            while (!end)
            {
                Console.Out.WriteLine("Menu");
                Console.Out.WriteLine("1 - All matches");
                Console.Out.WriteLine("2 - All stades");
                Console.Out.WriteLine("3 - All siths");
                Console.Out.WriteLine("4 - Jedi 3 F 50 HP");
                Console.Out.WriteLine("5 - Match 200 places siths");
                Console.Out.WriteLine("6 - Play !");
                Console.Out.WriteLine("7 - Bet !");
                Console.Out.WriteLine("8 - Exit");
                input = int.Parse(Console.In.ReadLine());
                switch (input)
                {
                case 1:
                    List <Match> matches = businessManager.getMatches();
                    foreach (Match match in matches)
                    {
                        Console.Out.Write(match.ToString());
                    }
                    break;

                case 2:
                    res = businessManager.getStringStades();
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 3:
                    res = businessManager.getStringObscurJedis();           //Ce sont des Sith pas des jedis obscurs !!
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 4:
                    res = businessManager.getStringJedis(3, 50);
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 5:
                    res = businessManager.getStringSithMatchesOver200();
                    foreach (String el in res)
                    {
                        Console.Out.WriteLine(el);
                    }
                    break;

                case 6:
                    Jedi           choosenJedi = null;
                    PlayingManager pm          = new PlayingManager(businessManager);
                    while (choosenJedi == null)
                    {
                        Console.Out.WriteLine("Choose your jedi ! (put id) ");
                        foreach (Jedi jedi in jedis)
                        {
                            Console.Out.WriteLine(jedi.Id + "\t: " + jedi.Nom);
                        }
                        int choixJedi = int.Parse(Console.In.ReadLine());

                        choosenJedi = jedis.Find(x => x.Id == choixJedi);
                    }

                    pm.LancerMatch(choosenJedi, 8);

                    while (pm.End != true)
                    {
                        bool cont = false;
                        while (!cont)
                        {
                            cont = true;
                            pm.title();
                            Console.Out.WriteLine("Choose your attack :");
                            Console.Out.WriteLine("\t1 - Force");
                            Console.Out.WriteLine("\t2 - Chance");
                            Console.Out.WriteLine("\t3 - Defense !");
                            int choixAttack = int.Parse(Console.In.ReadLine());

                            switch (choixAttack)
                            {
                            case 1:
                                pm.utiliserForce();
                                break;

                            case 2:
                                pm.utiliserChance();
                                break;

                            case 3:
                                pm.utiliserDefense();
                                break;

                            default:
                                cont = false;
                                break;
                            }
                        }
                        Console.Out.WriteLine(pm.StatLastTurn);
                    }
                    if (pm.Win)
                    {
                        Console.Out.WriteLine("Vous avez gagne !");
                    }
                    else
                    {
                        Console.Out.WriteLine("Vous avez perdu !");
                    }
                    break;

                case 7:
                    BettingManager bettingManager = new BettingManager(businessManager);

                    Console.Out.WriteLine("List Jedi :");
                    foreach (Match match in bettingManager.Pool.Matches)
                    {
                        Console.Out.WriteLine(match.Jedi1.Id + "\t: " + match.Jedi1.Nom);
                        Console.Out.WriteLine(match.Jedi2.Id + "\t: " + match.Jedi2.Nom);
                    }
                    while (!bettingManager.End)
                    {
                        int  choixJedi1;
                        int  bet1;
                        Jedi choosenJediBet1 = null;

                        int  choixJedi2;
                        int  bet2;
                        Jedi choosenJediBet2 = null;


                        while (choosenJediBet1 == null)
                        {
                            Console.Out.WriteLine("Player 1 your jedi ! (put id) ");
                            choixJedi1      = int.Parse(Console.In.ReadLine());
                            choosenJediBet1 = jedis.Find(x => x.Id == choixJedi1);
                        }
                        Console.Out.WriteLine("Player 1 choose your bet : ");
                        bet1 = int.Parse(Console.In.ReadLine());

                        while (choosenJediBet1 == null)
                        {
                            Console.Out.WriteLine("Player 2 your jedi ! (put id) ");
                            choixJedi2      = int.Parse(Console.In.ReadLine());
                            choosenJediBet2 = jedis.Find(x => x.Id == choixJedi2);
                        }
                        Console.Out.WriteLine("Player 2 choose your bet : ");
                        bet2 = int.Parse(Console.In.ReadLine());

                        bettingManager.lancerPhaseTournoi(bet1, choosenJediBet1, bet2, choosenJediBet2);
                        Console.Out.WriteLine(bettingManager.toString());
                    }
                    break;

                case 8:
                    end = true;
                    break;

                default:
                    Console.Out.WriteLine("Bad input");
                    break;
                }
            }
        }
Exemplo n.º 11
0
        protected override void PlayCard(PlayingManager manager)
        {
            Card selectedCard = null;

            _playingManager = manager;

            IList <Card> validCards = GetValidCards();

            if (manager.CurrentHand.IsEmpty)               // 2.1
            {
                #region 2.1

                int  maxEvaluated     = 0;
                Card maxEvaluatedCard = null;

                foreach (Card card in validCards)
                {
                    int points = EvalutePointsOnRemaining(card);
                    points += EvalutePointsOnPartnerAnnounce(card);
                    points += EvalutePointsOnTrumpColor(card);

                    if (points > maxEvaluated)
                    {
                        maxEvaluated     = points;
                        maxEvaluatedCard = card;
                    }
                }

                if (maxEvaluatedCard != null)
                {
                    #region 2.1.1

                    if (IsCurrentMaxCardInPlayingColor(maxEvaluatedCard))
                    {
                        #region 2.1.1.1

                        selectedCard = maxEvaluatedCard;

                        #endregion
                    }
                    else
                    {
                        #region 2.1.1.2

                        int  minPlayingPoints     = 1000;                    // incorrect but big enough value;
                        Card minPlayingPointsCard = null;

                        foreach (Card card in validCards)
                        {
                            if (card.CardColor == maxEvaluatedCard.CardColor)
                            {
                                int points = CardPointEvaluator.EvaluateCard(_playingManager.CurrentAnnouncement.Type, card);
                                if (points < minPlayingPoints)
                                {
                                    minPlayingPoints     = points;
                                    minPlayingPointsCard = card;
                                }
                            }
                        }

                        selectedCard = minPlayingPointsCard;

                        #endregion
                    }

                    #endregion
                }
                else
                {
                    #region 2.1.2

                    Random rand = new Random();
                    selectedCard = validCards[rand.Next(validCards.Count)] as Card;

                    #endregion
                }

                #endregion
            }
            else             //2.2
            {
                #region 2.2

                Card currentMaxCardInPlayingColor = null;
                foreach (Card card in validCards)
                {
                    if (card.CardColor == GetPlayingColor() && IsCurrentMaxCardInPlayingColor(card))
                    {
                        currentMaxCardInPlayingColor = card;
                        break;
                    }
                }

                if (currentMaxCardInPlayingColor != null)                   // 2.2.1
                {
                    selectedCard = currentMaxCardInPlayingColor;
                }
                else                 // 2.2.2
                {
                    #region 2.2.2

                    IList <CardColor> zeroEvaluatedColors;

                    if (FindZeroEvaluatedColor(validCards, out zeroEvaluatedColors))                         // 2.2.2.1
                    {
                        #region 2.2.2.1

                        Card   biggestCardInHand = _playingManager.GetBiggestCard();
                        Player partner           = _playingManager.GetPartner(this);
                        if (IsCurrentMaxCardInPlayingColor(biggestCardInHand) &&
                            _playingManager.GetPlayerWhoPlayedCard(biggestCardInHand) == partner)                                 //2.2.2.1.1
                        {
                            #region 2.2.2.1.1

                            int  maxPlayingPoints     = -100;
                            Card maxPlayingPointsCard = null;

                            foreach (Card card in validCards)
                            {
                                foreach (CardColor color in zeroEvaluatedColors)
                                {
                                    // we are in case 2.2.2.1 so we know card evaluated to 0 points exists
                                    if (card.CardColor == color)
                                    {
                                        int points = CardPointEvaluator.EvaluateCard(_playingManager.CurrentAnnouncement.Type, card);
                                        if (points > maxPlayingPoints)
                                        {
                                            maxPlayingPoints     = points;
                                            maxPlayingPointsCard = card;
                                        }
                                    }
                                }
                            }

                            selectedCard = maxPlayingPointsCard;

                            #endregion
                        }
                        else                         // 2.2.2.1.2
                        {
                            #region 2.2.2.1.2

                            int  minPlayingPoints     = 1000;                        // incorrect but big enough value;
                            Card minPlayingPointsCard = null;

                            foreach (Card card in validCards)
                            {
                                foreach (CardColor color in zeroEvaluatedColors)
                                {
                                    // we are in case 2.2.2.1 so we know card evaluated to 0 points exists
                                    if (card.CardColor == color)
                                    {
                                        int points = CardPointEvaluator.EvaluateCard(_playingManager.CurrentAnnouncement.Type, card);
                                        if (points < minPlayingPoints)
                                        {
                                            minPlayingPoints     = points;
                                            minPlayingPointsCard = card;
                                        }
                                    }
                                }
                            }

                            selectedCard = minPlayingPointsCard;

                            #endregion
                        }


                        #endregion
                    }
                    else                     // 2.2.2.2
                    {
                        #region 2.2.2.2

                        Card   biggestCardInHand = _playingManager.GetBiggestCard();
                        Player partner           = _playingManager.GetPartner(this);
                        if (IsCurrentMaxCardInPlayingColor(biggestCardInHand) &&
                            _playingManager.GetPlayerWhoPlayedCard(biggestCardInHand) == partner)                                 //2.2.2.2.1
                        {
                            #region 2.2.2.2.1

                            int  minEvaluated     = 1000;
                            Card minEvaluatedCard = null;

                            foreach (Card card in validCards)
                            {
                                int pointsOnRemaining = EvalutePointsOnRemaining(card);
                                // we are in case 2.2.2.2 so we know card evaluated >0 exists
                                if (pointsOnRemaining < minEvaluated)
                                {
                                    minEvaluated     = pointsOnRemaining;
                                    minEvaluatedCard = card;
                                }
                            }

                            selectedCard = minEvaluatedCard;

                            #endregion
                        }
                        else                         // 2.2.2.2.2
                        {
                            #region 2.2.2.2.2

                            int  minPlayingPoints     = 1000;                        // incorrect but big enough value;
                            int  minOnRemainingPoints = 1000;
                            Card minPlayingPointsCard = null;
                            Card minOnRemainingCard   = null;

                            foreach (Card card in validCards)
                            {
                                int pointsOnRemaining = EvalutePointsOnRemaining(card);
                                pointsOnRemaining += EvalutePointsOnPartnerAnnounce(card);

                                int points = CardPointEvaluator.EvaluateCard(_playingManager.CurrentAnnouncement.Type, card);
                                if (points < minPlayingPoints)
                                {
                                    minPlayingPoints     = points;
                                    minPlayingPointsCard = card;
                                }

                                if (pointsOnRemaining <= 0 && points < minOnRemainingPoints)
                                {
                                    minOnRemainingPoints = points;
                                    minOnRemainingCard   = card;
                                }
                            }

                            if (minOnRemainingCard == null)
                            {
                                selectedCard = minPlayingPointsCard;
                            }
                            else
                            {
                                selectedCard = minOnRemainingCard;
                            }

                            #endregion
                        }


                        #endregion
                    }

                    #endregion
                }

                #endregion
            }

            Debug.Assert(selectedCard != null);

            RaiseCardPlayed(selectedCard);
        }
Exemplo n.º 12
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            if (hitCount == 0)
            {
                AudioSource.PlayClipAtPoint(littleBoomSE, Vector3.one, 0.5f);
                this.transform.parent     = null;
                this.rigidbody.useGravity = true;
                hitCount++;
                if (havP)
                {
                    this.rigidbody.AddForce(0f, 700f, 0f);
                }
                else
                {
                    this.rigidbody.AddForce(0f, 1500f, 0f);
                }
                Instantiate(littleBoom, new Vector3(transform.position.x, transform.position.y, 0f), Quaternion.identity);
                this.renderer.materials[0].color = Color.gray;
                this.renderer.materials[1].color = Color.gray;
                timer = 0.2f;
            }
            else if (timer <= 0)
            {
                //+血
                int addHP = PlayingManager.addHP * 2 + (int)((float)PlayingManager.addHP * 2f * Random.Range(-0.1f, 0.1f));
                PlayingManager.stageHp += addHP;
                PlayingManager.ShowPlus(addHP, this.transform.position);
                PlayingManager.brkCnt++;
                GameManager.playerExp += PlayingManager.getExp * 2;
                GameManager.money     += PlayingManager.getMoney * 2;
                GameManager.breakCnt++;
                if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp += PlayingManager.sk11Pow;
                    if (PlayingManager.mineHp > PlayingManager.mineHpL)
                    {
                        PlayingManager.mineHp = PlayingManager.mineHpL;
                    }
                }

                AudioSource.PlayClipAtPoint(boomSE, Vector3.one, 0.5f);
                Destroy(this.gameObject);
                Instantiate(boom, new Vector3(transform.position.x, transform.position.y, 0f), Quaternion.identity);
            }
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            Destroy(this.gameObject);
        }
    }
Exemplo n.º 13
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP;
            if (ballCo == 0)
            {
                addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
            }
            else if (ballCo == 1)
            {
                addHP = (int)((float)PlayingManager.addHP * 1.3f) + (int)((float)PlayingManager.addHP * 1.3f * Random.Range(-0.1f, 0.1f));
            }
            else if (ballCo == 7)
            {
                addHP = (int)(PlayingManager.sk4Pow * Random.Range(-0.1f, 0.1f));
            }
            else
            {
                addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
                //分裂
                if (ballCo == 2)
                {
                    GameObject testV;
                    //int amount=Random.Range(2,5);
                    for (int i = 0; i < 4; i++)
                    {
                        testV = Instantiate(splitBall, transform.position, Quaternion.identity) as GameObject;
                        testV.rigidbody.AddForce((Random.Range(-80.0f, 80.0f)), (Random.Range(400.0f, 600.0f)), 0);
                        PlayingManager.outCount++;
                    }
                }
                //吹風
                else if (ballCo == 3)
                {
                    Instantiate(windBallWind, Vector3.zero, Quaternion.identity);
                    AudioSource.PlayClipAtPoint(windSE, Vector3.forward);
                }
                //煙霧
                else if (ballCo == 4)
                {
                    Instantiate(smokeBallSmoke, new Vector3(this.transform.position.x * 0.04545f, this.transform.position.y * 0.07142f, -7.0f), Quaternion.identity);
                }
                //移動加速BUFF
                else if (ballCo == 5)
                {
                    AudioSource.PlayClipAtPoint(buffSE, Vector3.zero);
                    if (MoveSpeedUpBuff.isShow)
                    {
                        MoveSpeedUpBuff.timer = 0f;
                    }
                    else
                    {
                        if (StickBigBuff.isShow)
                        {
                            Instantiate(moveSpeedUpBuff, new Vector3(-9.67f, 5f, 0f), Quaternion.identity);
                        }
                        else
                        {
                            Instantiate(moveSpeedUpBuff, new Vector3(-10.37f, 5f, 0f), Quaternion.identity);
                        }
                    }
                }
                //大棒BUFF
                else if (ballCo == 6)
                {
                    AudioSource.PlayClipAtPoint(buffSE, Vector3.zero);
                    if (StickBigBuff.isShow)
                    {
                        StickBigBuff.timer = 0f;
                    }
                    else
                    {
                        if (MoveSpeedUpBuff.isShow)
                        {
                            Instantiate(stickBigBuff, new Vector3(-9.67f, 5f, 0f), Quaternion.identity);
                        }
                        else
                        {
                            Instantiate(stickBigBuff, new Vector3(-10.37f, 5f, 0f), Quaternion.identity);
                        }
                    }
                }
            }
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp;
            GameManager.money     += PlayingManager.getMoney;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            Instantiate(boom, transform.position, Quaternion.identity);
            AudioSource.PlayClipAtPoint(boomSE, Vector3.one, 0.5f);
            //玻璃球
            if (ballCo == 1)
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            //玻璃球
            if (ballCo == 1)
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
    }
Exemplo n.º 14
0
    public static bool CheckValidMove(Vector2Int aOffset, List <BlockObject> aSelectedList)
    {
        // print("CHECKING VALID MOVE");
        HashSet <Vector2Int> checkTopPositions = new HashSet <Vector2Int>();
        HashSet <Vector2Int> checkBotPositions = new HashSet <Vector2Int>();

        foreach (BlockObject block in aSelectedList)
        {
            // for each position inside block
            for (int x = 0; x < block.size.x; x++)
            {
                for (int y = 0; y < block.size.y; y++)
                {
                    Vector2Int currentPos = block.pos + aOffset + new Vector2Int(x, y);
                    // check if in bounds of level
                    if (!GameUtil.IsInside(currentPos, Vector2Int.zero, BoardManager.Instance.levelData.boardSize))
                    {
                        // print("IS BLOCKED! NOT IN LEVEL BOUNDS");
                        return(false);
                    }
                    BlockObject maybeABlock = GetBlockOnPosition(currentPos);
                    // check if this position is occupied by something not itself
                    if (maybeABlock != null && !aSelectedList.Contains(maybeABlock))
                    {
                        // print("IS BLOCKED! INVALID MOVE!!!");
                        return(false);
                    }
                    // check if a mob exists on this position
                    MobObject maybeAMob = GetMobOnPosition(currentPos);
                    if (maybeAMob != null)
                    {
                        // print("IS BLOCKED! MOB EXISTS HERE");
                        return(false);
                    }
                }
            }
            // fill in checktop/checkbot positions as a list of pos that need to be checked
            for (int x = block.ghostPos.x; x < block.ghostPos.x + block.size.x; x++)
            {
                int        aboveY = block.ghostPos.y + block.size.y;
                int        belowY = block.ghostPos.y - 1;
                Vector2Int topPos = new Vector2Int(x, aboveY);
                Vector2Int botPos = new Vector2Int(x, belowY);
                foreach (BlockObject otherBlock in aSelectedList)
                {
                    if (PlayingManager.GetSelectedBlockOnPosition(topPos) == null)
                    {
                        // print("toppos does not contain a selected block");
                        Vector2Int checkPos = new Vector2Int(x, aboveY);
                        checkTopPositions.Add(checkPos);
                    }
                    if (PlayingManager.GetSelectedBlockOnPosition(botPos) == null)
                    {
                        // print("botpos does not contain a selected block");
                        Vector2Int checkPos = new Vector2Int(x, belowY);
                        checkBotPositions.Add(checkPos);
                    }
                }
            }
        }
        bool connectedOnTop = false;
        bool connectedOnBot = false;

        foreach (Vector2Int pos in checkTopPositions)
        {
            // print("examining pos " + pos);
            if (GetBlockOnPosition(pos) != null && !aSelectedList.Contains(GetBlockOnPosition(pos)))
            {
                connectedOnTop = true;
                // print("connected on top at" + pos);
            }
        }
        foreach (Vector2Int pos in checkBotPositions)
        {
            // print("examining pos " + pos);
            if (GetBlockOnPosition(pos) != null && !aSelectedList.Contains(GetBlockOnPosition(pos)))
            {
                connectedOnBot = true;
                // print("connected on bot at" + pos);
            }
        }
        if (connectedOnTop == true && connectedOnBot == true)
        {
            // print("IS SANDWICHED! INVALID MOVE!!!");
            return(false);
        }
        else if (connectedOnTop == false && connectedOnBot == false)
        {
            // print("IS FLOATING! INVALID MOVE!!!");
            return(false);
        }
        else
        {
            // print ("VALID MOVE");
            return(true);
        }
    }
Exemplo n.º 15
0
 private void Start()
 {
     Manager = GameObject.FindWithTag("Manager");
     pm      = Manager.GetComponent <PlayingManager>();
 }
Exemplo n.º 16
0
 private void HumanPlayerIsPlaying(Player player, PlayingManager manager)
 {
     SetPlayerActive(player);
     _currentHuman = ( HumanPlayer )player;
 }
 private void Start()
 {
     pm = Manager.GetComponent <PlayingManager>();
 }
Exemplo n.º 18
0
 protected override void PlayCard(PlayingManager manager)
 {
     RaiseCardPlaying(manager);
 }
    private void Start()
    {
        Manager     = GameObject.FindWithTag("Manager");
        pm          = Manager.GetComponent <PlayingManager>();
        rd          = GetComponent <Renderer>();
        SelectedMat = Resources.Load("Materials/Selected", typeof(Material)) as Material;
        DefaultMat  = Resources.Load("Materials/Default", typeof(Material)) as Material;
        rd.material = DefaultMat;
        playButton  = GameObject.FindWithTag("PlayButton");
        rbm         = GetComponent <RigidBodyManager>();
        cvs         = GameObject.FindWithTag("Canvas");
        hdui        = cvs.GetComponent <HighlightDetectionUI>();
        butter      = GetComponent <Collider>();
        butter.material.bounceCombine   = PhysicMaterialCombine.Average;
        butter.material.frictionCombine = PhysicMaterialCombine.Average;
        trueBounce = butter.material.bounciness / bounceFactor;
        trueBounce = startBounce;
        butter.material.bounciness = trueBounce * bounceFactor;
        butter.material.bounciness = trueBounce * bounceFactor;
        trueBounce = butter.material.bounciness / bounceFactor;

        posX = GameObject.Find("PositionX");
        posY = GameObject.Find("PositionY");
        posZ = GameObject.Find("PositionZ");

        rotX = GameObject.Find("RotationX");
        rotY = GameObject.Find("RotationY");
        rotZ = GameObject.Find("RotationZ");

        sclX = GameObject.Find("ScaleX");
        sclY = GameObject.Find("ScaleY");
        sclZ = GameObject.Find("ScaleZ");

        velX = GameObject.Find("VelocityX");
        velY = GameObject.Find("VelocityY");
        velZ = GameObject.Find("VelocityZ");

        angularVelX = GameObject.Find("AngularVelocityX");
        angularVelY = GameObject.Find("AngularVelocityY");
        angularVelZ = GameObject.Find("AngularVelocityZ");

        mass = GameObject.Find("MassInput");

        dynamicFriction = GameObject.Find("DynamicFrictionInput");
        staticFriction  = GameObject.Find("StaticFrictionInput");

        dynamicFriction.GetComponent <InputField>().text = startDyFric.ToString();
        staticFriction.GetComponent <InputField>().text  = startStFric.ToString();
        butter.material.dynamicFriction = startDyFric;
        butter.material.staticFriction  = startStFric;
        rbm.mass = startMass;

        elasticityInput  = GameObject.Find("ElasticityInput");
        elasticitySlider = GameObject.Find("ElasticitySlider");

        staticToggle = GameObject.Find("Static");

        reset();
        Compile();
        KidsReactToPropertyDamage();
    }
Exemplo n.º 20
0
	void OnTriggerEnter(Collider other){
		//棒子
		if((other.tag=="sticks" && UserScreen.hitting>0) || other.tag=="playerBall"){
			this.transform.parent=null;
			this.rigidbody.useGravity=true;
			this.rigidbody.AddForce(0,2000,0);
			AudioSource.PlayClipAtPoint(littleBoomSE,Vector3.one+Vector3.one,0.5f);
			if(PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL){
				PlayingManager.mineHp += PlayingManager.sk11Pow;
				if(PlayingManager.mineHp > PlayingManager.mineHpL){
					PlayingManager.mineHp = PlayingManager.mineHpL;
				}
			}
			playerBall=true;
			this.tag="playerBall";
		}
		//刪除
		else if(other.tag=="deleteLine"){
			//-血
			int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f,0.1f));
			PlayingManager.mineHp -= minusHP;
			PlayingManager.ShowPlus(minusHP,this.transform.position,true);
			PlayingManager.lostCount++;

			AudioSource.PlayClipAtPoint(minusHpSE,Vector3.one+Vector3.one,0.5f);
			Destroy(this.gameObject);
		}else if(playerBall){
			if(other.tag=="fireBall"){
				//打到球
				Instantiate(boom,this.transform.position,Quaternion.identity);
				AudioSource.PlayClipAtPoint(boomSE,Vector3.one+Vector3.one,0.5f);
				//加HP
				int addHP;
				if (GameManager.wearSk1 == 5 || GameManager.wearSk2 == 5 || GameManager.wearSk3 == 5) {
					//sk迴球特好
					addHP = PlayingManager.addHP + GameManager.skLv[4]*20 + (int)((float)PlayingManager.addHP * Random.Range(-0.1f,0.1f));
				}else{
					addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f,0.1f));
				}
				PlayingManager.stageHp += addHP;
				PlayingManager.ShowPlus(addHP,this.transform.position);
				GameManager.playerExp += PlayingManager.getExp;
				GameManager.money += PlayingManager.getMoney;
				GameManager.breakCnt++;

				Destroy(this.gameObject);
			}else if(other.tag=="StageBoss"){
				//打到BOSS
				other.transform.Translate(0,2,0,Space.World);
				//加HP
				int addHP;
				if (GameManager.wearSk1 == 5 || GameManager.wearSk2 == 5 || GameManager.wearSk3 == 5) {
					//sk迴球特好
					addHP = PlayingManager.addHP*5 + GameManager.skLv[4]*20 + (int)((float)PlayingManager.addHP*5f * Random.Range(-0.1f,0.1f));
				}else{
					addHP = PlayingManager.addHP*5 + (int)((float)PlayingManager.addHP*5f * Random.Range(-0.1f,0.1f));
				}
				PlayingManager.stageHp += addHP;
				PlayingManager.ShowPlus(addHP,this.transform.position);
				GameManager.playerExp += PlayingManager.getExp;
				GameManager.money += PlayingManager.getMoney;
				GameManager.breakCnt++;

				AudioSource.PlayClipAtPoint(boomSE,Vector3.one+Vector3.one,0.5f);
				Instantiate(boom,this.transform.position,Quaternion.identity);
				Destroy(this.gameObject);
			}
		}
	}