/// <summary> /// Добавить перемеение на площадку /// </summary> /// <param name="actor">GameObject префаба</param> private void InstanceDirection(string holder, InstanceType type) { GameObject prefab; if (type == InstanceType.SimpleDirection) { prefab = instancePrefabs[4]; } else { prefab = instancePrefabs[5]; } DirectionOriginCommandButton directionCommandButton = Instantiate(prefab, Vector3.zero - Vector3.forward, Quaternion.identity).GetComponent <DirectionOriginCommandButton>(); SubscribingToAnEvent(directionCommandButton); directionCommandButton.ButtonCliccked += menuController.AllToDefaultExcludeThis; directionCommandButton.ObjectDeleted += UnsubscribingToAnEvent; foreach (var pointer in directionCommandButton.pointers) { SubscribingToAnEvent(pointer); pointer.ButtonCliccked += menuController.AllToDefaultExcludeThis; pointer.ObjectDeleted += UnsubscribingToAnEvent; } directionCommandButton.pointers[1].transform.parent = null; ReturnToDefaultState(); directionCommandButton.SetOptions(holder); }
/// <summary> /// Добавить перемеение на площадку /// </summary> /// <param name="actor">GameObject префаба</param> public void InstanceDirection(GameObject directionPrefab) { DirectionOriginCommandButton directionCommandButton = Instantiate(directionPrefab, Vector3.zero - Vector3.forward, Quaternion.identity).GetComponent <DirectionOriginCommandButton>(); SubscribingToAnEvent(directionCommandButton); directionCommandButton.ButtonCliccked += menuController.AllToDefaultExcludeThis; directionCommandButton.ObjectDeleted += UnsubscribingToAnEvent; foreach (var pointer in directionCommandButton.pointers) { SubscribingToAnEvent(pointer); pointer.ButtonCliccked += menuController.AllToDefaultExcludeThis; pointer.ObjectDeleted += UnsubscribingToAnEvent; } directionCommandButton.pointers[1].transform.parent = null; ReturnToDefaultState(); }