public override void OnLoad(ISVR_MetaData.ActorRecord record) { //Debug.Log("OnLoad " + record._id._name ); _actorType = ActorType.Unknown; if (Enum.IsDefined(typeof(ActorType), record._actorType)) { _actorType = (ActorType)Enum.Parse(typeof(ActorType), record._actorType); } _record = new ISVR_MetaData.ActorRecord(record); SetID(_record._id); EventManager.TriggerEvent(new EventActorLoaded(this)); //my unity GameObject name name = _record._id._name; // name += "__Loaded"; //let any actorcomponents on this gameobject also do a load var actorComponents = GetComponents <ActorComponent>(); foreach (var actorComponent in actorComponents) { if (actorComponent != this) { actorComponent.OnLoad(record); } } }
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); } } }
Actor PrefabFromActorRecord(ISVR_MetaData.ActorRecord record) { var prefabData = new EventActorPrefabFromID.Data(record._prefabKey); EventManager.TriggerEvent(new EventActorPrefabFromID(prefabData)); return(prefabData.Prefab); }
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); } }
public override void OnLoad(ISVR_MetaData.ActorRecord record) { throw new NotImplementedException(); }
public virtual void OnLoad(ISVR_MetaData.ActorRecord record) { }