Exemplo n.º 1
0
 private void Start()
 {
     this._numLeaves = 0;
     if (GameObject.FindWithTag("NumLeaves"))
     {
         this._numLeavesText = GameObject.FindWithTag("NumLeaves").GetComponent <UnityEngine.UI.Text>();
     }
     this._currentFatigue     = this.maxFatigue;
     this._currentHydration   = this.maxHydration;
     this._currentTemperature = this.maxTemperature;
     this._rb2D            = this.GetComponent <Rigidbody2D>();
     this.normalFatigue    = new NormalPlayer(this);
     this.tiredFatigue     = new TiredPlayer(this);
     this.exhaustedFatigue = new ExhaustedPlayer(this);
     this.fatigueState     = this.normalFatigue;
     this.oldFatigueState  = this.fatigueState;
     this.playerDeath      = new PlayerDeath(this);
     this._rigidBody       = this.GetComponent <Rigidbody2D>();
     this._facingRight     = true;
     this.skeletonAnimation.state.SetAnimation(0, "Idle", true);
     this._isGrounded  = this._lastIsGrounded = false;
     this._hydrationFX = false;
     this._tempFX      = false;
     this._fxMan       = this.GetComponent <EffectsManager>();
 }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            var np = new NormalPlayer {
                WeekSalary = 700
            };

            Console.WriteLine(np.GetSalary());
            Console.ReadLine();
        }
    public void AddSplitBattleBillboard(Vector3 pos, int blood, SplitBattleBillboardType type)
    {
        //return;
        //var head = new MonsterHead(text, type);

        //Quaternion qu = new Quaternion();
        //qu.eulerAngles = new Vector3(0, 0, 0);

        //head.AddToParent(m_stage, qu, pos);

        SplitBattleBillboard sb  = null;
        SuperBattleBillboard ssb = null;

        switch (type)
        {
        case SplitBattleBillboardType.CriticalMonster:
            ssb = new CriticalMonster(blood);
            break;

        case SplitBattleBillboardType.CriticalPlayer:
            ssb = new CriticalPlayer(blood);
            break;

        case SplitBattleBillboardType.BrokenAttack:
            ssb = new BrokenAttack(blood);
            break;

        case SplitBattleBillboardType.NormalMonster:
            sb = new NormalMonster(blood);
            break;

        case SplitBattleBillboardType.NormalPlayer:
            sb = new NormalPlayer(blood);
            break;

        case SplitBattleBillboardType.Miss:
        default:
            sb = new Miss(blood);
            break;
        }

        if (sb != null)
        {
            sb.SetBillboardPos(pos);
        }
        else
        {
            ssb.SetBillboardPos(pos);
        }
    }
        public PlayerThirdLevelPage(IEngine engine)
        {
            InitializeComponent();

            this.engine   = engine;
            playerName    = engine.Player.Name;
            currentPlayer = (NormalPlayer)engine.Player;
            pointsPlayer  = currentPlayer.Points;
            pNameTB.Text  = playerName;
            pPoints.Text  = pointsPlayer.ToString();
            hardQuestions = engine.HardQuestions;

            DisplayTextForQuestionAndAnswers(hardQuestions, countQuestions);
            DisplayHints();
        }
Exemplo n.º 5
0
        public static void Main()
        {
            //Todo: smid et deck ind i game

            IGame game = new LowestSumGame();


            IPlayer player1 = new NormalPlayer("1");
            IPlayer player2 = new Weakplayer("2");
            IPlayer player3 = new NormalPlayer("3");


            game.AcceptPlayer(player1);
            game.AcceptPlayer(player2);
            game.AcceptPlayer(player3);

            game.StartGame();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            List <Player> PlayersList = new List <Player>();

            Player normalPlayer = new NormalPlayer("Normal Player");

            PlayersList.Add(normalPlayer);

            Player textbookPlayer = new TextBookPlayer("TextBook Player");

            PlayersList.Add(textbookPlayer);

            Player uberPlayer = new UberPlayer("Uber Player");

            PlayersList.Add(uberPlayer);

            Player cheater = new Cheater("Cheater");

            PlayersList.Add(cheater);

            Player uberCheater = new UberCheater("Uber Cheater");

            PlayersList.Add(uberCheater);



            int    bucketweight  = CustomRandom.GetNext();
            Player closestPlayer = null;
            int    closestWeight = 150;

            Console.WriteLine($"{bucketweight} is Bucket Weight");

            bool isgamefinished = false;

            for (int i = 0; i < 100; i++)
            {
                foreach (Player player in PlayersList)
                {
                    int number = player.GetNumber();
                    Console.WriteLine($"{player.Name} select number {number}");
                    if (number == bucketweight)
                    {
                        Console.WriteLine($"{player.Name} won");
                        isgamefinished = true;
                        break;
                    }
                    else if (Math.Abs(number - bucketweight) < closestWeight)
                    {
                        closestWeight = Math.Abs(number - bucketweight);
                        closestPlayer = player;
                    }
                }

                if (isgamefinished)
                {
                    break;
                }
            }

            if (!isgamefinished)
            {
                Console.WriteLine($"{closestPlayer.Name} won because he had closest guess");
            }

            Console.ReadKey();
        }
Exemplo n.º 7
0
        public async void GiocaPartita()
        {
            for (int iii = 0; iii < 8; iii++)
            {
                #region CREO MANO

                PulisciSchermo();

                Mano m = new Mano();

                int i = MainWindow.TABLE.giocatori.IndexOf(primo_nella_mano);

                for (int j = i; j < MainWindow.TABLE.giocatori.Count; j++)
                {
                    m.turno.Enqueue(MainWindow.TABLE.giocatori[j]);
                }
                for (int j = 0; j < i; j++)
                {
                    m.turno.Enqueue(MainWindow.TABLE.giocatori[j]);
                }

                mani.Add(m);
                mano_corrente = m;

                #endregion

                while (m.turno.Count > 0)
                {
                    var g = mano_corrente.turno.Dequeue();
                    primo_nella_mano = g;
                    SetTurno();

                    Carta c = null;
                    carta_giocata_umano = null;
                    CancellationToken ct = new CancellationToken();

                    #region DEFINIZIONE DELLA CARTA DA GIOCARE

                    if (!g.IsComputer)
                    {
                        await Task.Run(async() =>
                        {
                            while (carta_giocata_umano == null)
                            {
                                await Task.Delay(1000, ct);
                            }
                        });

                        c = carta_giocata_umano;
                        carta_giocata_umano = null;
                    }
                    else
                    {
                        // c = g.GiocaCarta();
                        if (g == chiamante)
                        {
                            ChiamantePlayer cp       = new ChiamantePlayer();
                            int             carta_id = cp.PLAY(MainWindow.TABLE, g);
                            c = g.carte_in_mano[carta_id];
                        }
                        else
                        {
                            NormalPlayer np       = new NormalPlayer();
                            int          carta_id = np.PLAY(MainWindow.TABLE, g);
                            c = g.carte_in_mano[carta_id];
                        }
                    }

                    #endregion

                    g.carte_in_mano.Remove(c);

                    CartaGiocata cg = new CartaGiocata();
                    cg.carta     = c;
                    cg.giocatore = g;
                    m.carte.Add(cg);

                    #region gioco la carta graficamente

                    UCcarta target = g.UC.dict[c];
                    g.UC.LV.Children.Remove(target);
                    g.UC.GRID_cartagiocata.Children.Clear();
                    g.UC.GRID_cartagiocata.Children.Add(target);

                    #endregion
                }

                ValutaMano();
            }

            MessageBox.Show("Partita Finita!");
            ValutaPartita();
        }
Exemplo n.º 8
0
        public void NormalPlayerPointsShouldNotBeNegative()
        {
            var normalPlayer = new NormalPlayer("Pink Unicorn");

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => normalPlayer.Points = -10);
        }
Exemplo n.º 9
0
        public void NormalPlayerConstructorShouldCreatePlayerWithGivenName()
        {
            var normalPlayer = new NormalPlayer("Fluffy Unicorn");

            Assert.AreEqual("Fluffy Unicorn", normalPlayer.Name);
        }
Exemplo n.º 10
0
 private static void Main(string[] args)
 {
     var np = new NormalPlayer {WeekSalary = 700};
     Console.WriteLine(np.GetSalary());
     Console.ReadLine();
 }
Exemplo n.º 11
0
    public void AddSplitBattleBillboard(Vector3 pos, int blood, SplitBattleBillboardType type)
    {
        //return;
        //var head = new MonsterHead(text, type);

        //Quaternion qu = new Quaternion();
        //qu.eulerAngles = new Vector3(0, 0, 0);

        //head.AddToParent(m_stage, qu, pos);

        SplitBattleBillboard sb = null;
        SuperBattleBillboard ssb = null;

        switch (type)
        {

            case SplitBattleBillboardType.CriticalMonster:
                ssb = new CriticalMonster(blood);
                break;

            case SplitBattleBillboardType.CriticalPlayer:
                ssb = new CriticalPlayer(blood);
                break;

            case SplitBattleBillboardType.BrokenAttack:
                ssb = new BrokenAttack(blood);
                break;

            case SplitBattleBillboardType.NormalMonster:
                sb = new NormalMonster(blood);
                break;

            case SplitBattleBillboardType.NormalPlayer:
                sb = new NormalPlayer(blood);
                break;

            case SplitBattleBillboardType.Miss:
            default:
                sb = new Miss(blood);
                break;
        }

        if (sb != null)
        {
            sb.SetBillboardPos(pos);
        }
        else
        {
            ssb.SetBillboardPos(pos);
        }
    }