Пример #1
0
    public bool AssignChild(ref AudioDTree nodeIn)
    {
        if (l_children.Contains(nodeIn))
        {
            return(false);
        }

        l_children.Add(nodeIn);
        return(true);
    }
Пример #2
0
    public void BuildAudioStateTree()
    {
        t_audioStateTree = new AudioDTree(StateRef.TREE_ROOT);

        // terrain state, end
        AudioDTree powderRideLeaf = new AudioDTree(StateRef.TERR_POWDER, AudioRef.RIDE_POWDER);
        AudioDTree snowRideLeaf   = new AudioDTree(StateRef.TERR_SNOW, AudioRef.RIDE_SNOW);
        AudioDTree iceRideLeaf    = new AudioDTree(StateRef.TERR_ICE, AudioRef.RIDE_ICE);

        AudioDTree powderTurnLeaf = new AudioDTree(StateRef.TERR_POWDER, AudioRef.TURN_POWDER);
        AudioDTree snowTurnLeaf   = new AudioDTree(StateRef.TERR_SNOW, AudioRef.TURN_SNOW);
        AudioDTree iceTurnLeaf    = new AudioDTree(StateRef.TERR_ICE, AudioRef.TURN_ICE);

        AudioDTree powderSlowLeaf = new AudioDTree(StateRef.TERR_POWDER, AudioRef.SLOW_POWDER);
        AudioDTree snowSlowLeaf   = new AudioDTree(StateRef.TERR_SNOW, AudioRef.SLOW_SNOW);
        AudioDTree iceSlowLeaf    = new AudioDTree(StateRef.TERR_ICE, AudioRef.SLOW_ICE);

        // turn state
        AudioDTree turnStraightBranch = new AudioDTree(StateRef.RIDING);
        AudioDTree turnCarvingBranch  = new AudioDTree(StateRef.CARVING);

        // ground state
        AudioDTree ridingBranch  = new AudioDTree(StateRef.RIDING);
        AudioDTree slowingBranch = new AudioDTree(StateRef.STOPPING);
        AudioDTree stoppedBranch = new AudioDTree(StateRef.STOPPING, AudioRef.NO_AUDIO);

        // airState
        AudioDTree groundedBranch = new AudioDTree(StateRef.GROUNDED);
        AudioDTree airborneBranch = new AudioDTree(StateRef.AIRBORNE, AudioRef.NO_AUDIO);

        slowingBranch.AssignChild(ref powderSlowLeaf);
        slowingBranch.AssignChild(ref snowSlowLeaf);
        slowingBranch.AssignChild(ref iceSlowLeaf);

        turnStraightBranch.AssignChild(ref powderRideLeaf);
        turnStraightBranch.AssignChild(ref snowRideLeaf);
        turnStraightBranch.AssignChild(ref iceRideLeaf);

        turnCarvingBranch.AssignChild(ref powderTurnLeaf);
        turnCarvingBranch.AssignChild(ref snowTurnLeaf);
        turnCarvingBranch.AssignChild(ref iceTurnLeaf);

        ridingBranch.AssignChild(ref turnStraightBranch);
        ridingBranch.AssignChild(ref turnCarvingBranch);

        groundedBranch.AssignChild(ref ridingBranch);
        groundedBranch.AssignChild(ref slowingBranch);
        groundedBranch.AssignChild(ref stoppedBranch);

        t_audioStateTree.AssignChild(ref groundedBranch);
        t_audioStateTree.AssignChild(ref airborneBranch);
    }
Пример #3
0
    public AudioRef GetAudioState()
    {
        AudioRef foundClip = AudioRef.ERROR_CLIP;

        StateRef airState    = c_airMachine.GetCurrentState();
        StateRef rideState   = c_accelMachine.GetCurrentState();
        StateRef turnState   = c_turnMachine.GetCurrentState();
        StateRef groundState = StateRef.TERR_SNOW; // currently always snow

        // obey the order of the tree: air, ground, turn, terre
        AudioDTree currentBranch = t_audioStateTree.GetChild(airState);

        currentBranch = currentBranch.GetChild(rideState);
        currentBranch = currentBranch.GetChild(turnState);
        currentBranch = currentBranch.GetChild(groundState);

        foundClip = currentBranch.GetLeaf();

        return(foundClip);
    }