public VoosActor RequestActor(ActorableSearchResult _requestedResult, Vector3 rootSpawnPosition, Quaternion additionalRotation, Vector3 spawnScale) { Quaternion spawnRotation = additionalRotation * _requestedResult.preferredRotation; // NOTE: We could also have additionalScale here, in which case we'd want to multiply it with preferredLocalScale and apply it. // If, for example, the new tool gave you the ability to scale (like it lets you rotate now). if (_requestedResult.renderableReference.assetType == AssetType.Actor || _requestedResult.renderableReference.assetType == AssetType.AssetPack) { return(_requestedResult.actorPrefab.Instantiate(voosEngine, behaviorSystem, rootSpawnPosition, spawnRotation, setupActor => { // IMPORTANT! The setupActor could be a child of the hierarchy! So the // position is not necessarily rootSpawnPosition. setupActor.SetSpawnPosition(setupActor.transform.position); setupActor.SetSpawnRotation(setupActor.transform.rotation); // Post-setup for effect results string pfxId = _requestedResult.pfxId; if (pfxId != null) { setupActor.SetPfxId(pfxId); ParticleEffect pfx = particleEffectSystem.GetParticleEffect(pfxId); if (pfx != null) { setupActor.SetDisplayName(pfx.name); } } string sfxId = _requestedResult.sfxId; if (sfxId != null) { setupActor.SetSfxId(sfxId); SoundEffect sfx = soundEffectSystem.GetSoundEffect(sfxId); if (sfx != null) { setupActor.SetDisplayName(sfx.name); } } })); } else { return(voosEngine.CreateActor(rootSpawnPosition, spawnRotation, actor => { if (_requestedResult.forceConcave) { actor.SetUseConcaveCollider(true); } actor.SetLocalScale(spawnScale); actor.SetDisplayName(_requestedResult.name); actor.SetRenderableUri(_requestedResult.renderableReference.uri); })); } }
public void CopySelectedParticleEffect() { ParticleEffect sourceEffect = particleEffectSystem.GetParticleEffect(selectedParticleEffectId); string id = System.Guid.NewGuid().ToString(); string name = sourceEffect.name + " copy"; ParticleEffect copiedEffect = new ParticleEffect(id, name, sourceEffect.content); particleEffectSystem.PutParticleEffect(copiedEffect); RepopulateList(); SelectParticleEffect(copiedEffect.id); }
private void Update() { string pfxId = (string)editor.data; if (!string.IsNullOrEmpty(pfxId) && pfxSystem.GetParticleEffect(pfxId) == null) { pfxId = null; } dropdown.onValueChanged.RemoveListener(OnDropdownValueChanged); dropdown.value = pfxIdValues.IndexOf(pfxId); dropdown.onValueChanged.AddListener(OnDropdownValueChanged); }
private void UpdateFields() { if (!visualsTabUI.colorField.IsBeingEdited()) { visualsTabUI.colorField.SetColor(actor.GetTint()); } visualsTabUI.emitLightToggle.onValueChanged.RemoveListener(OnEmitLightToggleChanged); visualsTabUI.emitLightToggle.isOn = actor.GetLightSettings().range > 0; visualsTabUI.emitLightToggle.onValueChanged.AddListener(OnEmitLightToggleChanged); visualsTabUI.particleEffectName.text = actor.GetPfxId() != null? pfxSystem.GetParticleEffect(actor.GetPfxId())?.name : null; visualsTabUI.soundEffectName.text = actor.GetSfxId() != null? sfxSystem.GetSoundEffect(actor.GetSfxId())?.name : null; }