Esempio n. 1
0
        private void _ReadAsync(TableStreamAsyncReader reader)
        {
            reader.Blob("SceneChunkData", () =>
            {
                reader.ReadKeyString("Name", name => { this.Name = name; });

                this.Objects = new List <SceneObjectData>();
                reader.ReadKeyNumber("Objects", count =>
                {
                    for (var i = 0; i < count; ++i)
                    {
                        reader.ReadKeyByte("Type", type =>
                        {
                            SceneObjectData objectData = null;
                            switch ((SceneObjectType)type)
                            {
                            case SceneObjectType.PREFAB:
                                objectData = new ScenePrefabData();
                                break;

                            case SceneObjectType.LIGHTMODIFIER:
                                objectData = new SceneLightModifierData();
                                break;

                            default:
                                objectData = new SceneObjectData();
                                break;
                            }
                            objectData._ReadAsync(reader);
                            this.Objects.Add(objectData);
                        });
                    }
                });
            });
        }
Esempio n. 2
0
 public SceneObject(SceneObjectData objectData, GameObject objectRoot)
 {
     this.objectData = objectData;
     this.objectRoot = objectRoot;
     this.objectRoot.transform.localPosition = new Vector3(objectData.PositionX, objectData.PositionY, objectData.PositionZ);
     this.objectRoot.transform.localRotation = new Quaternion(objectData.OrientationX, objectData.OrientationY, objectData.OrientationZ, objectData.OrientationW);
     this.objectRoot.transform.localScale = new Vector3(objectData.ScaleX, objectData.ScaleY, objectData.ScaleZ);
 }
Esempio n. 3
0
 public ScenePrefab(SceneObjectData objectData, GameObject objectRoot) : base(objectData, objectRoot)
 {
     if (SceneLevel.IsInEdit())
     {
         var prefabObject = SceneLevel.GetOrAddComponent <PrefabObject>(this.ObjectRoot);
         prefabObject.PrefabPath = (this.ObjectData as ScenePrefabData).Path;
     }
 }
Esempio n. 4
0
        public SceneLightModifier(SceneObjectData objectData, GameObject objectRoot) : base(objectData, objectRoot)
        {
            var modifierData = objectData as SceneLightModifierData;

            this.targetIntensity = modifierData.Intensity;
            this.targetColor     = new Color(modifierData.Red, modifierData.Green, modifierData.Blue);

            if (SceneLevel.IsInEdit())
            {
                var modifierObject = SceneLevel.GetOrAddComponent <LightModifierObject>(this.ObjectRoot);
                modifierObject.Intensity = this.targetIntensity;
                modifierObject.Color     = this.targetColor;
            }
        }
Esempio n. 5
0
 public SceneGroup(SceneObjectData objectData, GameObject objectRoot) : base(objectData, objectRoot)
 {
 }