Inheritance: MonoBehaviour
        /**
         * 初始化Map
         */
        private void InitMap()
        {
            // 北京市
            if (mMapController1 == null)
            {
                mMapController1 = Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                        .FindFragmentById(Resource.Id.map1)).MapView.Controller;
                mMapController1.SetMapStatus(NewMapStatusWithGeoPointAndZoom(GEO_BEIJING, 10));
            }

            // 上海市
            if (mMapController2 == null)
            {
                mMapController2 = Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                        .FindFragmentById(Resource.Id.map2)).MapView.Controller;
                mMapController2.SetMapStatus(NewMapStatusWithGeoPointAndZoom(GEO_SHANGHAI, 10));
            }

            // 广州市
            if (mMapController3 == null)
            {
                mMapController3 = Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                        .FindFragmentById(Resource.Id.map3)).MapView.Controller;
                mMapController3.SetMapStatus(NewMapStatusWithGeoPointAndZoom(GEO_GUANGZHOU, 10));
            }

            // 深圳市
            if (mMapController4 == null)
            {
                mMapController4 = Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                        .FindFragmentById(Resource.Id.map4)).MapView.Controller;
                mMapController4.SetMapStatus(NewMapStatusWithGeoPointAndZoom(GEO_SHENGZHENG, 10));
            }
        }
示例#2
0
	// Use this for initialization
	void Start () {
        mapController = GetComponent<MapController>();
        textureWidth = mapController.texture.width;
        
        tileSize = MapController.TILE_SIZE;

    }
示例#3
0
 static void DrawRiverLines(MapController mapController, GizmoType gizmoType)
 {
     if (mapController == null)
     {
       return;
     }
     Map map = mapController.map;
     if (map == null)
     {
       return;
     }
     Gizmos.color = Color.red;
     for (int i = 1; i < map.RiverData.Count; i++)
     {
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].JointChannelMiddleLine, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].JointChannelMiddleLine, map.WaterLevel, map.RiverData[i].Z));
     }
     Gizmos.color = Color.yellow;
     for (int i = 1; i < map.RiverData.Count; i++)
     {
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].LeftChannel.LeftEdge, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].LeftChannel.LeftEdge, map.WaterLevel, map.RiverData[i].Z));
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].LeftChannel.MiddleLine, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].LeftChannel.MiddleLine, map.WaterLevel, map.RiverData[i].Z));
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].LeftChannel.RightEdge, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].LeftChannel.RightEdge, map.WaterLevel, map.RiverData[i].Z));
     }
     Gizmos.color = Color.cyan;
     for (int i = 1; i < map.RiverData.Count; i++)
     {
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].RightChannel.LeftEdge, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].RightChannel.LeftEdge, map.WaterLevel, map.RiverData[i].Z));
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].RightChannel.MiddleLine, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].RightChannel.MiddleLine, map.WaterLevel, map.RiverData[i].Z));
       Gizmos.DrawLine(new Vector3(map.RiverData[i - 1].RightChannel.RightEdge, map.WaterLevel, map.RiverData[i - 1].Z), new Vector3(map.RiverData[i].RightChannel.RightEdge, map.WaterLevel, map.RiverData[i].Z));
     }
 }
示例#4
0
	void Start () {
		//THERE CAN BE ONLY ONE
		if (mapController != null && mapController != this) {
			Destroy (this.gameObject);
			return;
		}
		mapController = this;

		GameObject tileMap_go = transform.FindChild ("TileMap").gameObject;
		if (tileMap_go) {
			tileMap = tileMap_go.GetComponent<TileMapController> ();
		} else {
			Debug.LogError ("TileMap not found");
		}

		GameObject heroes_go = GameObject.Find ("Heroes");
		if (heroes_go) {
			heroes_go.transform.SetParent (this.transform);
			heroes = heroes_go.GetComponent<HeroesController> ();
		} else {
			Debug.LogError ("Heroes GameObject not found");
		}

		tileMap.CreateTileMap ();
		heroes.CreateHeroMap ();

		tileHighlightPrefab = (GameObject) Resources.Load ("UI/TileHighlight");

		pathfinder = new PathfinderDijkstra ();
	}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.activity_offline);
            mMapView = new MapView(this);
            mMapController = mMapView.Controller;

            mOffline = new MKOfflineMap();
            /**
             * 初始化离线地图模块,MapControler可从MapView.getController()获取
             */
            mOffline.Init(mMapController, this);
            InitView();

        }
示例#6
0
 void Awake()
 {
     mapCtrl = GetComponent<MapController>();
     wispCtrl = GetComponent<WispController>();
     unitCtrl = GetComponent<UnitController>();
     camCtrl = GetComponent<CameraController>();
     gameUICtrl = GetComponent<GameUIController>();
     spLib = GetComponent<SpriteLibrary>();
 }
示例#7
0
    void Start()
    {
        mySlider = this.gameObject.GetComponent<Slider>();
        mapControl = FindObjectOfType<MapController>();

        cold = new Color32(0, 240, 255 ,255);
        cool = new Color32(60, 255, 225, 255);
        med = new Color32(40, 255, 180, 255);
        warm = new Color32(255, 160, 0, 255);
        hot = new Color32(200, 40, 40, 255);
    }
示例#8
0
    void Start()
    {
        mySlider = this.gameObject.GetComponent<Slider>();
        mapControl = FindObjectOfType<MapController>();

        wet = new Color32(0, 240, 255 ,255);
        humid = new Color32(60, 255, 225, 255);
        med = new Color32(40, 255, 180, 255);
        arid = new Color32(255, 160, 0, 255);
        desert = new Color32(200, 40, 40, 255);
    }
示例#9
0
        public IEnumerator getMapController()
        {
            yield return new WaitForSeconds(0.5f);

            slDriver = FindObjectOfType<StorylineDriver>();
            frDriver = FindObjectOfType<FreeRoamingDriver>();
            if (frDriver != null)
                nodesArray = frDriver.getArrayOfNodes();
            //if (slDriver != null)
              //  nodesGameObjects = slDriver.GetNodeGameObjects();
            //transform.position = new Vector3(nodesGameObjects[1].transform.position.x, nodesGameObjects[1].transform.position.y, -7);
            mc = FindObjectOfType<MapController>();
            map = mc.getMap();
        }
示例#10
0
    void clear()
    {
        uiController.hide = true;
        uiController.clear();

        if (displayController != null)
            displayController.EraseBoard();

        displayController = null;
        mapController = null;
        gameState = null;
        result = 0;
        mode = 0;
    }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            /**
             * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
             */
            SetContentView(Resource.Layout.activity_layers);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;
            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);
            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(12);
            /**
             * 显示内置缩放控件
             */
            mMapView.SetBuiltInZoomControls(true);

            /**
             * 将地图移动至天安门
             * 使用百度经纬度坐标,可以通过http://api.map.baidu.com/lbsapi/getpoint/index.html查询地理坐标
             * 如果需要在百度地图上显示使用其他坐标系统的位置,请发邮件至[email protected]申请坐标转换接口
             */
            double cLat = 39.945;
            double cLon = 116.404;
            GeoPoint p = new GeoPoint((int)(cLat * 1E6), (int)(cLon * 1E6));
            mMapController.SetCenter(p);
        }
示例#12
0
    void init(int modeNumber)
    {
        clear ();

        uiController.hide = false;
        uiController.reset();
        uiController.setup(modeNumber,withPruning);

        displayController = display.GetComponent<DisplayController>();
        displayController.EraseBoard();

        Board board = new Board();
        gameState = new GameState( board );

        map = new GameObject("Map");
        map.transform.parent = gameObject.transform;
        map.AddComponent<MapController>();
        mapController = map.GetComponent<MapController>();

        displayController.DisplayBoard(gameState,map.transform);

        mapController.gameState = gameState;
    }
示例#13
0
	void Start() {
		if (mc != null) {

			DestroyImmediate (gameObject);
			return;
		}
	
		mc = this;
		
		gg = Instantiate (generatorPrefab) as GraphGenerator;
		currentNode = gg.Generate ();


		if (storedNodeIndex != -1) {
			currentNode = gg.GetNode(storedNodeIndex);
		}

		currentNode.SetActive (true);
		Camera.main.transform.position = new Vector3 (currentNode.transform.position.x, currentNode.transform.position.y, -20);

		mship = Instantiate(mshipprefab, currentNode.transform.position, Quaternion.identity) as MapMothership;
		mship.SetState(MshipState.ORBIT, currentNode);
	}
示例#14
0
 public HarvestDispenser(Entity entity, MapController mapController) : base(entity, mapController)
 {
 }
 // Use this for initialization
 void Start()
 {
     mapController = GameObject.Find ("MapController").GetComponent<MapController> ();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;

            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);

                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }

            /**
              * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
              */
            SetContentView(Resource.Layout.activity_main);

            mMapView = FindViewById<MapView>(Resource.Id.bmapView);

            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;

            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);

            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(12);

            /**
             * 将地图移动至指定点
             * 使用百度经纬度坐标,可以通过http://api.map.baidu.com/lbsapi/getpoint/index.html查询地理坐标
             * 如果需要在百度地图上显示使用其他坐标系统的位置,请发邮件至[email protected]申请坐标转换接口
             */
            GeoPoint p;
            double cLat = 39.945;
            double cLon = 116.404;

            var intent = Intent;

            if (intent.HasExtra("x") && intent.HasExtra("y"))
            {
                //当用intent参数时,设置中心点为指定点
                Bundle b = intent.Extras;

                p = new GeoPoint(b.GetInt("y"), b.GetInt("x"));
            }
            else
            {
                //设置中心点为天安门
                p = new GeoPoint((int)(cLat * 1E6), (int)(cLon * 1E6));
            }

            mMapController.SetCenter(p);

            /**
             *  MapView的生命周期与Activity同步,当activity挂起时需调用MapView.onPause()
             */
            mMapListener = new MKMapViewListenerImpl(this);

            mMapView.RegMapViewListener(DemoApplication.getInstance().mBMapManager, mMapListener);
        }
示例#17
0
 protected override void Initialize()
 {
     base.Initialize();
     MapController = new MapController <ChangePaymentTypeMap, AbstractMapViewModel <ChangePaymentTypeMap> >(Model.ChangePaymentTypeMaps, Workspace);
 }
示例#18
0
 void Awake()
 {
     instance = this;
 }
示例#19
0
 // This function called when mouse exit from the map
 public void MouseExit()
 {
     MapController.Instance().MouseOutsideMap();
 }
 protected override void Initialize()
 {
     base.Initialize();
     MapController = new MapController <AutomationCommandMap, AutomationCommandMapViewModel>(Model.AutomationCommandMaps, Workspace);
 }
示例#21
0
 protected override void Initialize()
 {
     base.Initialize();
     MapController = new MapController <CalculationSelectorMap, AbstractMapViewModel <CalculationSelectorMap> >(Model.CalculationSelectorMaps, Workspace);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManager.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            SetContentView(Resource.Layout.activity_locationoverlay);
            ICharSequence titleLable = new String("定位功能");
            Title = titleLable.ToString();

            myListener = new MyLocationListenner(this);

            requestLocButton = FindViewById<Button>(Resource.Id.button1);
            mCurBtnType = E_BUTTON_TYPE.LOC;
            Android.Views.View.IOnClickListener btnClickListener = new BtnClickListenerImpl(this);

            requestLocButton.SetOnClickListener(btnClickListener);

            RadioGroup group = this.FindViewById<RadioGroup>(Resource.Id.radioGroup);
            radioButtonListener = new RadioButtonListenerImpl(this);
            group.SetOnCheckedChangeListener(radioButtonListener);

            //地图初始化
            mMapView = FindViewById<MyLocationMapView>(Resource.Id.bmapView);
            mMapController = mMapView.Controller;
            mMapView.Controller.SetZoom(14);
            mMapView.Controller.EnableClick(true);
            mMapView.SetBuiltInZoomControls(true);
            //创建 弹出泡泡图层
            CreatePaopao();

            //定位初始化
            mLocClient = new LocationClient(this);
            locData = new LocationData();
            mLocClient.RegisterLocationListener(myListener);
            LocationClientOption option = new LocationClientOption();
            option.OpenGps = true;//打开gps
            option.CoorType = "bd09ll";     //设置坐标类型
            option.ScanSpan = 1000;
            mLocClient.LocOption = option;
            mLocClient.Start();

            //定位图层初始化
            myLocationOverlay = new LocationOverlay(this, mMapView);
            //设置定位数据
            myLocationOverlay.SetData(locData);
            //添加定位图层
            mMapView.Overlays.Add(myLocationOverlay);
            myLocationOverlay.EnableCompass();
            //修改定位数据后刷新图层生效
            mMapView.Refresh();

        }
示例#23
0
 protected override bool ShouldShow()
 {
     return(this.m_ActiveSlots.Count > 0 && !MapController.Get().IsActive() && !NotepadController.Get().IsActive());
 }
示例#24
0
 public void Init(State state, MapController mapController)
 {
     _state         = state;
     _mapController = mapController;
 }
示例#25
0
    public void Initialise()
    {
        if (IsInitialised)
        {
            return;
        }

        // Get Tile Attributes from named map if we have no sheet
        string json = "";

        if (SpriteSheetName != Name)
        {
            MapController mapController = GameObject.FindGameObjectWithTag("Globals").GetComponent <MapController>();
            if (!mapController.LoadedMaps.ContainsKey(SpriteSheetName))
            {
                mapController.LoadMap(SpriteSheetName);
            }
            TileAttributes = mapController.LoadedMaps[SpriteSheetName].TileAttributes;
        }
        else
        {
            json = "{'Items': " + MetaDataJson + "}";
            MetaDataInfo metaData = JsonConvert.DeserializeObject <MetaDataInfo>(json);

            for (int i = 0; i < metaData.Items.Count; i++)
            {
                TileMetaData m = new TileMetaData();
                foreach (MetaDataItem meta in metaData.Items[i].Data)
                {
                    switch (meta.Type)
                    {
                    case "Solid": m.IsSolid = meta.Value == "True"; break;

                    case "Friction": m.Friction = meta.Value; break;

                    case "Damage": m.Damage = Convert.ToInt32(meta.Value == "" ? "0" : meta.Value); break;

                    case "Ladder": m.IsLadder = meta.Value == "True"; break;
                    }
                }
                TileAttributes.Add(m);
            }
        }

        json = "{'Layers':" + LayersJson + "}";
        MapCellInfo mapCellInfo = JsonConvert.DeserializeObject <MapCellInfo>(json);

        Layers     = new List <MapCells>();
        LayerNames = new List <string>();
        for (int i = 0; i < mapCellInfo.Layers.Count; i++)
        {
            MapCells layer = new MapCells(MapWidth, MapHeight);
            for (int y = 0; y < MapHeight; y++)
            {
                for (int x = 0; x < MapWidth; x++)
                {
                    int c = y * MapWidth + x;
                    layer.Cells[x, y]   = mapCellInfo.Layers[i].Cells[c].TileID;
                    layer.Actions[x, y] = mapCellInfo.Layers[i].Cells[c].Action;
                }
            }
            LayerNames.Add(mapCellInfo.Layers[i].Layer);
            Layers.Add(layer);
        }

        CreatePathFindingArray("Collisions");

        // Create NPCs
        json = "{'NPC' :" + NPCJson + "}";
        NPCData npcData = JsonConvert.DeserializeObject <NPCData>(json);

        foreach (NPCInfo npcInfo in npcData.NPC)
        {
            NPC npc = NPCController.CreateNPC(npcInfo.Name, npcInfo.ModelName, npcInfo.X, MapHeight - npcInfo.Y - 1, this);
            npc.CanMoveToPOI       = npcInfo.POI == "True";
            npc.CanWander          = npcInfo.Wander == "True";
            npc.InteractFunction   = npcInfo.IntFunc;
            npc.InteractParams     = npcInfo.IntParam;
            npc.maxSpeed           = npcInfo.Speed;
            npc.VisibilityFunction = npcInfo.VisFunc;
            npc.VisibilityParams   = npcInfo.VisParam;

            AddNPC(npc);
        }


        IsInitialised = true;
    }
    //Use this for initialization

    void Start()
    {
        socket       = GameObject.Find("Directional light").GetComponent <DemoSocket>();
        mycamera     = GameObject.Find("HoloLensCamera");
        myCameraInfo = GameObject.Find("CameraInfo");
        label        = myCameraInfo.transform.Find("rotation").gameObject;
        myCameraInfo.SetActive(true);
        label.SetActive(true);

        backGround    = GameObject.Find("Canvas/BackgroundPanel");
        info          = GameObject.Find("InfoCanvas").GetComponent <InfoCanvasController>();
        manager       = GameObject.Find("InputManager").GetComponent <GazeManager>();
        video         = GameObject.Find("Canvas/PanelVideo");
        map           = GameObject.Find("Canvas/PanelMap");
        btns          = GameObject.Find("Canvas/PanelBtns");
        anchor        = video.transform.Find("anchor").gameObject;
        canvas        = GameObject.Find("Canvas");
        point1        = GameObject.Find("point1");
        point2        = GameObject.Find("point2");
        point3        = GameObject.Find("point3");
        point4        = GameObject.Find("point4");
        mapController = MapController.GetMapController();
        //下面4个LineRender是用来画 选框时的框的,设置其颜色,宽度。
        lineRenderer1          = point1.AddComponent <LineRenderer>();
        lineRenderer1.material = new Material(Shader.Find("Particles/Additive"));

        lineRenderer1.startColor    = c1;
        lineRenderer1.endColor      = c2;
        lineRenderer1.startWidth    = 0.01F;
        lineRenderer1.endWidth      = 0.01F;
        lineRenderer1.positionCount = 2;

        lineRenderer2               = point2.AddComponent <LineRenderer>();
        lineRenderer2.material      = new Material(Shader.Find("Particles/Additive"));
        lineRenderer2.startColor    = c1;
        lineRenderer2.endColor      = c2;
        lineRenderer2.startWidth    = 0.01F;
        lineRenderer2.endWidth      = 0.01F;
        lineRenderer2.positionCount = 2;

        lineRenderer3               = point3.AddComponent <LineRenderer>();
        lineRenderer3.material      = new Material(Shader.Find("Particles/Additive"));
        lineRenderer3.startColor    = c1;
        lineRenderer3.endColor      = c2;
        lineRenderer3.startWidth    = 0.01F;
        lineRenderer3.endWidth      = 0.01F;
        lineRenderer3.positionCount = 2;

        lineRenderer4               = point4.AddComponent <LineRenderer>();
        lineRenderer4.material      = new Material(Shader.Find("Particles/Additive"));
        lineRenderer4.startColor    = c1;
        lineRenderer4.endColor      = c2;
        lineRenderer4.startWidth    = 0.01F;
        lineRenderer4.endWidth      = 0.01F;
        lineRenderer4.positionCount = 2;

        lineRenderer1.enabled = false;
        lineRenderer2.enabled = false;
        lineRenderer3.enabled = false;
        lineRenderer4.enabled = false;
    }
示例#27
0
 private bool CanShowMenuInGame()
 {
     return(!GreenHellGame.ROADSHOW_DEMO && !this.m_CurrentScreen && !Inventory3DManager.Get().gameObject.activeSelf&& !NotepadController.Get().enabled&& !MapController.Get().enabled&& !BodyInspectionController.Get().enabled&& !BodyInspectionMiniGameController.Get().enabled&& (!HUDEndDemo.Get() || !HUDEndDemo.Get().enabled) && !CutscenesManager.Get().IsCutscenePlaying() && !HUDStartSurvivalSplash.Get().m_Active);
 }
示例#28
0
 void Start()
 {
     _destination = MapController.GenerateRandomPointInsideMap();
 }
示例#29
0
    // Use this for initialization
    void Start()
    {
        player = (PlayerController) FindObjectOfType (typeof(PlayerController));
        map = (MapController) FindObjectOfType (typeof(MapController));
        player.PlayerInputAllowed = true;

        SpawnEnemy();
    }
示例#30
0
 public MainWindow()
 {
     _mc = new MapController();
 }
示例#31
0
 void Awake()
 {
     mapCtrl = GetComponent<MapController>();
     camCtrl = GetComponent<CameraController>();
     mapCtrl.Init ();
 }
示例#32
0
 // This function called when mouse enter the map.
 public void MouseEnter()
 {
     MapController.Instance().MouseOnMap();
 }
示例#33
0
 protected override void Initialize()
 {
     base.Initialize();
     MapController = new MapController <EntityScreenMap, AbstractMapViewModel <EntityScreenMap> >(Model.EntityScreenMaps, Workspace);
 }
示例#34
0
    protected virtual void Start()
    {
        Collider[] initialCollision = Physics.OverlapSphere(transform.position, .1f, collisionMask);

        if(initialCollision.Length > 0){
            OnHitObject(initialCollision[0]);
        }

        mc = GameObject.FindGameObjectWithTag("Map").GetComponent<MapController>();
    }
示例#35
0
    static List<Node> GetChildNodes(Node parent, Vector3 target, MapController map)
    {
        List<Node> children = new List<Node>();

        Vector3[] directions = { Vector3.forward, Vector3.right, Vector3.back, Vector3.left };

        foreach (var direction in directions)
        {
            int x = (int)parent.Position.x + (int)direction.x;
            int z = (int)parent.Position.z + (int)direction.z;

            TileType tile = map.GetTileType(x, z);

            if (tile.isWalkable)
            {
                children.Add(new Node(parent.Position + direction, parent.MovesFromStart + 1,
                    CalculateTilesBetween(parent.Position + direction, target),
                    parent));
            }
        }

        return children;
    }
示例#36
0
    public void Init(MapController _m, WayTracerEmitter _w, WaytracerMovement _move)
    {
        _mapController = _m;
        _parentEmitter = _w;
        _tracerMovement = _move;

        InputsForBrain = new float[15] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

        _currentMapNode = null;
        _travellingToMapNode = null;

        _entityColour = GetComponent<Renderer>().material;
        _entityTrail = GetComponent<TrailRenderer>();

        //Assign random starting location
        GetRandomStartingNode();
        //Assign a connected node to move toward
        GetNextConnection();
    }
示例#37
0
 void Start()
 {
     mySlider = this.gameObject.GetComponent<Slider>();
     mapControl = FindObjectOfType<MapController>();
 }
 protected override void Initialize()
 {
     base.Initialize();
     MapController = new MapController <ProdcutTimerMap, ProductTimerMapViewModel>(Model.ProductTimerMaps, Workspace);
 }
示例#39
0
    //Calls to generate the hex map
    void GenerateMap()
    {
        mapControl = FindObjectOfType<MapController>();

        mapControl.GenerateRegionMap();
    }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            /**
             * 使用地图sdk前需先初始化BMapManageResource.
             * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建,
             * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁
             */
            DemoApplication app = (DemoApplication)this.Application;
            if (app.mBMapManager == null)
            {
                app.mBMapManager = new BMapManager(ApplicationContext);
                /**
                 * 如果BMapManager没有初始化则初始化BMapManager
                 */
                app.mBMapManager.Init(new DemoApplication.MyGeneralListener());
            }
            /**
              * 由于MapView在setContentView()中初始化,所以它需要在BMapManager初始化之后
              */
            SetContentView(Resource.Layout.activity_overlay);
            mMapView = FindViewById<MapView>(Resource.Id.bmapView);
            mClearBtn = FindViewById<Button>(Resource.Id.clear);
            mResetBtn = FindViewById<Button>(Resource.Id.reset);
            /**
             * 获取地图控制器
             */
            mMapController = mMapView.Controller;
            /**
             *  设置地图是否响应点击事件  .
             */
            mMapController.EnableClick(true);
            /**
             * 设置地图缩放级别
             */
            mMapController.SetZoom(14);
            /**
             * 显示内置缩放控件
             */
            mMapView.SetBuiltInZoomControls(true);

            InitOverlay();

            /**
             * 设定地图中心点
             */
            GeoPoint p = new GeoPoint((int)(39.933859 * 1E6), (int)(116.400191 * 1E6));
            mMapController.SetCenter(p);
        }
示例#41
0
    public IEnumerator startFreeRoaming()
    {
        yield return new WaitForSeconds(0.005f);

        ui_Manager = FindObjectOfType<UI_Manager>();

        floorManager = GameObject.Find("FloorManager");

        freeRoamingTour = FindObjectOfType<FreeRoaming>();
        mc = FindObjectOfType<MapController>();

        map = mc.getMap();

        iBeaconHandler bh = iBeaconHandler.GetComponent<iBeaconHandler>();
        List<Beacon> beacons = bh.getBeacons();

        DisplayFloor(2);

        map.initializeLists(arrayOfNodes);

        freeRoamingTour.setBeaconList(beacons);

        freeRoamingTour.initializeLists(map.GetPoiNodes());

        shortestPathCreator.transform.position = new Vector3(arrayOfNodes[0].transform.position.x, arrayOfNodes[0].transform.position.y, -7);
        /*public IEnumerator startStoryline()
        {
            yield return new WaitForSeconds(0.005f);

            ui_Manager = FindObjectOfType<UI_Manager>();
            floorManager = GameObject.Find("FloorManager");

            //Storyline demo = new Storyline(0, 1, "Demo Storyline", "Let's see how good is your mobile app!");

            mc = FindObjectOfType<MapController>();

            map = mc.getMap();

            iBeaconHandler bh = iBeaconHandler.GetComponent<iBeaconHandler>();
            List<Beacon> beacons = bh.getBeacons();
            int slID = PlayerPrefs.GetInt("storylineID");

            print("Storyline id is: " + slID);
            map.GetStoryline(slID).setBeaconList(beacons);

            List<Node> orderedPath = map.orderedPath(slID);

            //map.setStorypointList(orderedPath);
            map.startStoryline(orderedPath, slID);
            DisplayFloor(2, slID); //this should be the first floor

            map.GetStoryline(slID).getStorypointList()[0].setBeacon(new iBeaconServer("B9407F30-F5F8-466E-AFF9-25556B57FE6D", 38714, 26839));

            shortestPathCreator.transform.position = new Vector3(gameObjectNodesList[0].transform.position.x, gameObjectNodesList[0].transform.position.y, -7);
            */
    }
示例#42
0
    void refresh()
    {
        displayController.EraseBoard();

        map = Instantiate(mapPrefab);
        map.transform.parent = gameObject.transform;
        map.AddComponent<MapController>();

        displayController.DisplayBoard(gameState,map.transform);

        mapController = map.GetComponent<MapController>();
        mapController.gameState = gameState;

        if (mode==1 || (mode==2 && gameState.getTurn() == 1))
        {
            Algorithms.evaluate(gameState);
        }

        result = gameState.value;

        //Debug.Log (gameState.getTurn() +" = " + result);

        if (gameState.getTurn() == 1)
            uiController.updateLeft(result);
        else
            uiController.updateRight(result);

        if ( gameState.getEndGame() )
        {
            winner = gameState.getWinner();
            score = gameState.value;

            uiController.updateWinMessage(winner);
            gameState.switchTurn();

            watch.Stop();
            ts = watch.Elapsed;
            elapsedTime = String.Format("{0:00}:{1:00}.{2:00}",
                                               ts.Minutes,
                                               ts.Seconds,
                                               ts.Milliseconds / 10);

            uiController.updateTime(elapsedTime);

            time = ts.TotalMilliseconds;

            data.Add( new Data(winner,score,time));
        }
        else
        {
            gameState.switchTurn();
            uiController.updatePlayerTurn(gameState.getTurn());
        }

        mapController.refresh = false;
    }
示例#43
0
 void Start()
 {
     mapController = GetComponent<MapController>();
 }
示例#44
0
        // load / initialize all the variables
        public DebrisFlowMapViewModel(MainMap map, DebrisFlowRecord debrisFlowRecord, DebrisFlowCollection debrisFlowCollection) 
        {
            this.debrisFlowRecord = debrisFlowRecord;
            this.debrisFlowCollection = debrisFlowCollection;

            this.dialogCoordinator = new DialogCoordinator();

            //set up map controller
            mapController = new MapController(map);
            mapController.LocationChanged += OnLocationChanged;

            //Set up SOP 
            var debrisflowsop = new DebrisFlowSOP();
            this.sop = debrisflowsop.GetSOP();
            this.sopDisplay = new SOPDisplay();
            AddSOPTypes(debrisflowsop);
            SetUpSOPLocation(sop);
           
        }
示例#45
0
 public HarvestSeed(Entity entity, MapController mapController) : base(entity, mapController)
 {
 }
        //<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        //<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        //<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        //<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        //<uses-permission android:name="android.permission.INTERNET" />
        //<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            base.onCreate(savedInstanceState);

            //requestWindowFeature(Window.FEATURE_NO_TITLE);
            //getWindow().setFlags(WindowManager_LayoutParams.FLAG_FULLSCREEN, WindowManager_LayoutParams.FLAG_FULLSCREEN);

            //this.ShowToast("jsc-solutions.net\nWait while map loads...");

            // http://stackoverflow.com/questions/8037101/how-to-get-attributeset-properties

            //var a = this;

            //var sv = new ScrollView(a);
            //var ll = new LinearLayout(a);
            ////ll.setOrientation(LinearLayout.VERTICAL);
            //sv.addView(ll);

            //myOpenMapView = new MapView(this, null);
            //myOpenMapView.setLayoutParams(
            //    new ViewGroup.LayoutParams(
            //        ViewGroup.LayoutParams.FILL_PARENT,
            //        ViewGroup.LayoutParams.FILL_PARENT
            //    )
            //);

            //myOpenMapView.AttachTo(ll);

            //a.setContentView(sv);

            setContentView(R.layout.main);

            myOpenMapView = (MapView)findViewById(R.id.openmapview);

            // http://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/main/java/org/osmdroid/views/MapView.java
            // http://stackoverflow.com/questions/157119/c-sharp-can-i-override-with-derived-types

            myMapController = (MapController)((IMapView)myOpenMapView).getController();

            myOpenMapView.setTileSource(TileSourceFactory.MAPNIK);

            myOpenMapView.setBuiltInZoomControls(true);
            myOpenMapView.setMultiTouchControls(true);
            myMapController.setZoom(16);
            myMapController.setCenter(new GeoPoint(51496994, -134733));
        }
示例#47
0
    //
    // Unity Methods
    //

    private void Awake()
    {
        map = ComponentManager.Instance.Get <MapController>();
        layerToggle.onValueChanged.AddListener(OnLayerToggleChanged);
    }