| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | public class StickersController : MonoBehaviour |
| | 4 | | { |
| | 5 | | private StickersFactory stickersFactory; |
| | 6 | |
|
| 292 | 7 | | private void Awake() { stickersFactory = Resources.Load<StickersFactory>("StickersFactory"); } |
| | 8 | |
|
| | 9 | | public void PlayEmote(string id) |
| | 10 | | { |
| 0 | 11 | | if (stickersFactory == null || !stickersFactory.TryGet(id, out GameObject prefab)) |
| 0 | 12 | | return; |
| | 13 | |
|
| 0 | 14 | | GameObject emoteGameObject = Instantiate(prefab); |
| 0 | 15 | | emoteGameObject.transform.position += transform.position; |
| 0 | 16 | | FollowObject emoteFollow = emoteGameObject.AddComponent<FollowObject>(); |
| 0 | 17 | | emoteFollow.target = transform; |
| 0 | 18 | | emoteFollow.offset = prefab.transform.position; |
| 0 | 19 | | } |
| | 20 | | } |