Exemple #1
0
            public void ShowDialog(BattlefieldObject obj, string text, float duration)
            {
                if (characterDialogText)
                {
                    characterDialogText.text = text;
                }

                characterDialogDuration = duration;
                if (characterDialogDuration > 0 && obj != null)
                {
                    characterDialog.gameObject.SetActive(true);
                    Vector3 worldPosition    = obj.GetPosition("head");
                    Vector2 ViewportPosition = Camera.main.WorldToViewportPoint(worldPosition);
                    characterDialog.anchorMin          = ViewportPosition;
                    characterDialog.anchorMax          = ViewportPosition;
                    characterDialog.anchoredPosition3D = Vector3.zero;
                }
                else
                {
                    characterDialogDuration = 0;
                    characterDialog.gameObject.SetActive(false);
                }
            }
Exemple #2
0
                void UpdatePostion(bool lerp = true)
                {
                    BattlefieldObject battle_obj    = (BattlefieldObject)(followed.Target);
                    Vector3           worldPosition = battle_obj.GetPosition("hitpoint");

                    if ((type & 2) != 0)
                    {
                        worldPosition.y -= 0.5f;
                    }

                    Vector2 ViewportPosition = Camera.main.WorldToViewportPoint(worldPosition);

                    if (lerp)
                    {
                        rectTransform.anchorMin = Vector2.Lerp(rectTransform.anchorMin, ViewportPosition, Time.deltaTime * selector_speed);
                        rectTransform.anchorMax = Vector2.Lerp(rectTransform.anchorMax, ViewportPosition, Time.deltaTime * selector_speed);
                    }
                    else
                    {
                        rectTransform.anchorMin = ViewportPosition;
                        rectTransform.anchorMax = ViewportPosition;
                    }
                    rectTransform.anchoredPosition3D = Vector3.zero;
                }