Exemplo n.º 1
0
    //Register's minimap objects here
    public MapObject RegisterMapObject(GameObject owner, MiniMapEntity mme)
    {
        GameObject curMGO = Instantiate(iconPref);
        MapObject  curMO  = curMGO.AddComponent <MapObject> ();

        curMO.SetMiniMapEntityValues(this, mme, owner, mapCamera, miniMapPanel);
        ownerIconMap.Add(owner, curMGO);
        return(owner.GetComponent <MapObject>());
    }
    void OnEnable()
    {
        miniMapController = GameObject.Find("CanvasMiniMap").GetComponent <MiniMapController> ();
        mme                  = new MiniMapEntity();
        mme.icon             = icon;
        mme.rotation         = initialIconRotation;
        mme.size             = size;
        mme.upAxis           = upAxis;
        mme.rotateWithObject = rotateWithObject;
        mme.clampInBorder    = clampIconInBorder;
        mme.clampDist        = clampDistance;

        mmo = miniMapController.RegisterMapObject(this.gameObject, mme);
    }
Exemplo n.º 3
0
 public void SetMiniMapEntityValues(MiniMapController controller, MiniMapEntity mme, GameObject attachedGO, Camera renderCamera, GameObject parentPanelGO)
 {
     linkedMiniMapEntity = mme;
     owner             = attachedGO;
     mapCamera         = renderCamera;
     panelGO           = parentPanelGO;
     spr               = gameObject.GetComponent <Image> ();
     spr.sprite        = mme.icon;
     sprRect           = spr.gameObject.GetComponent <RectTransform> ();
     sprRect.sizeDelta = mme.size;
     rt            = panelGO.GetComponent <RectTransform> ();
     mmc           = controller;
     miniMapTarget = mmc.target;
     SetPositionAndRotation();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 观察数据实体
 /// </summary>
 private void Awake()
 {
     DataEntity = new MiniMapEntity();
     Watch(this);
 }