예제 #1
0
        public static void InitializeMaps()
        {
            playerIconObj = RegisterDynamicObjectWithUI("PlayerIcon", -1, Vector3.zero, Vector3.forward, "Player", "PlayerIcon", "PlayerIcon", null, null);
            playerIconObj.SetWorldPositionGetter(
                () => {
                return(GameManager.playerExists ? GameManager.playerActor.GetPosition() : Vector3.zero);
                // Transform t = UIManager.GetMainCamera().transform;
                // return t == null ? Vector3.zero : t.position;
            }
                );
            playerIconObj.SetWorldForwardGetter(
                () => {
                return(GameManager.playerExists ? GameManager.playerActor.GetForward() : Vector3.forward);

                // Transform t = UIManager.GetMainCamera().transform;
                // return t == null ? Vector3.forward : t.forward;
            }
                );

            playerIconObj.ShowMapType(UIMapsObject.ShowType.MainMap, true);
            playerIconObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true);



            string[] directions = new string[] { "N", "S", "E", "W" };

            float distanceValue = 99999;

            Vector3[] dirs = new Vector3[] {
                Vector3.forward *distanceValue,
                -Vector3.forward *distanceValue,
                      Vector3.right *distanceValue,
                -Vector3.right *distanceValue
            };

            for (int i = 0; i < 4; i++)
            {
                Vector3 d = dirs[i];

                UIMapsObject regObj = RegisterDynamicObjectWithUI(
                    "Direction " + directions[i], -(i + 2), Vector3.zero, d,
                    null, "DirectionIcon", null, "DirectionIcon", null
                    );

                regObj.SetWorldPositionGetter(
                    () => {
                    return((GameManager.playerExists ? GameManager.playerActor.GetPosition() : Vector3.zero) + d);

                    // Transform t = UIManager.GetMainCamera().transform;
                    // if (t == null) return d;
                    // return t.position + d;
                }
                    );
                regObj.SetMarkerInitializer((m) => (m.mainGraphic as UIText).SetText(directions[i]));

                regObj.ShowMapType(UIMapsObject.ShowType.Compass, true);
                regObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true);
            }
        }
예제 #2
0
 void RegisterWithUI()
 {
     registeredUIObj = UIMaps.RegisterDynamicObjectWithUI(gameObject.name, GetInstanceID(), transform.position, transform.forward, message, miniMapIconName, mainMapIconName, compassIconName, worldViewIconName);
     registeredUIObj.SetWorldPositionGetter(() => transform.position);
     registeredUIObj.SetWorldForwardGetter(() => transform.forward);
 }