private void Update() { if (Input.GetKeyDown(KeyCode.W) && !CameraControler.IsInputFieldFocused()) { if (Position.interactable) { ChangeControler(0); } } else if (Input.GetKeyDown(KeyCode.E) && !CameraControler.IsInputFieldFocused()) { if (Rotation.interactable) { ChangeControler(1); } } else if (Input.GetKeyDown(KeyCode.R) && !CameraControler.IsInputFieldFocused()) { if (Scale.interactable) { ChangeControler(2); } } else if (Input.GetKeyDown(KeyCode.T) && !CameraControler.IsInputFieldFocused()) { if (Snap.interactable) { ToggleSnap(); } } }
void LateUpdate() { if (MenuOpen) { if (ButtonClicked) { ButtonClicked = false; return; } if (Input.GetMouseButtonUp(0)) { foreach (GameObject obj in Popups) { obj.SetActive(false); } foreach (Button but in Buttons) { but.interactable = true; } MenuOpen = false; } } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.S) && !CameraControler.IsInputFieldFocused()) { MapLuaParser.Current.SaveMap(); } }
// Use this for initialization void Start() { _GameControler = FindObjectOfType <GameControler>(); _GameManager = FindObjectOfType <GameManager>(); _cameraControler = FindObjectOfType <CameraControler>(); _SoundControler = FindObjectOfType <SoundControler>(); }
void Update() { if (!Active) { return; } if (!CameraControler.IsInputFieldFocused()) { if (AllowRemove && Input.GetKeyDown(KeyCode.Delete)) { DestroySelectedObjects(); } if (Input.GetKeyDown(KeyCode.C) && Input.GetKey(KeyCode.LeftControl)) { //Copy CopyAction?.Invoke(); } else if (Input.GetKeyDown(KeyCode.V) && Input.GetKey(KeyCode.LeftControl)) { //Paste PasteAction?.Invoke(); } else if (Input.GetKeyDown(KeyCode.D) && Input.GetKey(KeyCode.LeftControl)) { //Duplicate DuplicateAction?.Invoke(); } } }
public static void ExecuteDuplicateAction() { if (Current.Active && !CameraControler.IsInputFieldFocused()) { DuplicateAction?.Invoke(); } }
void HideUpdate() { if (Input.GetKeyDown(KeyCode.H) && !CameraControler.IsInputFieldFocused()) { HashSet <OzoneDecal> Selected = SelectedDecals; if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.LeftShift)) { // Unhide foreach (OzoneDecal Obj in Selected) { Obj.Dec.Shared.Hidden = false; } DecalSettings.Loaded.Hidden = false; } else { // Hide foreach (OzoneDecal Obj in Selected) { Obj.Dec.Shared.Hidden = true; } DecalSettings.Loaded.Hidden = true; } DecalsList.UpdateSelection(); } }
public void CustomizeAccepted() { #if UNITY_EDITOR //animUtils = GetComponent<AnimationCreaterUtils>(); //animUtils.CreateSprite("back/back_place","back2_both_quiver","sprite/items/back/male/quiver"); #endif PlayerController.playerExists = true; UIManager.UIexist = true; DontDestroyOnLoad(playerObject); DontDestroyOnLoad(uiObject); thePlayer.activeScene = mainGameScen; menuScript.isGameRun = true; //var clone = FindObjectOfType<CameraControler>(); //clone.GetComponent<Camera>().orthographicSize = 5.0f; //clone.offset = new Vector2(0,0); theCamera = FindObjectOfType <CameraControler>(); theCamera.GetComponent <Camera>().orthographicSize = 5.0f; theCamera.offset = new Vector2(0, 0); //thePlayer.joyAction.gameObject.SetActive(true); thePlayer.joyAttack.gameObject.SetActive(true); thePlayer.joySpell.gameObject.SetActive(true); hpSlider.gameObject.SetActive(true); theLoadingScript.loading.SetActive(true); StartCoroutine(theLoadingScript.LoadLevelWithBar(mainGameScen)); //SceneManager.LoadScene(mainGameScen); }
private void Update() { if (UpdateSelectedMatrixes) { UpdateSelectedMatrixes = false; for (int i = 0; i < SelectionManager.Current.Selection.Ids.Count; i++) { AllObjects[SelectionManager.Current.Selection.Ids[i]].GetComponent <UnitInstance>().UpdateMatrixTranslated(); } for (int s = 0; s < SelectionManager.Current.SymetrySelection.Length; s++) { for (int i = 0; i < SelectionManager.Current.SymetrySelection[s].Ids.Count; i++) { AllObjects[SelectionManager.Current.SymetrySelection[s].Ids[i]].GetComponent <UnitInstance>().UpdateMatrixTranslated(); } } } if (Input.GetKeyDown(KeyCode.P) && FirstSelected != null && !CameraControler.IsInputFieldFocused()) { // Parent all groups to selected ReparrentGroups(); // Parent all units to selected ReparrentUnits(); Generate(); } }
public void FocusCameraMarker() { Vector3 FocusPos = SelectedGameObjects[0].transform.position; //Quaternion FocusRot = Quaternion.Euler(Vector3.up * -180) * SelectedGameObjects[0].transform.rotation * Quaternion.Euler(Vector3.right * -90); Quaternion FocusRot = Quaternion.LookRotation(-SelectedGameObjects[0].transform.forward, SelectedGameObjects[0].transform.up); CameraControler.FocusCamera(FocusPos, FocusRot, SelectedGameObjects[0].GetComponent <MarkerObject>().Owner.zoom * 0.1f); }
void Awake() { _instance = this; sRigidBody = GetComponent <Rigidbody>(); sCapsuleCollider = GetComponent <CapsuleCollider>(); cameras = GetComponentsInChildren <Camera>(); SetCameraLayer(); }
// Use this for initialization void Start() { ThePlayer = FindObjectOfType <PlayerController>(); ThePlayer.transform.position = transform.position; TheCamera = FindObjectOfType <CameraControler>(); TheCamera.transform.position = new Vector3(transform.position.x, transform.position.y, TheCamera.transform.position.z); }
// Use this for initialization void Start() { bounds = GetComponent <BoxCollider2D>(); theCamera = FindObjectOfType <CameraControler>(); theCamera.setBounds(bounds); theCamera.fallowTarget = FindObjectOfType <PlayerController>().gameObject; }
private void Start() { GetComponent <Buildings>().Building(); isFortressControlledByPlayer = true; fButton = Instantiate(fortressButton); fButton.transform.parent = FindObjectOfType <Canvas>().transform; cameraControler = FindObjectOfType <CameraControler>(); terrain = FindObjectOfType <Terrain>(); }
void Start() { camControler = GameObject.FindGameObjectWithTag("CameraController").GetComponent <CameraControler>(); timeMaster = GameObject.FindGameObjectWithTag("TimeMaster").GetComponent <TimeMaster>(); cpMaster = GameObject.FindGameObjectWithTag("cpMaster").GetComponent <CheckpointMaster>(); resetLevel = GameObject.FindGameObjectWithTag("LevelReset").GetComponent <ResetLevel>(); levelBlockade = GameObject.FindGameObjectWithTag("LevelBlockade"); levelBlockade.SetActive(false); }
private bool m_bInitHKSDK;//标记华康SDK是否初始化成功 public MainWindow() { InitializeComponent(); this.DoubleBuffered = true; cameraControler = new CameraControler(); iSelectedIndex = 0; }
// Use this for initialization void Start() { _UIManager = FindObjectOfType <UIManager>(); _cameraControler = FindObjectOfType <CameraControler>(); _numberText = GetComponent <NumberTextScale>(); _GameManager = FindObjectOfType <GameManager>(); _BgControler = FindObjectOfType <BackgoundSoundControler>(); _BgControler.PlayBackground(true); _SoundControler = FindObjectOfType <SoundControler>(); }
//GameObject LastSelectObject; public void SelectObject(GameObject Obj) { int ObjectId = GetIdOfObject(Obj); bool contains = Selection.Ids.Contains(ObjectId); if (contains && !IsSelectionRemove() && !IsSelectionAdd()) { if (Time.time < LastClickTime + 0.2f) { CameraControler.FocusOnObject(Obj); } LastClickTime = Time.time; return; } //LastSelectObject = Obj; LastClickTime = Time.time; if (ObjectId >= 0) { Undo.Current.RegisterSelectionChange(); if (IsSelectionRemove()) { if (contains) { Selection.Ids.Remove(ObjectId); FinishSelectionChange(); } } else if (IsSelectionAdd()) { if (!contains) { Selection.Ids.Add(ObjectId); FinishSelectionChange(); } } else { if (Selection.Ids.Count == 1 && Selection.Ids[0] == ObjectId) { } else { Selection.Ids = new List <int>(); Selection.Ids.Add(ObjectId); FinishSelectionChange(); } } } }
void Start() { this.cameraControler = this.gameObject.AddComponent<CameraControler> (); this.doorController = this.gameObject.AddComponent<DoorController> (); this.inventory = this.gameObject.AddComponent<Inventory> (); this.lightManager = this.gameObject.AddComponent<LightManager> (); this.playerController = this.gameObject.AddComponent<PlayerController> (); this.cameraControler.lightManager = this.lightManager; this.gameObject.name = "Player"; }
void Start() { this.cameraControler = this.gameObject.AddComponent <CameraControler> (); this.doorController = this.gameObject.AddComponent <DoorController> (); this.inventory = this.gameObject.AddComponent <Inventory> (); this.lightManager = this.gameObject.AddComponent <LightManager> (); this.playerController = this.gameObject.AddComponent <PlayerController> (); this.cameraControler.lightManager = this.lightManager; this.gameObject.name = "Player"; }
// Use this for initialization void Start() { thePlayer = FindObjectOfType <PlayerController>(); if (thePlayer.startPoint == pointName) { thePlayer.transform.position = transform.position; thePlayer.lastMove = StartDirection; theCamera = FindObjectOfType <CameraControler>(); theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z); } }
void Start() { cameraControler = GameObject.Find("Main Camera").GetComponent <CameraControler>(); ball = Instantiate(ballPrefub); cameraControler.Ball = ball; LevelColorsSet = new Dictionary <string, Color32>() { ["road"] = new Color32(255, 255, 255, 255), ["bg"] = new Color32(36, 70, 121, 255), ["ambient"] = new Color32(32, 134, 255, 255) }; }
void Update() { if (!Active) { return; } if (AllowRemove && Input.GetKeyDown(KeyCode.Delete) && !CameraControler.IsInputFieldFocused()) { DestroySelectedObjects(); } }
void RegisterPlayer(string _ID) { IDs = _ID; transform.name = "Character" + _ID; Character = Player.transform.FindChild("Character" + _ID).gameObject; Healthbarcanvas = Character.transform.FindChild("Healthbar canvas").gameObject; HealthBarBackground = Healthbarcanvas.transform.FindChild("Health background").gameObject; HealthIndicator = HealthBarBackground.transform.FindChild("Health indicator").gameObject; Healthbar = HealthIndicator.GetComponent <Image>(); ThunderArrow = Character.GetComponent <ThunderArrow>(); Attackrange = Character.transform.FindChild("AttackRange").gameObject; AttackTrigger = Attackrange.GetComponent <AttackTrigger>(); ItemTest = Character.GetComponent <ItemTest>(); inventorycanvas = Player.transform.FindChild("Canvas").gameObject; tooltip = inventorycanvas.transform.FindChild("Tooltip").gameObject; INVcancas = inventorycanvas.GetComponent <Canvas>(); Battletextmanager = Player.transform.FindChild("BattleTextManager").gameObject; scrolltextmanager = Battletextmanager.GetComponent <scrolltextmanager>(); Inventory = Player.transform.FindChild("Inventory").gameObject; showinv = inventorycanvas.GetComponent <showinv>(); inv = Inventory.GetComponent <Inventory>(); statscanvas = Player.transform.FindChild("Canvas - stats - map").gameObject; StatsPanel = statscanvas.transform.FindChild("Stats Panel").gameObject; Statsloader = StatsPanel.GetComponent <Statsloader>(); Camera = Player.transform.FindChild("Camera").gameObject; if (SceneManager.GetActiveScene().name != "Multiplayer Arena") { Teleporter = GameObject.Find("teleporter"); teleporter = Teleporter.GetComponent <Teleporter>(); teleporter.SetCharacter(_ID); shop = GameObject.Find("Shop"); shopdamage = shop.GetComponent <shopdamage>(); shopdamage.shopset(_ID); } CameraControler = Camera.GetComponent <CameraControler>(); PlayerAttack = Character.GetComponent <PlayerAttack>(); Tooltip = tooltip.GetComponent <Tooltip>(); ThunderArrow.Starting(_ID); AttackTrigger.setattack(_ID); scrolltextmanager.Set(_ID); inv.Houi(_ID); showinv.setupinventory(_ID); PlayerAttack.SetAttack(_ID); Statsloader.SetupStats(_ID); CameraControler.SetCamera(_ID); Tooltip.settooltip(_ID); inv.fillinventory(); }
private void Update() { if (Connect.activeSelf && !Input.GetKey(KeyCode.LeftControl)) { if (Input.GetKeyDown(KeyCode.C) && !CameraControler.IsInputFieldFocused()) { ConnectSelected(); } else if (Input.GetKeyDown(KeyCode.D) && !CameraControler.IsInputFieldFocused()) { DisconnectSelected(); } } }
public void SampleNearCutoffFromCamera() { Undo.RegisterUndo(new UndoHistory.HistoryDecalsValues()); float Dist = (int)CameraControler.GetCurrentZoom(); HashSet <OzoneDecal> .Enumerator ListEnum = DecalsInfo.Current.SelectedDecals.GetEnumerator(); while (ListEnum.MoveNext()) { ListEnum.Current.NearCutOffLOD = Dist; } ListEnum.Dispose(); UpdateSelection(); }
private void Awake() { var listener = EventTriggerListener.Get(gameObject); listener.onClick += OnClickInternal; listener.onPressBegin += OnBeginDrag; listener.onPressMove += OnDrag; listener.onPressEnd += OnDragEnd; if (Controler == null) { Controler = GetComponentInParent <CameraControler>(); } }
private void CalculateView() { Camera camera = FindObjectOfType <Camera>(); CameraControler cameraControler = camera.GetComponent <CameraControler>(); float cameraSize = cameraControler.GetSize(); cameraSize = Mathf.Ceil(cameraSize); viewWidth = (int)cameraSize; viewHeight = (int)cameraSize * 2; int fullViewWidth = viewWidth + 2; int fullViewHeight = viewHeight + 2; int numberOfViewTiles = fullViewWidth * fullViewHeight; viewTiles = new GameObject[numberOfViewTiles]; float startX = camera.transform.position.x - (cameraSize / 2 + 1); float startY = camera.transform.position.y - (cameraSize + 1); // Limit view tiles to map limits startX = Mathf.Clamp(startX, 0, mapWidth - cameraControler.GetSize()); startY = Mathf.Clamp(startY, 0, mapHeight - cameraControler.GetSize()); startX = Mathf.Floor(startX); startY = Mathf.Floor(startY); float unitSize = 1.00f; // wi - width index // hi - height index for (int wi = 0; wi < fullViewWidth; wi++) { for (int hi = 0; hi < fullViewHeight; hi++) { Vector2 newPosition = new Vector2(startX + wi * unitSize, startY + hi * unitSize); GameObject newViewTile = Instantiate(viewTilePrefab, newPosition, Quaternion.identity) as GameObject; newViewTile.transform.parent = this.transform; newViewTile.name = "viewTile [" + wi + "][" + hi + "]"; ViewTile vt = newViewTile.GetComponent <ViewTile>(); vt.x = (int)startX + wi; vt.y = (int)startY + hi; viewTiles[wi * fullViewHeight + hi] = newViewTile; } } }
void Start() { if (Instance == null) { Instance = this; Instance.cameraOffset = Camera.main.transform.position - startLoockAt.position; defaultRotation = Camera.main.transform.rotation; GameManager.Instance.RestartEvent += Instance.RestartCamera; } else { Destroy(gameObject); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); //获取组件 CameraControler sTarget = (CameraControler)target; //数据不为空 if (sTarget.sObj != null) { editor = CreateEditor(sTarget.sObj); //editor.DrawDefaultInspector(); editor.OnInspectorGUI(); //sObj.SetInOutAll();//刷新所有值 } else { editor = null; //新建按钮 if (GUILayout.Button("New")) { //文件夹路径 string assetPath = "Assets/SunRise720/Preset/CameraPosition/"; if (!Directory.Exists(assetPath)) { Directory.CreateDirectory(assetPath); } //文件路径 string assetName = "Cam"; string path = Path.Combine(assetPath, assetName + ".asset"); FileInfo fileInfo = new FileInfo(path); //文件同名 if (fileInfo.Exists) { assetName += ("_" + Sun.Rise.GetGUIDLast()); path = Path.Combine(assetPath, assetName + ".asset"); } CameraTargetScriptableObject newAsset = CreateInstance <CameraTargetScriptableObject>(); AssetDatabase.CreateAsset(newAsset, path); sTarget.sObj = newAsset; } } }
void Start() { GameObject Sphere = GameObject.Instantiate(ballPrefab); Sphere.name = "Sphere"; Sphere.transform.position = transform.position + Vector3.up * 2f; Camera camera = GameObject.Instantiate(cameraPrefab); CameraControler cameraControler = camera.GetComponent <CameraControler>(); cameraControler.Sphere = Sphere.transform; Light light = GameObject.Instantiate(lightPrefab); light.color = Color.white; light.intensity = 0.5f; RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Flat; RenderSettings.ambientLight = Color.white * 0.7f; }
public void AlighCameraMarker() { if (Count <= 0) { return; } Undo.RegisterUndo(new UndoHistory.HistoryMarkersChange(), new UndoHistory.HistoryMarkersChange.MarkersChangeHistoryParameter(AllMarkers)); SelectedGameObjects[0].GetComponent <MarkerObject>().Tr.position = CameraControler.Current.Pivot.localPosition; SelectedGameObjects[0].GetComponent <MarkerObject>().Owner.zoom = CameraControler.GetCurrentZoom(); Quaternion rot = Quaternion.LookRotation(-CameraControler.Current.Pivot.forward, CameraControler.Current.Pivot.up); //Quaternion rot = Quaternion.Euler(Vector3.up * 180) * CameraControler.Current.Pivot.localRotation * Quaternion.Euler(Vector3.right * 90); SelectedGameObjects[0].GetComponent <MarkerObject>().Tr.rotation = rot; SelectionManager.Current.FinishSelectionChange(); }
void Awake(){ Current = this; }