private void renderTargetUserControl1_Render(RenderTargetUserControl sender, Camera camera) { //update camera if (Map.Instance != null) { Vec3 position; Vec3 forward; Degree fov; MapCamera mapCamera = Entities.Instance.GetByName("MapCamera_1") as MapCamera; if (mapCamera != null) { position = mapCamera.Position; forward = mapCamera.Rotation * new Vec3(1, 0, 0); fov = mapCamera.Fov; } else { position = Map.Instance.EditorCameraPosition; forward = Map.Instance.EditorCameraDirection.GetVector(); fov = Map.Instance.Fov; } if (fov == 0) { fov = Map.Instance.Fov; } renderTargetUserControl1.CameraNearFarClipDistance = Map.Instance.NearFarClipDistance; renderTargetUserControl1.CameraFixedUp = Vec3.ZAxis; renderTargetUserControl1.CameraFov = fov; renderTargetUserControl1.CameraPosition = position; renderTargetUserControl1.CameraDirection = forward; } }
// // Unity Methods // private IEnumerator Start() { // Avoid updates while loading nextUpdate = int.MaxValue; latitude.text = ""; longitude.text = ""; yield return(WaitFor.Frames(WaitFor.InitialFrames)); map = ComponentManager.Instance.Get <MapController>(); mapCamera = ComponentManager.Instance.Get <MapCamera>(); inputHandler = ComponentManager.Instance.Get <InputHandler>(); var mapViewArea = ComponentManager.Instance.Get <MapViewArea>(); if (mapViewArea != null) { mapViewTransform = mapViewArea.transform as RectTransform; } map.OnZoomChange += OnMapZoomChange; map.OnBoundsChange += OnBoundsChange; compas.GetComponent <Button>().onClick.AddListener(OnCompasClick); UpdateScale(); nextUpdate = Time.time + updateInterval; }
public void Setup() { gameMap = GameMapUTests.CreateTestGameMap(); player1 = PlayerUTests.CreateTestPlayer(1); player2 = PlayerUTests.CreateTestPlayer(2); player1Camera = MapCameraUTests.CreateTestMapCamera(); player2Camera = MapCameraUTests.CreateTestMapCamera(); player1.gameMap = gameMap; player2.gameMap = gameMap; player1.playerCamera = player1Camera; player2.playerCamera = player2Camera; actionMap = player1.actionMap; unit1 = UnitCardUnitITests.CreateTestUnitWithCard(); unit2 = UnitCardUnitITests.CreateTestUnitWithCard(); unit1.player = player1; unit2.player = player2; hexCoords = new Vector3Int(0, 0, 0); targetHexCoords = new Vector3Int(1, -1, 0); mousePosition = gameMap.HexToWorldCoords(hexCoords); player1Camera.MoveCameraToPosition(mousePosition); player2Camera.MoveCameraToPosition(mousePosition); gameMap.AddPiece(unit1, hexCoords); // Get center hex gameHex = gameMap.GetWorldPositionHex(Vector3Int.zero); }
/// <summary> /// Coroutine that does the actual flyby logic. /// </summary> /// <param name="delay">delay between each location, in seconds.</param> /// <remarks> /// This logic is in a coroutine so that we don't have to put it in Update; /// Coroutines provide an easy way to keep track of time past /// </remarks> IEnumerator FlybyCoroutine(float delay) { // wait for delay, if there's any if (delay > 0) { yield return(new WaitForSecondsRealtime(delay)); } IsDoingFlyby = true; while (true) { foreach (var l in locations) { // calculate distance manually because we want to fly nearer Vector3 northeast = MapCamera.LatLongToUnity(l.viewport.northeast), southwest = MapCamera.LatLongToUnity(l.viewport.southwest); float diag = (northeast - southwest).magnitude; // viewport diagonal distance float dist = Mathf.Clamp(diag / 2f, 0.5f, camera.maxDistance); camera.SetCameraViewport(l, dist, true); camera.TargetElevation = 30f; // nice angle // wait for delay to fly to next location yield return(new WaitForSecondsRealtime(flybyInterval)); } } }
// Use this for initialization void Start() { cameraMapObject = GameObject.FindGameObjectWithTag(CameraConstants.TAG_MAP_CAMERA); cameraMap = cameraMapObject.GetComponent<Camera>(); mapCamera = cameraMapObject.GetComponent<MapCamera>(); // Create a cylinder game object and assign it to the map layer _gameObject = GameObject.CreatePrimitive(PrimitiveType.Cylinder); _gameObject.name = "MapItem"; _gameObject.layer = LayerMask.NameToLayer(HUDConstants.LAYER_MAP); // Transform properties _transform = _gameObject.transform; _transform.parent = gameObject.transform; _parentTransform = _transform.parent.transform; _transform.localScale = new Vector3(5f, 0f, 5f); _transform.localPosition = Vector3.up; _transform.localEulerAngles = Vector3.zero; // Add texture Material mat = _gameObject.GetComponent<Renderer>().material; mat.SetTexture("_MainTex", mainTexture); mat.shader = Shader.Find("Unlit/Transparent"); Destroy(_gameObject.GetComponent<Collider>()); }
public void Init() { map = ComponentManager.Instance.Get <MapController>(); mapCamera = ComponentManager.Instance.Get <MapCamera>(); map.OnMapUpdate += OnMapUpdate; }
protected override void OnAttach() { base.OnAttach(); positionY = maxout; if (spawner == null) { spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; } if (camera == null) { camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; } MechsPriceList = (PriceListC)Entities.Instance.Create("MechPriceList", Map.Instance); AunitPriceList = (PriceListC)Entities.Instance.Create("AunitPriceList", Map.Instance); GunitPriceList = (PriceListC)Entities.Instance.Create("GunitPriceList", Map.Instance); JunitPriceList = (PriceListC)Entities.Instance.Create("JunitPriceList", Map.Instance); GetListOfPlayerUnits(); cash = GetPlayerCashSQL(); InitCameraViewFromTarget(); //positionY = maxout; }
void Start() { _mapCamera = GameObject.FindObjectOfType <MapCamera>(); _lastSavedGameCameraPosition = transform.position; _TreeClimbChallengePanel.SetActive(false); _TreusareHuntChallengePanel.SetActive(false); }
public void Draw(SpriteBatch spriteBatch) { if (MapTransition != null && MapTransition.State == MapTransitionHandler.TransitionState.MapChange) { MapTransition.Draw(spriteBatch); } else { MapRenderer.Draw(MapCurrent, MapCamera.GetViewMatrix()); if (MainPlayer.IsActive == true) { MainPlayer.Draw(spriteBatch); } foreach (MapEntity entity in Entities) { entity.Draw(spriteBatch); } if (IsTransitionActive == true) { MapTransition.Draw(spriteBatch); } } }
public void Init() { InitPlayerIcon(); //foreach (var icon in iconsWithHolder) // icon.Value.Recycle(); //iconsWithHolder.Clear(); //foreach (var iconWoH in NormalIcons) // iconWoH.Recycle(); //NormalIcons.Clear(); if (targetTexture) { targetTexture.Release(); } targetTexture = new RenderTexture(textureSize.x, textureSize.y, 24, textureFormat) { name = "MapTexture" }; MapCamera.targetTexture = targetTexture; if (!MapCamera.CompareTag("MapCamera")) { MapCamera.tag = "MapCamera"; } UI.mapImage.texture = targetTexture; miniModeInfo.currentSizeOfCam = miniModeInfo.defaultSizeOfCam; worldModeInfo.currentSizeOfCam = worldModeInfo.defaultSizeOfCam; ToMiniMap(); isInit = true; }
// Start is called before the first frame update void Start() { if (!camera) { camera = FindObjectOfType <MapCamera>(); } }
// protected override void OnAttach() { base.OnAttach(); //load the HUD screen hudControl = ControlDeclarationManager.Instance.CreateControl( "JigsawPuzzleGame\\JigsawPuzzleGameHUD.gui"); //attach the HUD screen to the this window Controls.Add(hudControl); if (EntitySystemWorld.Instance.IsSingle()) { //hide chat edit box for single mode hudControl.Controls["ChatText"].Visible = false; hudControl.Controls["ChatMessage"].Visible = false; } //ExitToRooms button if (EntitySystemWorld.Instance.IsSingle()) { ((EButton)hudControl.Controls["ExitToRooms"]).Click += delegate(EButton sender) { string mapName = "Maps\\MainDemo\\Map.map"; string spawnPointName = "SpawnPoint_FromJigsawPuzzleGame"; GameWorld.Instance.SetShouldChangeMap(mapName, spawnPointName, null); }; } else { hudControl.Controls["ExitToRooms"].Visible = false; } chatMessageEditBox = (EEditBox)hudControl.Controls["ChatMessage"]; chatMessageEditBox.PreKeyDown += ChatMessageEditBox_PreKeyDown; //find first map camera foreach (Entity entity in Map.Instance.Children) { mapCamera = entity as MapCamera; if (mapCamera != null) { break; } } //for chat support GameNetworkServer server = GameNetworkServer.Instance; if (server != null) { server.ChatService.ReceiveText += Server_ChatService_ReceiveText; } GameNetworkClient client = GameNetworkClient.Instance; if (client != null) { client.ChatService.ReceiveText += Client_ChatService_ReceiveText; } }
/// <summary> /// 屏幕坐标转化为场景地图坐标 /// </summary> /// <param name="screenPoint"></param> /// <returns></returns> public static Vector2 SceneCamToSceneMapPoint(Vector2 screenPoint) { //真实3D世界坐标 Vector3 worldPoint = MapCamera.ScreenToWorldPoint(screenPoint); //相对的场景地图坐标 return(SceneWorldToMapPoint(worldPoint - Vector3.right * SceneTiled.halfSceneWidth)); }
protected void UpdateCamera() { base.OnRender(); //float outCurveTime; //Update camera orientation if (Map.Instance != null) { //moveTime = Time; Vec3 position; Vec3 forward; //Vec3 up; Degree fov; MapCamera mapCamera = GetMapCamera(); if (mapCamera == null) { return; } //iNCIN if (cameraCurves == null) { return; } //curve ///////////////////////////////////////////////////////////// MapCurve mapCurve = (MapCurve)Entities.Instance.GetByName("MM_Curve"); //insert curve name here if (moveTime >= mapCurve.GetCurveMaxTime()) { moveTime -= mapCurve.GetCurveMaxTime(); } mapCamera.Position = mapCurve.CalculateCurvePointByTime(moveTime); mapCamera.Rotation = mapCurve.CalculateCurveRotationByTime(moveTime); //real Camera///////////////////////////////////////////////////////////// position = mapCamera.Position; forward = mapCamera.Rotation * new Vec3(1, 0, 0); fov = mapCamera.Fov; if (fov == 0) { fov = Map.Instance.Fov; } Camera camera = RendererWorld.Instance.DefaultCamera; camera.NearClipDistance = Map.Instance.NearFarClipDistance.Minimum; camera.FarClipDistance = Map.Instance.NearFarClipDistance.Maximum; camera.FixedUp = Vec3.ZAxis; camera.Fov = fov; camera.Position = position; camera.Direction = forward; } }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDeleteSubscribedToDeletionEvent(Entity)"/></summary> protected override void OnDeleteSubscribedToDeletionEvent(Entity entity) { base.OnDeleteSubscribedToDeletionEvent(entity); if (entity == mapCamera) mapCamera = null; if (entity == mapCurve) mapCurve = null; }
public object CreateCamera(int radius, int weight) { MapCamera camera = new MapCamera(Map, radius, weight); camera.IsOn = m_isOn; m_mapCameras.Add(camera); return(new CameraRef(camera)); }
public void RemakeCamera() { if (!cameraPrefab) { return; } mapCamera = Instantiate(cameraPrefab, transform); DontDestroyOnLoad(mapCamera); }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnRelatedEntityDelete(Entity)"/></summary> protected override void OnRelatedEntityDelete( Entity entity ) { base.OnRelatedEntityDelete( entity ); if( entity == mapCamera ) mapCamera = null; if( entity == mapCurve ) mapCurve = null; }
private void SetCameraToCharacter() { MapCamera mapCamera = FindObjectOfType <MapCamera> (); if (mapCamera != null) { mapCamera.SetPosition(WaypointsMover.transform.position); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { //NeoAxis initialization if (!WPFAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this, "user:Logs/WPFAppExample.log", true, null, null, null, null)) { Close(); return; } UpdateVolume(); renderTargetUserControl1.AutomaticUpdateFPS = 60; renderTargetUserControl1.KeyDown += renderTargetUserControl1_KeyDown; renderTargetUserControl1.KeyUp += renderTargetUserControl1_KeyUp; renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown; renderTargetUserControl1.MouseUp += renderTargetUserControl1_MouseUp; renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove; renderTargetUserControl1.Tick += renderTargetUserControl1_Tick; renderTargetUserControl1.Render += renderTargetUserControl1_Render; renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI; const string startMapName = "Maps\\MainMenu\\Map.map"; //generate map list { string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { comboBoxMaps.Items.Add(mapName); if (mapName == startMapName) { comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1; } } } //load map WPFAppWorld.MapLoad(startMapName, true); //set camera position if (Map.Instance != null) { MapCamera mapCamera = FindFirstMapCamera(); if (mapCamera != null) { freeCameraPosition = mapCamera.Position; freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward()); } else { freeCameraPosition = Map.Instance.EditorCameraPosition; freeCameraDirection = Map.Instance.EditorCameraDirection; } } }
static public MapCamera init(MapWorld aWorld) { MapCamera tCamera = MyBehaviour.create <MapCamera>(); tCamera.mWorld = aWorld; tCamera.mCamera = tCamera.createChildCamera(aWorld.mSize.y); tCamera.mConfig = new MapCameraConfig(); tCamera.positionZ = -10; return(tCamera); }
void OnClickLod0(Vector2 screenPos) { Ray ray = MapCamera.ScreenPointToRay(screenPos); RaycastHit[] hits = Physics.RaycastAll(ray); // map space Coord c = Layout.ScreenPos2Coord(MapCamera, screenPos); DoClickOnTile(c); }
void Awake() { mainObject = GameObject.Find("MainObject"); mapCamera = GameObject.Find("MapCamera").GetComponent <MapCamera>(); NetworkManager.Listen( NetworkCode.ZONE, ProcessZone ); }
void Awake() { mainObject = GameObject.Find("MainObject"); mapCamera = GameObject.Find("MapCamera").GetComponent<MapCamera>(); NetworkManager.Listen( NetworkCode.ZONE, ProcessZone ); }
public void SetCamera(MapObject cameraOrCameraCurve) { camera = cameraOrCameraCurve as MapCamera; cameraCurve = cameraOrCameraCurve as MapCameraCurve; if (cameraCurve != null) { cameraCurveTime = cameraCurve.GetCurveTimeRange().Minimum; } oldCameraCurveTime = cameraCurveTime; }
public IEnumerator RawNextMapRoutine() { bool swapped = false; pc.GetComponent <MapEvent>().SetLocation(new Vector2Int(0, 0)); activeMap.GetComponent <BattleController>().Clear(); MapGenerator oldGen = activeMap.GetComponent <MapGenerator>(); Map oldMap = activeMap; int level = oldGen.level; MapGenerator newGen = activeMap.gameObject.AddComponent <MapGenerator>(); newGen.GenerateMesh(oldGen); Destroy(oldGen); activeMap.GetComponent <LineOfSightEffect>().Erase(); if (activeMap != oldMap) { swapped = true; pc.GetComponent <CharaEvent>().facing = EightDir.N; Destroy(oldGen.gameObject); activeMap.AddEvent(pc.GetComponent <MapEvent>()); } MapCamera cam = FindObjectOfType <MapCamera>(); if (cam.target != pc.GetComponent <MapEvent3D>()) { cam.target = activeMap.GetEventNamed("ZoomTarget").GetComponent <MapEvent3D>(); } activeMap.GetComponent <LineOfSightEffect>().RegenSitemap(activeMap.GetComponent <TacticsTerrainMesh>()); RogueUI ui = FindObjectOfType <RogueUI>(); ui.narrator.Clear(); if (level == 0 && !seenTutorial) { seenTutorial = true; yield return(ui.TutorialRoutine()); } yield return(ui.EditSpellsRoutine()); Vector2Int loc = activeMap.GetEventNamed("TeleStart").location; EightDir dir = pc.GetComponent <CharaEvent>().facing; loc += dir.XY() * -2; pc.GetComponent <MapEvent>().SetLocation(loc); activeMap.GetComponent <LineOfSightEffect>().RecalculateVisibilityMap(); if (swapped) { StartCoroutine(activeMap.GetComponent <BattleController>().BattleRoutine()); } }
public Vector3 MapPointToWorldPoint(Vector3 mousePosition) { Rect screenSpaceRect = ZetanUtility.GetScreenSpaceRect(UI.mapRect); Vector3[] corners = new Vector3[4]; UI.mapRect.GetWorldCorners(corners); Vector2 mapViewportPoint = new Vector2((mousePosition.x - corners[0].x) / screenSpaceRect.width, (mousePosition.y - corners[0].y) / screenSpaceRect.height); Vector3 worldPosition = MapCamera.ViewportToWorldPoint(mapViewportPoint); return(use2D ? new Vector3(worldPosition.x, worldPosition.y) : worldPosition); }
public IEnumerator TeleportRoutine(string mapName, string targetEventName) { TransitionData data = Global.Instance().Database.Transitions.GetData(DefaultTransitionTag); yield return(camera.GetComponent <FadeImageEffect>().FadeRoutine(data.GetFadeOut())); StartCoroutine(avatar.GetComponent <CharaEvent>().FadeRoutine(0.1f, true)); RawTeleport(mapName, targetEventName); camera = activeMap.GetComponentInChildren <MapCamera>(); yield return(camera.GetComponent <FadeImageEffect>().FadeRoutine(data.GetFadeIn(), true)); }
public static Vector3 GetWorldCoordinate(Vector3 mousePos) { Vector3 worldMouse = mousePos; worldMouse.z = MapObject.transform.localPosition.z; worldMouse = MapCamera.ScreenToWorldPoint(worldMouse); ////Debug.Log("Mouse position in world [" + worldMouse.x + "," + worldMouse.y + "," + worldMouse.z + "]"); return(worldMouse); }
public override void OnInspectorGUI() { DrawDefaultInspector(); MapCamera camera = (MapCamera)target; if (GUILayout.Button("Reset Camera")) { camera.ResetCamera(); } }
public void Setup() { mapCamera = CreateTestMapCamera(); cameraXBounds = new Vector2(-10, 10); cameraYBounds = new Vector2(-10, 10); cameraZoomBounds = new Vector2(3, 10); mapCamera.SetCameraBounds(cameraXBounds.x, cameraXBounds.y, cameraYBounds.x, cameraYBounds.y); initialOrthographicSize = mapCamera.camera.orthographicSize; initialXPos = mapCamera.transform.position.x; initialYPos = mapCamera.transform.position.y; }
private void Awake() { _controlCamera = GetComponent<Camera>(); _controlCamera.transform.forward = -Vector3.one; _cameraDistance = 100f; CameraRotateSpace(); _pan = Vector2.zero; _current = this; }
public WorldText(MapCamera mapCamera, Vector2 positionInWorld, SpriteFont spriteFont, Color color, string text, TimeSpan duration, Vector2 trail, bool drawShadow) { MapCamera = mapCamera; PositionInWorld = positionInWorld; SpriteFont = spriteFont; Color = color; Text = text; Duration = duration; TimeSince = TimeSpan.FromSeconds(0); Trail = trail; DrawShadow = drawShadow; }
protected override void OnRender() { base.OnRender(); //Update camera orientation if (Map.Instance != null) { Vec3 from = Vec3.Zero; Vec3 to = new Vec3(1, 0, 0); float fov = 75; MapCamera mapCamera = Entities.Instance.GetByName("MapCamera_MainMenu") as MapCamera; if (mapCamera != null) { from = mapCamera.Position; to = from + mapCamera.Rotation.GetForward(); if (mapCamera.Fov != 0) { fov = mapCamera.Fov; } } Camera camera = RendererWorld.Instance.DefaultCamera; camera.NearClipDistance = Map.Instance.NearFarClipDistance.Minimum; camera.FarClipDistance = Map.Instance.NearFarClipDistance.Maximum; camera.FixedUp = Vec3.ZAxis; camera.Fov = fov; camera.Position = from; camera.LookAt(to); //update game specific options { //water reflection level foreach (WaterPlane waterPlane in WaterPlane.Instances) { waterPlane.ReflectionLevel = GameEngineApp.WaterReflectionLevel; } //decorative objects if (DecorativeObjectManager.Instance != null) { DecorativeObjectManager.Instance.Visible = GameEngineApp.ShowDecorativeObjects; } //HeightmapTerrain //enable simple rendering for Low material scheme. foreach (HeightmapTerrain terrain in HeightmapTerrain.Instances) { terrain.SimpleRendering = GameEngineApp.MaterialScheme == MaterialSchemes.Low; } } } }
MapCamera FindFirstMapCamera() { foreach (Entity entity in Map.Instance.Children) { MapCamera mapCamera = entity as MapCamera; if (mapCamera != null) { return(mapCamera); } } return(null); }
// protected override void OnAttach() { base.OnAttach(); //load the HUD screen hudControl = ControlDeclarationManager.Instance.CreateControl( "Maps\\JigsawPuzzleGame\\JigsawPuzzleGameHUD.gui"); //attach the HUD screen to the this window Controls.Add(hudControl); if (EntitySystemWorld.Instance.IsSingle()) { //hide chat edit box for single mode hudControl.Controls["ChatText"].Visible = false; hudControl.Controls["ChatMessage"].Visible = false; } //AnotherMap button if (EntitySystemWorld.Instance.IsSingle()) { ((Button)hudControl.Controls["AnotherMap"]).Click += delegate(Button sender) { GameWorld.Instance.NeedChangeMap("Maps\\MainDemo\\Map.map", "Teleporter_Maps", null); }; } else hudControl.Controls["AnotherMap"].Visible = false; chatMessageEditBox = (EditBox)hudControl.Controls["ChatMessage"]; chatMessageEditBox.PreKeyDown += ChatMessageEditBox_PreKeyDown; //find first map camera foreach (Entity entity in Map.Instance.Children) { mapCamera = entity as MapCamera; if (mapCamera != null) break; } //for chat support GameNetworkServer server = GameNetworkServer.Instance; if (server != null) server.ChatService.ReceiveText += Server_ChatService_ReceiveText; GameNetworkClient client = GameNetworkClient.Instance; if (client != null) client.ChatService.ReceiveText += Client_ChatService_ReceiveText; }
private void setCurrentCamera(MapCamera camera) { currentCamera = camera; currentCamera.Activate(); }
public void SetCamera( MapObject cameraOrCameraCurve ) { camera = cameraOrCameraCurve as MapCamera; cameraCurve = cameraOrCameraCurve as MapCameraCurve; if( cameraCurve != null ) cameraCurveTime = cameraCurve.GetCurveTimeRange().Minimum; oldCameraCurveTime = cameraCurveTime; }
protected override void OnAttach() { base.OnAttach(); positionY = maxout; if (spawner == null) spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; if (camera == null) camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; MechsPriceList = (PriceListC)Entities.Instance.Create("MechPriceList", Map.Instance); AunitPriceList = (PriceListC)Entities.Instance.Create("AunitPriceList", Map.Instance); GunitPriceList = (PriceListC)Entities.Instance.Create("GunitPriceList", Map.Instance); JunitPriceList = (PriceListC)Entities.Instance.Create("JunitPriceList", Map.Instance); GetListOfPlayerUnits(); cash = GetPlayerCashSQL(); InitCameraViewFromTarget(); //positionY = maxout; }
protected override void OnAttach() { base.OnAttach(); window = ControlDeclarationManager.Instance.CreateControl("Gui\\TechLabUnitCustomizeWindow.gui"); Controls.Add(window); if (spawner == null) spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; else spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; if (camera == null) camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; else camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; //declare controls btnMechs = (Button)window.Controls["Mechs"]; btnMechs.Click += new Button.ClickDelegate(btnMechs_Click); btnGroundUnits = (Button)window.Controls["Gunit"]; btnGroundUnits.Click += new Button.ClickDelegate(btnGroundUnits_Click); btnAirUnits = (Button)window.Controls["Aunit"]; btnAirUnits.Click += new Button.ClickDelegate(btnAirUnits_Click); btnJets = (Button)window.Controls["Junit"]; btnJets.Click += new Button.ClickDelegate(btnJets_Click); btnNext = (Button)window.Controls["Next"]; btnNext.Click += new Button.ClickDelegate(btnNext_Click); btnPrevious = (Button)window.Controls["Previous"]; btnPrevious.Click += new Button.ClickDelegate(btnPrevious_Click); btnRA = (Button)window.Controls["RA"]; btnRA.Click += new Button.ClickDelegate(btnRA_Click); btnRT = (Button)window.Controls["RT"]; btnRT.Click += new Button.ClickDelegate(btnRT_Click); btnCT = (Button)window.Controls["CT"]; btnCT.Click += new Button.ClickDelegate(btnCT_Click); btnLT = (Button)window.Controls["LT"]; btnLT.Click += new Button.ClickDelegate(btnLT_Click); btnLA = (Button)window.Controls["LA"]; btnLA.Click += new Button.ClickDelegate(btnLA_Click); //iNCIN -- SlotList cbxWeaponSlots = (ListBox)window.Controls["SlotList"]; cbxWeaponSlots.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(cbxWeaponSlots_SelectedIndexChange); cbxVariantList = (ListBox)window.Controls["VariantList"]; cbxVariantList.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(cbxVariantList_SelectedIndexChange); lstWeaponList = (ListBox)window.Controls["WeaponList"]; lstWeaponList.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(lstWeaponList_SelectedIndexChange); btnAddWeapon = (Button)window.Controls["AddWeapon"]; btnAddWeapon.Click += new Button.ClickDelegate(btnAddWeapon_Click); txtWeaponInfo = (EditBox)window.Controls["WeaponInfo"]; txtCash = (TextBox)window.Controls["Cash"]; btnSaveVariant = (Button)window.Controls["SaveCustomUnit"]; btnSaveVariant.Click += new Button.ClickDelegate(btnSaveVariant_Click); btnExit = (Button)window.Controls["Quit"]; btnExit.Click += new Button.ClickDelegate(btnExit_Click); txtUnitName = (TextBox)window.Controls["UnitName"]; MechsPriceList = (PriceListC)Entities.Instance.Create("MechPriceList", Map.Instance); AunitPriceList = (PriceListC)Entities.Instance.Create("AunitPriceList", Map.Instance); GunitPriceList = (PriceListC)Entities.Instance.Create("GunitPriceList", Map.Instance); JunitPriceList = (PriceListC)Entities.Instance.Create("JunitPriceList", Map.Instance); GetListOfPlayerUnits(); cash = GetPlayerCashSQL(); if (MechDBUnits.Count == 0) btnMechs.Enable = false; if (ADBUnits.Count == 0) btnAirUnits.Enable = false; if (GDBUnits.Count == 0) btnGroundUnits.Enable = false; if (JDBUnits.Count == 0) btnJets.Enable = false; if (MechDBUnits.Count == 0 || ADBUnits.Count == 0 || GDBUnits.Count == 0 || JDBUnits.Count == 0) { //player has not bought any units Log.Info("No units purchased. TODO: ask user if they want to go to buy window"); } InitCameraViewFromTarget(); //positionY = maxout; spawner.UnitSpawned += new Spawner.OnUnitSpawned(spawner_UnitSpawned); }
protected override void OnAttach() { window = ControlDeclarationManager.Instance.CreateControl("Gui\\TechLabUnitBuyWindow.gui"); Controls.Add(window); if (spawner == null) spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; else spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; if (camera == null) camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; else camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; btnMechs = (Button)window.Controls["Mechs"]; btnMechs.Click += new Button.ClickDelegate(btnMechs_Click); btnGroundUnits = (Button)window.Controls["Gunit"]; btnGroundUnits.Click += new Button.ClickDelegate(btnGroundUnits_Click); btnAirUnits = (Button)window.Controls["Aunit"]; btnAirUnits.Click += new Button.ClickDelegate(btnAirUnits_Click); btnJets = (Button)window.Controls["Junit"]; btnJets.Click += new Button.ClickDelegate(btnJets_Click); btnExit = (Button)window.Controls["Quit"]; btnExit.Click += new Button.ClickDelegate(btnExit_Click); btnNext = (Button)window.Controls["Next"]; btnNext.Click += new Button.ClickDelegate(btnNext_Click); btnPrevious = (Button)window.Controls["Previous"]; btnPrevious.Click += new Button.ClickDelegate(btnPrevious_Click); btnBuy = (Button)window.Controls["Buy"]; btnBuy.Click += new Button.ClickDelegate(btnBuy_Click); txtUnitName = (TextBox)window.Controls["UnitName"]; txtUnitCost = (TextBox)window.Controls["UnitCost"]; txtCash = (TextBox)window.Controls["Cash"]; txtCash.Text = "Cash: " + cash.ToString(); lstWeapons = (ListBox)window.Controls["Weapons"]; spawner.UnitSpawned += new Spawner.OnUnitSpawned(spawner_UnitSpawned); InitCameraViewFromTarget(); //positionY = maxout; MechsPriceList = (PriceListC)Entities.Instance.Create("MechPriceList", Map.Instance); AunitPriceList = (PriceListC)Entities.Instance.Create("AunitPriceList", Map.Instance); GunitPriceList = (PriceListC)Entities.Instance.Create("GunitPriceList", Map.Instance); JunitPriceList = (PriceListC)Entities.Instance.Create("JunitPriceList", Map.Instance); GetListOfPlayerUnits(); cash = GetPlayerCashSQL(); base.OnAttach(); }
public CameraManager(MapCamera initialCamera) { setCurrentCamera(initialCamera); }
public void SetCamera(MapCamera camera) { currentCamera.Deactivate(); setCurrentCamera(camera); }
protected override void Awake() { base.Awake(); _camera = GetComponent<Camera>(); _instance = this; }
public void ResetCamera() { camera = null; cameraCurve = null; }