private void UpdateCameraInput() { if (MouseCondition.Scrolled()) { int scrollDelta = MouseCondition.ScrollDelta; _targetExp = MathHelper.Clamp(_targetExp - scrollDelta * _expDistance, _maxExp, _minExp); } if (RotateLeft.Pressed()) { _targetRotation += MathHelper.Pi / 8f; } if (RotateRight.Pressed()) { _targetRotation -= MathHelper.Pi / 8f; } _mouseWorld = Vector2.Transform(InputHelper.NewMouse.Position.ToVector2(), Matrix.Invert(GetView())); if (CameraDrag.Pressed()) { _dragAnchor = _mouseWorld; _isDragged = true; } if (_isDragged && CameraDrag.HeldOnly()) { _xy += _dragAnchor - _mouseWorld; _mouseWorld = _dragAnchor; } if (_isDragged && CameraDrag.Released()) { _isDragged = false; } }
void Start() { _camera = Camera.main; _zoomOrigin = _camera.orthographicSize; _resetCamera = _camera.transform.position; instance = this; _maxLocY += Build.instance.EtageList.Count; }
void Awake() { this.gameObject.SetActive(false); closeBtn.GetComponent <Button>().onClick.AddListener(() => { Close(); }); startBtn.GetComponent <Button>().onClick.AddListener(() => { GameStart(stage.Name); }); cameraDrag = GameObject.FindWithTag("MainCamera").GetComponent <CameraDrag>(); raycastTouch = GameObject.Find("Map").GetComponent <RaycastTouch>(); }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
public void Init() { cardWidth = this.GetComponent <RectTransform>().sizeDelta.x; cardHeight = this.GetComponent <RectTransform>().sizeDelta.y; // WIP : essayer de les récupérer autrement player = GameObject.Find("Player"); movingCardParent = GameObject.Find("MovingCardParent").transform; hand = GameObject.Find("Hand").transform; effectsParent = GameObject.Find("EffectsParent").transform; discardPilePos = GameObject.Find("discarPilePos").transform; _card = gameObject.GetComponent <CardDisplay>().card; mainCamera = Camera.main.GetComponentInParent <CameraDrag>(); myCanvasUI = GameObject.Find("CardDropEffect").transform; }
private void Start() { preloaderOverlay.Show(); if (Camera.main == null) { throw new Exception("Add `MainCamera` tag to main camera"); } _cameraDrag = Camera.main.GetComponent <CameraDrag>(); menuButton.onClick.AddListener(ToggleMenuOverlay); closeMenuButton.onClick.AddListener(ToggleMenuOverlay); exitButton.onClick.AddListener(OnExitButtonClick); LoadAndRenderSystem(); }
// Use this for initialization void Start() { CreateTitle(); //Gets all textures from the target folder textures = Resources.LoadAll(targetFolder); cameraDrag = this.GetComponent <CameraDrag>(); //Creates an array of planes in the same size as the textures array GetTextures(); //Adjusts textures spacing //SpaceOut(); //Rename(); ApplyChanges(); ObjectsContainer(); }
Dictionary <Vector3, bool> objectOnGrid = new Dictionary <Vector3, bool>(); //список для хранения координат "купленных" объектов private void Start() { cameraGrag = Camera.main.GetComponent <CameraDrag>();//для блокировки передвижения карты shopPanel.SetActive(false); InitializeGridList(); }
public void Start() { originalRotation = this.transform.rotation; mainCamera = GameObject.Find("Main Camera").GetComponent <CameraDrag>(); }
void Start() { cameraDrag = GameObject.Find("GameManager").GetComponent <CameraDrag> (); }
// Start is called before the first frame update private void Awake() { customizationManager = GameObject.FindObjectOfType <CustomizationManager>(); apiManager = GameObject.FindObjectOfType <ApiManager>(); cameraDrag = GameObject.FindObjectOfType <CameraDrag>(); }
void Awake() { State = Neutral; _instance = this; }
void Awake() { instance = this; }
public override void Awake() { base.Awake(); cUnexplored = Color.red; cameraScript = Camera.main.GetComponent<CameraDrag>(); }
private void UpdateCameraInput(Camera c, int index) { int x = InputHelper.NewMouse.X; int y = InputHelper.NewMouse.Y; if (!_isDragged && CameraContains(c, x, y) || _isDragged && _currentCamera == index) { _currentCamera = index; if (MouseCondition.Scrolled()) { int scrollDelta = MouseCondition.ScrollDelta; SetZoom(c, MathF.Min(MathF.Max(GetZoom(c) - scrollDelta * 0.001f, 0.2f), 10f)); } if (RotateLeft.Pressed()) { c.Rotation += MathHelper.PiOver4; } if (RotateRight.Pressed()) { c.Rotation -= MathHelper.PiOver4; } if (Forward.Held()) { c.Z -= 0.1f; } if (Backward.Held()) { c.Z += 0.1f; } if (IncreaseFocal.Held()) { var temp = c.Z / c.FocalLength; c.FocalLength += 0.01f; c.Z = c.FocalLength * temp; } if (DecreaseFocal.Held()) { var temp = c.Z / c.FocalLength; c.FocalLength -= 0.01f; c.Z = c.FocalLength * temp; } if (ResetCamera.Pressed()) { c.Scale = new Vector2(1f, 1f); c.XY = new Vector2(0f, 0f); c.Z = 2f; c.Rotation = 0f; c.FocalLength = 1f; } _mouseWorld = c.ScreenToWorld(x, y); if (CameraDrag.Pressed()) { _dragAnchor = _mouseWorld; _isDragged = true; } if (_isDragged && CameraDrag.HeldOnly()) { c.XY += _dragAnchor - _mouseWorld; _mouseWorld = _dragAnchor; } if (_isDragged && CameraDrag.Released()) { _isDragged = false; } } }
// Use this for initialization void Awake() { ProfileManager.Instance.Load(); s_Instance = this; //Create arrays _Buildings = new List<Building>(); _Mukyas = new List<Mukya>(); _Diamonds = new List<Diamond>(); _DiamondsActive = new List<Diamond>(); _PlayerDiamonds = new int[DIAMOND_TYPES]; _OngoingResidents = new Hashtable(); //Set camera _Camera = Camera.main; _CameraDrag = _Camera.GetComponent<CameraDrag>(); //Load scene from data CreateScene(); //Default value Money = ProfileManager.Instance.Money; for(int i=0;i<DIAMOND_TYPES;i++) SetDiamond(i, ProfileManager.Instance.Diamonds[i]); //Spawn diamonds StartCoroutine(SpawnDiamonds()); //Background music StartCoroutine(StartBackgroundMusic()); }