Exemple #1
0
    void Update()
    {
        if (alternativMUDClient == null || alternativMUDClient.dirty) {
            alternativMUDClient = GameObject.FindWithTag ("AlternativMUDClient").GetComponent<AlternativMUDClient> ();
            if (alternativMUDClient != null) {
                alternativMUDClient.AddListener (AlternativeMUDClasses.MSG_U3DM_SCENE_ENTER_FAILED, SceneEnterFailed);
                alternativMUDClient.AddListener (AlternativeMUDClasses.MSG_U3DM_SCENE_ENTER_SUCCEEDED, SceneEnterSucceeded);
            }
        }

        if (player == null) {
            player = GameObject.FindGameObjectWithTag (Tags.PLAYER);
        }

        if (sceneChangeEnabled) {
            if(labelFader != null) {
                if(failed) labelFader.Show (failMessage+" ("+failMsgServer+")");
                else labelFader.Show (message, 0.5f);
            }

            if (!changingScene &&  Input.GetButton ("Jump")) {
                Debug.Log ("Changing scene!");
                changingScene = true;
                if(alternativMUDClient != null) alternativMUDClient.SendMessage (AlternativeMUDClasses.CMD_U3DM_CHANGE_SCENE, "{\"sceneName\":\"" + nextSceneName + "\"}");
                else Debug.LogWarning("Cannot change scene: alternativMUDClient is null");
                Debug.Log ("Sent request!");
            }
        }

        if (executeInUpdate.Count != 0) {
            executeInUpdate.Dequeue()();
        }
    }
    void Start()
    {
        minPacketInterval = 1f / packetsPerSecond;
        sentPackets = 0;
        receivedPackets = 0;

        alternativMUDClientScript = GetComponent<AlternativMUDClient> ();
        alternativMUDClientScript.AddListener (AlternativeMUDClasses.MSG_U3DM_SCENE_ENTER_SUCCEEDED, SceneEnterSuccess);
        alternativMUDClientScript.AddListener (AlternativeMUDClasses.MSG_U3DM_ENEMY_LEFT, EnemyLeft);
        alternativMUDClientScript.AddListener (AlternativeMUDClasses.MSG_U3DM_ENEMY_ARRIVED, EnemyArrived);
        if (playerChildren == null) {
            playerChildren = GameObject.FindWithTag ("PlayerChildren");
            if(playerChildren == null) Debug.LogError("Could not find #PlayerChildren");
        }

        if (trialUmaRecipe != null && playerChildren != null && trialUmaRecipe.Length > 0) {
            UMADynamicAvatar avatar = LoadUMA (trialUmaRecipe, playerChildren.transform, "Player", true);
            avatar.gameObject.tag = "PlayerContainer";
        }
    }
 // Use this for initialization
 void Start()
 {
     alternativMudClient = GetComponent<AlternativMUDClient> ();
     alternativMudClient.AddListener (AlternativeMUDClasses.MSG_U3DM_SCENE_ENTER_SUCCEEDED, SceneEnterSucceeded);
     alternativMudClient.AddListener (AlternativeMUDClasses.MSG_U3DM_VARIABLE_CHANGED, VariableChanged);
 }