예제 #1
0
 void OnEnable()
 {
     if (iconType != MiniMapElementIconType.Empty)
     {
         MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Create, id, iconType);
     }
 }
예제 #2
0
 void LateUpdate()
 {
     if (MiniMapView.Instance.elementIconDict.ContainsKey(id) && lastPostion != transform.position)
     {
         lastPostion = transform.position;
         MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, id, transform.position);
     }
 }
예제 #3
0
    public void OnDestroy()
    {
        MiniMapMessageDispatcher.RemoveElementObserver(MiniMapElementStateType.Update, MoveElementGameObjectListener);

        MiniMapMessageDispatcher.RemoveElementObserver(MiniMapElementStateType.Create, AddElementDataListener);
        MiniMapMessageDispatcher.RemoveElementObserver(MiniMapElementStateType.Update, UpdateElementDataListener);
        MiniMapMessageDispatcher.RemoveElementObserver(MiniMapElementStateType.Destroy, RemoveElementDataListener);
    }
예제 #4
0
    public void OnCreate()
    {
        view = MiniMapView.Instance;

        elementDataDict = new Dictionary <int, MiniMapElementIconType>();

        MiniMapMessageDispatcher.AddElementObserver(MiniMapElementStateType.Update, MoveElementGameObjectListener);

        MiniMapMessageDispatcher.AddElementObserver(MiniMapElementStateType.Create, AddElementDataListener);
        MiniMapMessageDispatcher.AddElementObserver(MiniMapElementStateType.Update, UpdateElementDataListener);
        MiniMapMessageDispatcher.AddElementObserver(MiniMapElementStateType.Destroy, RemoveElementDataListener);
    }
예제 #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            GameObject go = Instantiate(soldierGo) as GameObject;
            go.transform.parent        = goParent;
            go.transform.localPosition = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15));
            lastGo = go;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            GameObject go = Instantiate(towerGo) as GameObject;
            go.transform.parent        = goParent;
            go.transform.localPosition = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15));
            lastGo = go;
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            effectId = MiniMapController.MakeId();
            MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Create, effectId, MiniMapElementIconType.Effect1);
            MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, effectId, lastGo.transform.position);
            b = true;
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Destroy, effectId);
            effectId = 0;
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, effectId, MiniMapElementIconType.Effect2);
        }

        if (Input.GetKeyDown(KeyCode.U))
        {
            lastGo.GetComponent <MiniMapElement>().enabled = !lastGo.GetComponent <MiniMapElement>().enabled;
        }
    }
예제 #6
0
 void OnDisable()
 {
     lastPostion = Vector2.zero;
     MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Destroy, id, MiniMapView.Instance.controller.elementDataDict[id]);
 }
예제 #7
0
 public void UpdateIcon(MiniMapElementIconType iconType)
 {
     this.iconType = iconType;
     MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, id, iconType);
 }
예제 #8
0
 public void Init(MiniMapElementIconType iconType)
 {
     id            = MiniMapController.MakeId();
     this.iconType = iconType;
     MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Create, id, iconType);
 }