コード例 #1
0
    void CreateMapItem(MapTileInfo info)
    {
        Vector3 posworld = MapUtils.GetPositionCenter(info.tileX, info.tileY, mapSizeX, mapSizeY, sizeRect);

        posworld.z = rootPosZ - 1;
        float w, h;

        w = meshRoad.roadWidth;
        h = w;
        // Vector2 posworld = mainCam.ScreenToWorldPoint(pos);

        if (info.type == UIMapItem.ItemType.ROAD_TILE)
        {
            meshRoad.AddPoint(posworld);
        }

        if ((info.type == UIMapItem.ItemType.FLAG) || (info.type == UIMapItem.ItemType.TREE) || (info.type == UIMapItem.ItemType.CAR))
        {
            GameObject obj = new GameObject("item_" + info.type.ToString());
            //AppSceneBase.main.AddObjToMainWorld(obj);
            obj.transform.parent        = this.gameObject.transform;
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = new Vector3(posworld.x, posworld.y, rootPosZ - 1);
            if (info.type == UIMapItem.ItemType.CAR)
            {
                uiCar                   = obj.AddComponent <UICar>();
                uiCar.type              = info.type;
                uiCar.iDelegate         = this;
                uiCar.sizeRect          = sizeRect;
                uiCar.uiCmdBarRun       = uiCmdBarRun;
                uiCar.localPositionInit = obj.transform.localPosition;
                uiCar.SetMapSize(mapSizeX, mapSizeY);
                uiCar.UpdateGuankaItem(itmeInfoGuanka);
                uiCar.UpdateItem(w, h);
            }
            else
            {
                UIMapItem item = obj.AddComponent <UIMapItem>();
                item.type       = info.type;
                item.enableMove = false;
                item.UpdateItem(w, h);
            }

            //
        }
    }
コード例 #2
0
 public void CarUpdateStatus(UICar car, CarMotion.RunStatus status)
 {
     Debug.Log("CarUpdateStatus status=" + status);
 }