Esempio n. 1
0
    //Receiving an avatar another user has made
    //Initialize our copy to have the same properties
    private void ProcessAvatarMake(AvatarInfo info)
    {
        Debug.Log("User Made Avatar, initializing");
        Debug.Log("Avatar: " +
                  "{playerID: " + info.playerID +
                  ", viewID: " + info.viewID +
                  ", spawnPosition: " + info.spawnPosition +
                  ", color: " + info.color + "}");
        PhotonView view = PhotonView.Find(info.viewID);

        if (view == null)
        {
            Debug.LogError("Error: No PhotonView Component!");
            return;
        }

        PlayerAvatar newAvatar = view.GetComponent <PlayerAvatar>();

        if (newAvatar == null)
        {
            Debug.LogError("Error: No PlayerAvatar Component!");
            return;
        }

        newAvatar.Initialize(info, null, null);
    }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            var sprites = Sprites.Instance;

            sprites.Load("Sprite", Content.Load <Texture2D>("sprites/Sprite"));

            var entities     = EntityList.Instance;
            var playerAvatar = new PlayerAvatar();

            playerAvatar.Initialize(new Vector2(400, 400));
            entities.AddEntity(playerAvatar);
        }
Esempio n. 3
0
    //Make Avatar
    private void MakeAvatar()
    {
        //make the user avatar/camera
        playerAvatar = objManager.InstantiateOwnedObject("UserAvatar") as GameObject;
        PlayerAvatar avatarComponent = playerAvatar.GetComponent <PlayerAvatar>();

        AvatarInfo avatarProperties = new AvatarInfo(PhotonNetwork.player.ID,
                                                     playerAvatar.GetComponent <PhotonView>().viewID,
                                                     SpawnPosition,
                                                     avatarColor);

        avatarComponent.Initialize(avatarProperties, mainCamera, this);
        portalManager.player = playerAvatar;

        //send a message off so it can be properly initialized
        Debug.Log("Sending Color: " + avatarProperties.color);
        RaiseEventOptions options = new RaiseEventOptions();

        options.Receivers = ReceiverGroup.Others;
        PhotonNetwork.RaiseEvent(UWBNetworkingPackage.ASLEventCode.EV_AVATAR_MAKE, avatarProperties, true, options);
    }