Example #1
0
        public void PlayGame()
        {
            switch (GameMode)
            {
            case GameMode.PlayerVsComputer:
                PlayerVsComputer();
                break;

            default:
                ComputerVsComputer();
                break;
            }


            PlayerA.ShowBoards();
            PlayerB.ShowBoards();

            if (PlayerA.HasLost)
            {
                Console.WriteLine(PlayerB.Name + " has won the game!");
            }
            else if (PlayerB.HasLost)
            {
                Console.WriteLine(PlayerA.Name + " has won the game!");
            }
        }
Example #2
0
        public async void MediatorTest()
        {
            PlayerMediator mediator = new PlayerMediator();
            PlayerA        playerA  = new PlayerA(mediator);
            PlayerB        playerB  = new PlayerB(mediator);

            mediator.playerA = playerA;
            mediator.playerb = playerB;

            playerA.Send("aa");
            playerB.Send("bb");

            Assert.True(playerA.GetChat().Count == 2);
        }
Example #3
0
        private void Round()
        {
            Point      shotPossition = PlayerA.FireShot();
            ShotResult result        = PlayerB.ProcessShot(shotPossition);

            PlayerA.ProcessShotResult(shotPossition, result);

            if (!PlayerB.HasLost)
            {
                shotPossition = PlayerB.FireShot();
                result        = PlayerA.ProcessShot(shotPossition);
                PlayerB.ProcessShotResult(shotPossition, result);
            }
        }
    void Start()
    {
        test1 = FindObjectOfType <test>();

        oyuncu  = FindObjectOfType <Player>();
        oyuncuA = FindObjectOfType <PlayerA>();
        oyuncuB = FindObjectOfType <PlayerB>();
        oyuncuC = FindObjectOfType <PlayerC>();
        oyuncuD = FindObjectOfType <PlayerD>();
        ld      = FindObjectOfType <LoadScene>();
        StartCoroutine(Text());
        UnityEngine.PlayerPrefs.SetInt("FirstSituation", oyuncu.MevcutAltin);

        UnityEngine.PlayerPrefs.Save();
    }
Example #5
0
        public void Should_Always_Fill_Gap_On_Fourth_Move(int seed, int expectedX, int expectedY)
        {
            Randomizer.Seed(seed);

            TakeTurns(3);
            PlayerA.TakeTurn();
            Board.Dump();
            PlayerB.TakeTurn();

            VerifyCell(expectedX, expectedY, 'O');
            using (ApprovalResults.ForScenario(seed))
            {
                Approvals.Verify(Board.Ascii());
            }
        }
Example #6
0
        private void btnPlayer(object sender, MouseButtonEventArgs e)
        {
            var wnd = new vwPlayer();

            wnd.Owner        = this;
            wnd.PlayerA.Text = PlayerAName.Text;
            wnd.PlayerB.Text = PlayerBName.Text;
            wnd.ShowDialog();
            if (wnd.Reset)
            {
                PlayerA.ResetCount();
                PlayerB.ResetCount();
                this.Hauptschlag.SetHauptschlag(null);
            }
            PlayerAName.Text = wnd.PlayerAName;
            PlayerBName.Text = wnd.PlayerBName;
        }
        public static void Start()
        {
            PlayerBase playerA = new PlayerA();

            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            PlayerBase playerB = new PlayerB();

            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();

            Console.WriteLine("-------------With Decorators-----------");

            playerA = new Tiger(playerA);
            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            playerA = new Cheetah(playerA);
            playerA.PrintName();
            playerA.Attack();
            playerA.Jump();
            playerA.Run();

            playerB = new Kangaroo(playerB);
            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();

            playerB = new Tiger(playerB);
            playerB.PrintName();
            playerB.Attack();
            playerB.Jump();
            playerB.Run();
        }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Player  player  = collision.GetComponent <Player>();
        PlayerB playerB = collision.GetComponent <PlayerB>();

        if (player != null)
        {
            Debug.Log("Add HEALTH");
            //collision.GetComponent<HeartSystem>().healHealth(healAmount);
            collision.GetComponent <Player>().heal(healAmount);

            Destroy(gameObject);
        }
        if (playerB != null)
        {
            //collision.GetComponent<HeartSystemB>().healHealth(healAmount);
            collision.GetComponent <PlayerB>().heal(healAmount);

            Destroy(gameObject);
        }
    }
Example #9
0
    // Start is called before the first frame update
    void Start()
    {
        plotPlayerAObjectCommand = new PlayerA();
        plotPlayerBObjectCommand = new PlayerB();
        strikeOffCommand         = new StrikeOff();
        updateScoreCommand       = new Score();
        replayCommand            = new Replay();

        replayCommands  = new List <Command>();
        replayPositions = new List <Vector3>();
        placedObjects   = new List <GameObject>();

        replayButton = GameObject.Find("Replay").GetComponent <Button>();
        undoButton   = GameObject.Find("Undo").GetComponent <Button>();

        playerNameText   = GameObject.Find("Player Name").GetComponent <TMPro.TextMeshProUGUI>();
        winnerText       = GameObject.Find("Winner").GetComponent <TMPro.TextMeshProUGUI>();
        playerAScoreText = GameObject.Find("Player A Score").GetComponent <TMPro.TextMeshProUGUI>();
        playerBScoreText = GameObject.Find("Player B Score").GetComponent <TMPro.TextMeshProUGUI>();
        scoreCard        = GameObject.Find("Score Card");
        scoreCard.SetActive(false);
    }
Example #10
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        Player player = collider.GetComponent <Player>();

        if (player != null)
        {
            // We hit the Player
            Vector3 knockbackDir = (player.GetPosition() - transform.position).normalized;
            player.DamageKnockback(knockbackDir, 0.5f, damageAmount);

            //collider.GetComponent<HeartSystem>().takeDamage(damageAmount);
        }

        PlayerB playerB = collider.GetComponent <PlayerB>();

        if (playerB != null)
        {
            // We hit the Player
            Vector3 knockbackDir = (playerB.GetPosition() - transform.position).normalized;
            playerB.DamageKnockback(knockbackDir, 0.5f, damageAmount);
            //collider.GetComponent<HeartSystemB>().takeDamage(damageAmount);
        }
    }
    public SoldierController getSoilderByID(string id)
    {
        SoldierController s = PlayerB.getSoilderByID(id);

        if (s != null)
        {
            int pos = PlayerB.getSoildersPos(id);
            pos = 4 - pos;
            s   = PlayerA.getSoilderByPos(pos);
            return(s);
        }

        SoldierController s2 = PlayerA.getSoilderByID(id);

        if (s2 != null)
        {
            int pos = PlayerA.getSoildersPos(id);
            pos = 4 - pos;
            s2  = PlayerB.getSoilderByPos(pos);
            return(s2);
        }
        return(null);
    }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     playerb = FindObjectOfType <PlayerB>();
 }