コード例 #1
0
ファイル: ParcelScene.cs プロジェクト: useit015/explorer
        public virtual bool IsInsideSceneBoundaries(Vector2Int gridPosition, float height = 0f)
        {
            if (parcels.Count == 0)
            {
                return(false);
            }

            float heightLimit = metricsController.GetLimits().sceneHeight;

            if (height > heightLimit)
            {
                return(false);
            }

            return(parcels.Contains(gridPosition));
        }
コード例 #2
0
ファイル: ParcelScene.cs プロジェクト: menduz/explorer
        public virtual void SetData(LoadParcelScenesMessage.UnityParcelScene data)
        {
            this.sceneData = data;

            contentProvider          = new ContentProvider();
            contentProvider.baseUrl  = data.baseUrl;
            contentProvider.contents = data.contents;
            contentProvider.BakeHashes();

            state = State.WAITING_FOR_INIT_MESSAGES;
            RefreshName();

            parcels.Clear();
            for (int i = 0; i < sceneData.parcels.Length; i++)
            {
                parcels.Add(sceneData.parcels[i]);
            }

            if (useBlockers)
            {
                blockerHandler = new BlockerHandler();
            }

            if (DCLCharacterController.i != null)
            {
                gameObject.transform.position = DCLCharacterController.i.characterPosition.WorldToUnityPosition(Utils.GridToWorldPosition(data.basePosition.x, data.basePosition.y));
            }

#if UNITY_EDITOR
            //NOTE(Brian): Don't generate parcel blockers if debugScenes is active and is not the desired scene.
            if (SceneController.i.debugScenes && SceneController.i.debugSceneCoords != data.basePosition)
            {
                SetSceneReady();
                return;
            }
#endif
            blockerHandler?.SetupBlockers(parcels, metricsController.GetLimits().sceneHeight, this.transform);

            if (isTestScene)
            {
                SetSceneReady();
            }
        }