Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIFollow.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
3
4public class UIFollow : MonoBehaviour
5{
6 public Transform target;
7
8 public Vector3 fixPos;
9
10 public bool followPos;
11
12 public Func<bool> endCondition;
13
14 public void SetTarget(Transform _trans)
15 {
16 target = _trans;
17 }
18
19 public void LateUpdate()
20 {
21 if (followPos)
22 {
23 GameObject go = base.gameObject;
25 {
26 if (go != null)
27 {
28 base.transform.Rect().anchoredPosition = Camera.main.WorldToScreenPoint(fixPos) / BaseCore.Instance.uiScale;
29 }
30 });
31 }
32 else if (!target || !target.gameObject.activeSelf || (endCondition != null && endCondition()))
33 {
34 UnityEngine.Object.DestroyImmediate(base.gameObject);
35 }
36 else
37 {
38 base.transform.position = target.position + fixPos;
39 }
40 }
41}
virtual float uiScale
Definition: BaseCore.cs:46
static BaseCore Instance
Definition: BaseCore.cs:11
List< Action > actionsLateUpdate
Definition: BaseCore.cs:29
bool followPos
Definition: UIFollow.cs:10
void SetTarget(Transform _trans)
Definition: UIFollow.cs:14
void LateUpdate()
Definition: UIFollow.cs:19
Vector3 fixPos
Definition: UIFollow.cs:8
Transform target
Definition: UIFollow.cs:6
Func< bool > endCondition
Definition: UIFollow.cs:12