Пример #1
0
 void SaveSpawnPosition(EventParam param)
 {
     // saves the triangle index of the clicked mesh (game object)
     index = param.getIntParam();
     mesh  = param.getGameObjectParam();
     EventManager.TriggerEvent("LobbyHintMessage", new EventParam("Un point de départ à bien été sélectionné sur le terrain."));
 }
Пример #2
0
    void SwitchBetweenImmersionAndModel(EventParam param)
    {
        subTerrainCount = selectedTerrain.transform.childCount;
        // param = 0 ->  switch from immersion to model mode
        if (param.getIntParam() == 0)
        {
            // save player position for later use
            playerLastPosition = player.transform.localPosition;
            // set player position
            player.transform.localPosition = new Vector3(0f, -1.3f, -0.9f);

            // deactivate teleport terrain in model mode
            teleportTerrain.SetActive(false);

            // set terrain scale to 1/100
            transform.localScale    = scale1o100;
            transform.localPosition = new Vector3(1, 0.9f, 0);

            // activate the interactable script to allow terrain transform modification
            transform.GetComponent <Interactable>().enabled      = true;
            transform.GetComponent <Throwable>().attachmentFlags = Hand.AttachmentFlags.ParentToHand;
        }
        // param = 1 -> switch from model to immersion mode
        else
        {
            // activate teleport terrain in immersion mode
            teleportTerrain.SetActive(true);

            // set terrain scale to 1
            transform.localScale       = scale1o1;
            transform.localPosition    = Vector3.zero;
            transform.localEulerAngles = Vector3.zero;

            // restore previous player position on the terrain
            player.transform.localPosition = playerLastPosition;

            // deactivate the interactable script and deactivate terrain movements
            transform.GetComponent <Interactable>().enabled      = false;
            transform.GetComponent <Throwable>().attachmentFlags = Hand.AttachmentFlags.DetachFromOtherHand; // this flag don't allow movement
        }
    }
    void SwitchBetweenImmersionAndModel(EventParam intParam)
    {
        if (intParam.getIntParam() == 0)
        {
            // switch from imersion to model mode

            StartCoroutine("CheckCoroutine"); // start updating element size
        }
        else
        {
            // switch from model to imersion mode

            StopCoroutine("CheckCoroutine"); // stop updating element size

            // reset elements sizes
            for (int i = 0; i < measureElementParents.Count; i++)
            {
                ResetScale(measureElementParents[i].transform);
            }
        }
    }
 void ShowHideModelElements(EventParam intParam)
 {
     // if intParam = 0 we want to activate the model elements and hide them otherwise
     modelEnvironment.SetActive(intParam.getIntParam() == 0);
 }