Пример #1
0
        private static void GetTeamPlayers(Team team, bool homeTeam)
        {
            var teamLength = 6;

            for (int i = 0; i < teamLength; i++)
            {
                var position = FieldPositionFactory.Create((PlayerPositionType)i + 1);
                var player   = new Player(position, team.InMatchInformation)
                {
                    isHomeTeam = homeTeam,
                };
                if (!team.HasControllerAssociated)
                {
                    player.IsUserControlled = false;
                }
                team.AddPlayer(player);
            }
        }
Пример #2
0
        void Start()
        {
            var controllers = FindObjectsOfType <PlayerController>();
            var teamInfo    = new TeamInMatchInformation(Guid.NewGuid(), "testName", Color.red, Color.red);
            var playerA     = new Domain.Player(FieldPositionFactory.Create(PlayerPositionType.RightBack), teamInfo);
            var playerB     = new Domain.Player(FieldPositionFactory.Create(PlayerPositionType.LeftBack), teamInfo);

            playerA.AddTeammate(playerB);
            playerB.AddTeammate(playerA);
            for (var i = 0; i < controllers.Count(); i++)
            {
                var controller = controllers[i];
                if (i == 0)
                {
                    controller.Initiate(playerA, null);
                }
                else
                {
                    controller.Initiate(playerB, null);
                }
                controller.Move();
            }
        }