public override void OnLoad(ISVR_MetaData.ActorRecord record)
        {
            if (record._components.Count > 0)
            {
                _data = record._components[0]._data;//TODO account for multiple components, for goodness sake
            }
            Renderer ren = GetComponent <Renderer>();

            if (ren != null)
            {
                if (_data != null)
                {
                    var capsuleData = _data.BeACapsuleData;
                    if (capsuleData != null && capsuleData.Length > 0)
                    {
                        if (capsuleData[0] != null)
                        {
                            ren.material.color = capsuleData[0]._color;
                        }
                        else
                        {
                            Debug.LogWarning("null color at beAcapsuleData[0] in ActorComnponentBeACapsule.OnLoad " + name);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("null or empty capsuleData in ActorComnponentBeACapsule.OnLoad " + name);
                    }
                }
                else
                {
                    Debug.LogWarning("null data in ActorComnponentBeACapsule.OnLoad " + name);
                }
            }
        }
Exemple #2
0
        protected override void Awake()
        {
            base.Awake();

            if (_data == null)
            {
                _data = new ActorComponent.Data();
                _data.BuildablePartData = new Data[] { new Data() };
            }
        }
Exemple #3
0
            public ActorComponentRecord(ActorComponent component)
            {
                _type = component.GetType().Name;
                // _name = component.GetName();
                _id = component.GetID();
                // _parent = component.GetParentID();
                // _parentName = component.GetParentName();

                _data = component.GetData();
            }
        protected new void Awake()
        {
            if (_data == null)
            {
                _data           = new ActorComponent.Data();
                _data.StageData = new Data[] { new Data() };
            }

            //TODO, stash the data required for this 'actor' to load its 'workspace'
            _data.StageData[0]._url = "caca";
        }
        protected override void Awake()
        {
            base.Awake();

            if (_data == null)
            {
                _data = new ActorComponent.Data();
                _data.BeACapsuleData = new Data[] { new Data() };
            }
            Renderer ren = GetComponent <Renderer>();

            if (ren != null)
            {
                _data.BeACapsuleData[0]._color = ren.material.color;
            }
        }
        public void OnLoad(ISVR_MetaData.ActorRecord record)
        {
            //this is super special
            //ActorStage saves and loads as a nested, readonly workspace

            if (record._components.Count > 0)
            {
                _data = record._components[0]._data;//TODO account for multiple components, for goodness sake
            }
            if (_data != null)
            {
                var stageData = _data.StageData;
                if (stageData != null && stageData.Length > 0)
                {
                    if (stageData[0] != null)
                    {
                        //should involve very little overhead, as this actor is already a "workspace"
                        //perhaps as simple as just calling my, LoadWorkspace right here
                        var isvrPath = stageData[0]._url;
                        LoadWorkspace(isvrPath);

                        //put myself in the 'middle' of the presentation workspace
                        transform.position   = Vector3.zero;
                        transform.rotation   = Quaternion.identity;
                        transform.localScale = Vector3.one;

                        //TODO: maybe need to switch-on some read-only properties
                        //to ensure that neither this actor (nor its parts) can be selected, mutated, deleted
                        //other than by replacing it with another ActorStage.
                    }
                    else
                    {
                        Debug.LogWarning("null color at stageData[0] in ActorStage.OnLoad " + name);
                    }
                }
                else
                {
                    Debug.LogWarning("null or empty stageData in ActorStage.OnLoad " + name);
                }
            }
            else
            {
                Debug.LogWarning("null data in ActorStage.OnLoad " + name);
            }
        }