예제 #1
0
    public void SetActivePlayer(string playerId)
    {
        if (_activeAvatarController != null)
        {
            _activeAvatarController.ActivePlayer = false;
        }

        _activeAvatarController = _pieces.FirstOrDefault(p => p.name == playerId).GetComponent<IAvatarController>();
        _activeAvatarController.ActivePlayer = true;
    }
예제 #2
0
        private void CreateRemotePlayerForLocalPlayer()
        {
            Debug.Log("Will create Remote Player for Local Player.");

            IAvatar avatar = _avatarService.GetMain();

            if (_mainAvatarController == null)
            {
                _mainAvatarController = avatar.AvatarController;
            }

            _infra.CreateRemotePlayer();
            _infra.RegisterMainAvatar(avatar.AvatarID);
        }
        void IMultiplayerNetworkSystem.CreateRemotePlayerForLocalPlayer(NetworkArgs args)
        {
            Debug.Log("Will create Remote Player for Local Player.");

            IAvatar avatar = _avatarService.GetMain();

            if (_mainAvatarController == null)
            {
                _mainAvatarController = avatar.AvatarController;
            }

            _infra.RegisterMainAvatar(avatar.AvatarID);
            _infra.CreateRemotePlayer(args);
        }
예제 #4
0
 void IAvatar.SetAvatarController(IAvatarController controller)
 {
     _hasAvatarController = controller != null;
     _avatarController    = controller;
 }
        public AvatarControllerTests()
        {
            m_avatar = new Avatar("", 0, "Pingu", 0, Vector2.Zero, Vector2.One);

            m_avatarController = new AvatarController(m_avatar);
        }
        public AvatarControllerTests()
        {
            m_avatar = new Avatar("", 0, "Pingu", 0, Vector2.Zero, Vector2.One);

            m_avatarController = new AvatarController(m_avatar);
        }
예제 #7
0
    public void CreateGamePieces(string player1Id, string player2Id)
    {
        _pieces = new GameObject[2];

        var cat = Instantiate(CatPrefab);
        cat.name = player1Id;
        _pieces[0] = cat;
        MovePlayerToTile(player1Id, 0, 0);
        _activeAvatarController = cat.GetComponent<IAvatarController>();
        _activeAvatarController.ActivePlayer = true;

        var mouse = Instantiate(MousePrefab);
        mouse.name = player2Id;
        _pieces[1] = mouse;
        MovePlayerToTile(player2Id, NumberOfTilesX -1, NumberOfTilesY - 1);
    }