示例#1
0
    public void CmdSetSoundObjectDrawingSequence(NetworkInstanceId objid, bool val)
    {
        GameObject      obj  = NetworkServer.objects [objid].gameObject;
        SoundObjectActs acts = obj.GetComponent <SoundObjectActs> ();

        acts.setDrawingSequence(val);
    }
示例#2
0
    public void CmdToggleSoundObjectLoopingState(NetworkInstanceId objid)
    {
        GameObject      obj  = NetworkServer.objects [objid].gameObject;
        SoundObjectActs acts = obj.GetComponent <SoundObjectActs> ();

        acts.toggleLooping();
    }
示例#3
0
    public void CmdSetSoundObjectRecorder(NetworkInstanceId objid, bool state)
    {
        GameObject      obj  = NetworkServer.objects [objid].gameObject;
        SoundObjectActs acts = obj.GetComponent <SoundObjectActs> ();

        acts.setRecorder(netId, state);
    }
示例#4
0
    public void CmdQuitLineForOwner(NetworkInstanceId objid)
    {
        GameObject      obj  = NetworkServer.objects [objid].gameObject;
        SoundObjectActs acts = obj.GetComponent <SoundObjectActs> ();

        acts.soundOwnerOut(netId);
    }
示例#5
0
    public void CmdDestroyObject(NetworkInstanceId objid)
    {
        NetworkIdentity netid = NetworkServer.objects [objid];
        GameObject      obj   = netid.gameObject;
        SoundObjectActs acts  = obj.GetComponent <SoundObjectActs> ();

        if (acts.m_looping)
        {
            CmdToggleSoundObjectLoopingState(objid);
        }
        NetworkServer.Destroy(NetworkServer.objects [objid].gameObject);
    }
示例#6
0
    /// <summary>
    /// Spawn word and non verbal object
    /// </summary>
    /// <param name="sound">Wordinfo. Spawn as non verbal if sound.word equals ""</param>
    /// <param name="isNewObject">Will have authority if it is newly generated.</param>
    public void spawnSoundObject(WordInfo sound, bool isNewObject)
    {
        GameObject soundobj;

        if (string.IsNullOrEmpty(sound.word))
        {
            soundobj = (GameObject)Instantiate(nonVerbalPrefab);
        }
        else
        {
            soundobj = (GameObject)Instantiate(wordPrefab);
        }
        soundobj.transform.position = sound.pos;
        soundobj.transform.rotation = sound.rot;
        SoundObjectActs soundscript = soundobj.GetComponent <SoundObjectActs> ();

        if (soundscript is WordActs)
        {
            ((WordActs)soundscript).m_wordstr = sound.word;
            ((WordActs)soundscript).m_scale   = sound.scale;
        }
        soundscript.m_serverFileName = sound.clipfn;
        if (sound.looping)
        {
            soundscript.m_looping = true;
            soundscript.m_sequencer.playtriggers    = sound.playerTriggers;
            soundscript.m_sequencer.loadedFromScene = true;
            if (sound.scrubs != null)
            {
                soundscript.m_sequencer.scrubs = sound.scrubs;
            }
            soundscript.m_sequencer.path = sound.path;
        }
        if (isNewObject)
        {
            soundscript.m_newSpawn = true;
            soundscript.m_creator  = netId.Value;
            Debug.Log(connectionToClient.connectionId);
            NetworkServer.SpawnWithClientAuthority(soundobj, connectionToClient);
        }
        else
        {
            NetworkServer.Spawn(soundobj);
        }
    }
示例#7
0
    public void CmdActivateTimedDestroy(NetworkInstanceId objid)
    {
        NetworkIdentity netid         = NetworkServer.objects [objid];
        GameObject      obj           = netid.gameObject;
        TimedDestroy    destroyscript = obj.GetComponent <TimedDestroy> ();

        if (destroyscript)
        {
            SoundObjectActs acts = obj.GetComponent <SoundObjectActs> ();
            if (acts.m_looping)
            {
                CmdToggleSoundObjectLoopingState(objid);
            }
            destroyscript.RpcActivate();
        }
        else
        {
            CmdDestroyObject(objid);
        }
    }
示例#8
0
    public void CmdAssignObjectAuthority(NetworkInstanceId netInstanceId)
    {
        // Assign authority of this objects network instance id to the client
        bool            success = false;
        GameObject      obj     = NetworkServer.objects [netInstanceId].gameObject;
        SoundObjectActs acts    = obj.GetComponent <SoundObjectActs> ();

        // Debug.Log ("Assign authority for " + netId);
        if (acts == null || acts.m_recorder == 0)
        {
            success = NetworkServer.objects [netInstanceId].AssignClientAuthority(connectionToClient);
        }
        if (success)
        {
            Debug.Log("Successfully assigned authority to " + netInstanceId);
        }
        else
        {
            Debug.Log("could not assign authority");
        }
    }
示例#9
0
 void Awake()
 {
     m_acts = gameObject.GetComponent <SoundObjectActs> ();
 }