예제 #1
0
        internal PlayerSceneGraph(HolofunkSceneGraph parent, int playerIndex, int channel)
            : base()
        {
            m_parent = parent;

            m_playerIndex = playerIndex;
            m_channel = channel;

            m_averageLevelRatio = new FloatAverager(15); // don't flicker face changes too fast
            m_averageLevelRatio.Update(0); // make sure it's initially zero

            // Center the textures.
            Vector2 origin = new Vector2(0.5f);

            RootNode = new GroupNode(parent.RootNode, Transform.Identity, "Player #" + playerIndex);

            m_headGroup = new GroupNode(RootNode, Transform.Identity, "Head group");

            m_headNode = new SpriteNode(
                m_headGroup,
                "Head",
                PlayerIndex == 0 ? parent.Content.HollowOneOval : parent.Content.HollowTwoOval);

            m_headNode.Origin = new Vector2(0.5f, 0.5f);
            // semi-transparent heads, hopefully this will make them seem "less interactive"
            m_headNode.Color = new Color(0.7f, 0.7f, 0.7f, 0.7f);
            m_headNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.SecondTexture);
            m_headNode.SecondaryTexture = parent.Content.Dot;

            // Make a faded mike signal that sticks to the head.
            m_headMikeSignal = new TrackNode(
                m_headGroup,
                new Transform(Vector2.Zero, new Vector2(MagicNumbers.LoopieScale)),
                "MikeSignal",
                parent.Content,
                -1,
                null,
                true,
                () => Audio.LevelRatio(Channel),
                () => new Color(63, 0, 0, 63),
                () => Color.White,
                () => 0,
                () => 0,
                () => new Color(127, 0, 0, 127),
                () => 1f);

            m_leftHandSceneGraph = new PlayerHandSceneGraph(this, false);
            m_rightHandSceneGraph = new PlayerHandSceneGraph(this, true);
        }
        public PlayerHandSceneGraph(PlayerSceneGraph parent, bool isRight)
        {
            m_parent = parent;
            m_isRight = isRight;

            RootNode = new GroupNode(parent.RootNode, Transform.Identity, isRight ? "Left Hand" : "Right Hand");

            m_handGroup = new GroupNode(RootNode, Transform.Identity, isRight ? "Right Group" : "Left Group");

            m_handMikeSignal = new TrackNode(
                m_handGroup,
                new Transform(Vector2.Zero, new Vector2(MagicNumbers.LoopieScale)),
                "MikeSignal",
                parent.Content,
                -1,
                null,
                true,
                () => parent.Audio.LevelRatio(parent.Channel) * 0.5f,
                () => m_handMikeSignalColor,
                () => Color.White,
                // TODO: revive beat meter on current recording
                () => new Duration<Sample>(0),
                () => 0,
                () => m_handMikeSignalColor,
                () => 1f);

            m_handNode = new SpriteNode(m_handGroup, isRight ? "Right Hand" : "Left Hand", null);
            m_handNode.Origin = new Vector2(0.5f);
            m_handNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.TextureMirrored);

            m_effectLabelGroup = new GroupNode(m_handGroup, Transform.Identity, "Effect label group");
            m_effectLabelGroup.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);

            m_effectLabels = MakeEffectLabels(m_effectLabelGroup);

            m_armPoseLabel = new TextNode(RootNode, "Elbow label");
            m_armPoseLabel.Alignment = isRight ? Alignment.TopLeft : Alignment.TopRight;
            m_armPoseLabel.SetSecondaryViewOption(SecondaryViewOption.Hidden);
        }