private void OnSelectActor(ActorData actor) { if (actor != null && actor.CelestialBodyRef != null) { _currentTarget = actor.CelestialBodyRef; } else { _currentTarget = null; } RefreshView(); }
public void DestroyActor(ActorData actor) { if (actor != null && actor.GameObjectRef != null) { if (OnBeforeDestroyActorEvent != null) { OnBeforeDestroyActorEvent(actor); } Actors.Remove(actor); Destroy(actor.GameObjectRef); } }
private void OnClick(Vector2 pointerScreenPosition, Vector2 lastPointerPosition, int buttonIndex) { var ray = Camera.main.ScreenPointToRay(pointerScreenPosition); RaycastHit hit; ActorData actor = null; if (Physics.Raycast(ray, out hit)) { var cb = hit.collider.GetComponentInParent <CelestialBody>(); if (cb != null) { actor = ActorsManager.Instance.FindCreatedActor(cb); } } DemoSceneManager.Instance.SelectActor(actor); }
private void OnSelect(ActorData actor) { if (actor != null && actor.TransformRef != null && actor.CelestialBodyRef != null) { _scaler.CelestialBodyRef = actor.CelestialBodyRef; gameObject.SetActive(true); transform.SetParent(actor.TransformRef); transform.localPosition = new Vector3(); } else { transform.SetParent(null); gameObject.SetActive(false); _scaler.CelestialBodyRef = null; } }