void OnGUI() { CursorController.DrawReticule(); /* * // If not paused, removes crosshair on pause * if (Time.timeScale != 0) { * float screenWidth = (Screen.width / 2) - ((cursor.width * cursorScale) / 2); * float screenHeight = (Screen.height / 2) - ((cursor.height * cursorScale) / 2); * float realX = Event.current.mousePosition.x; * float realY = Event.current.mousePosition.y; * * * //float hypotenuse = (float)Math.Sqrt(Math.Pow(Math.Abs((Screen.width / 2) - realX), 2) + Math.Pow((Screen.height / 2) - realY, 2)); * //if (hypotenuse > mousePosSensitivity) { * // float angle = Mathf.Atan2(Math.Abs((Screen.height / 2) - realY), Math.Abs((Screen.width / 2) - realX)); * // realX = (Screen.width / 2) + ((Mathf.Cos(angle) * mousePosSensitivity) * (realX > Screen.width / 2 ? 1 : -1)); * // realY = (Screen.height / 2) + ((Mathf.Sin(angle) * mousePosSensitivity) * (realY > Screen.height / 2 ? 1 : -1)); * //} * * float xPos = realX - ((cursor.width * cursorScale) / 2); * float yPos = realY - ((cursor.height * cursorScale) / 2); * * if (cursor != null) * GUI.DrawTexture(new Rect(xPos, yPos, cursor.width * cursorScale, cursor.height * cursorScale), cursor); * else * Debug.Log("No crosshair texture found"); * } */ }
/// <summary> /// initialization of modules and variables /// </summary> /// <returns></returns> private IEnumerator WaitForInit() { MEHoloEntrance entrance = MEHoloEntrance.Instance; while (!entrance.HasInit) { yield return(null); } //instantiate elements inputManager = MultiInputManager.Instance; inputManager.layerMask = LayerMask.GetMask("Default") | LayerMask.GetMask("UI"); inputManager.cbTap += OnTap; //collaboration module collaborationManager = CollaborationManager.Instance; collaborationManager.AddMessageHandler(this); collaborationManager.cbEnterRoom = cbEnterRoom; //cursor module cursor = UIManager.Instance.cursorController; //it is possible to use more than message. //bear in mind that messages must have different id so string showId = "showId001"; MsgEntry msg = new MsgEntry(); msg.ShowId = showId; showObject = new ShowObject(msg); roomData = new SceneObject(); roomData.ShowObjectDic.Add(showObject.ShowId, showObject); collaborationManager.roomInitData = roomData; collaborationManager.TurnOn(); }
// Update is called once per frame void Update() { if (!ModelController.inModelMode) { dragTimer = 0; dragging = false; return; } bool clicked = Input.GetMouseButton(0); if (!dragging && clicked && Cursor.hovered && (Cursor.hovered.standingUnit == unit || Cursor.hovered.standingModel == model)) { if (ModelController.unit != unit) { ModelController.unit = unit; CursorController.ShowMoveCells(); Menu.Refresh(); } } if (clicked) { dragTimer += Time.deltaTime; dragging = dragging || dragTimer >= minDragTimer && Cursor.hovered && Cursor.hovered.standingModel == model; if (dragging && !selected) { DisplayModel(model); } } else { selected = false; dragTimer = 0; dragging = false; MoveModelTowardCursor(modelCursor); } if (dragging) { CursorController.Cancel(); Cursor hoveredCursor = Cursor.hovered; if (hoveredCursor) { MoveModelTowardCursor(hoveredCursor); if (Cursor.hovered.standingModel == null) { SetModelCursor(Cursor.hovered); } else if (Cursor.hovered.standingModel != model) { SetModelCursor(lastGoodModelCursor); } } } }
void Start() { gameObject.name = gameObject.name.Replace("Clone", $"X:{Position.x},Y:{Position.y}"); _currentActivePath = CreatePathBlock(); var cursorBoundaries = GameObject.Find("CursorBoundaries"); var pCollider = cursorBoundaries.GetComponent <PolygonCollider2D>(); _cursor = FindObjectOfType <CursorController>(); if (!Position.InsideSquare(pCollider.points[1], pCollider.points[3])) { Destroy(gameObject); } else { _pM = FindObjectOfType <PlayerManager>(); StartCoroutine(CreateMinimapIcon()); _savedPaths = new Dictionary <UnitController, Path_Saved>(); CreateAttackSpace(AttackSpace); CreateMoveSpace(MoveSpace); _gridParams.Reset(); } }
public void AddGameObj(GameTrace gameTrace) { Vector2Int boardPos = new Vector2Int(gameTrace.x, gameTrace.y); if (_gameObjects.ContainsKey(boardPos)) { // already have a step on this position Debug.Log("in AddGameObj: already have this key"); return; } Vector3 worldPos = new Vector3(CursorController.CalcPosition(gameTrace.x), 1, CursorController.CalcPosition(gameTrace.y)); GameObject newStone = null; if (gameTrace.player == "black") { newStone = Instantiate(_blackStonePrefab, worldPos, Quaternion.LookRotation(Vector3.up)); } else if (gameTrace.player == "white") { newStone = Instantiate(_whiteStonePrefab, worldPos, Quaternion.LookRotation(Vector3.up)); } if (newStone != null) { _gameObjects.Add(new Vector2Int(gameTrace.x, gameTrace.y), newStone); newStone.transform.localScale = new Vector3(2, 2, 2); } }
void Start() { NVA = this.GetComponent <NavMeshAgent> (); cursor = GameObject.FindObjectOfType <CursorController> (); NVA.updateRotation = false; NVA.SetDestination(this.transform.position); }
private void Start() { instance = FindObjectOfType <CursorController>(); var eventTrigger = gameObject.AddComponent <EventTrigger>(); var pointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; pointerEnter.callback.AddListener(arg0 => instance.Link()); var pointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; pointerExit.callback.AddListener(arg0 => instance.Default()); var pointerDown = new EventTrigger.Entry { eventID = EventTriggerType.PointerDown }; pointerDown.callback.AddListener(arg0 => SoundManager.PlaySound("click")); eventTrigger.triggers.Add(pointerEnter); eventTrigger.triggers.Add(pointerExit); eventTrigger.triggers.Add(pointerDown); Destroy(this); }
private void Start() { mainCamera = FindObjectOfType <Camera>(); cameraAnimator = mainCamera.GetComponent <Animator>(); cursor = FindObjectOfType <CursorController>(); dialogueHolder = FindObjectOfType <DialogueHolder>(); }
private void Awake() { // initialization controller = GetComponent <CursorController>(); operating = false; }
public static bool AllowUserActivity; // Разрешено действие пользователя // Use this for initialization void Start() { GameState = enumGameState.BeginGame; _score1 = 0; _score2 = 0; this.ChangeBorderPlace(); _tm = GameObject.Find("txtMessage").GetComponent <MessageControl> (); _tm.RaiseMessage("Start !", 2, Color.magenta); _curC = GameObject.Find("FireShoot").GetComponent <CursorController> (); _ply1 = GameObject.Find("meshPlayer1"); _ply2 = GameObject.Find("meshPlayer2"); _ply1.GetComponent <TankController> ().UnderAIControl = GameStatic.LeftPlayer.isAI; _ply2.GetComponent <TankController> ().UnderAIControl = GameStatic.RightPlayer.isAI; _actTC = _ply1.GetComponent <TankController> (); _ply1.GetComponent <TankController> ().player = GameStatic.LeftPlayer; _ply2.GetComponent <TankController> ().player = GameStatic.RightPlayer; AllowUserActivity = true; RightPlayerGameField = new Rect(3.5f, -10.5f, 19.5f, 22.5f); // Ограничения по полю передвижения танков UpdatePlayers(); //Обновляем имена игроков }
public void CenterExperiment() { transform.position = new Vector3(Camera.main.transform.position.x, CursorController.GetHandPosition().y, CursorController.GetHandPosition().z) - Vector3.up * .075f + Vector3.left * 0f; StartCoroutine(TempDisableCursor()); }
void Start() { cursorController = cursor.GetComponent <CursorController>(); dungeonController = dungeonControllerGO.GetComponent <DungeonController>(); cursorController.detailsBlock(); }
private void Start() { mainCamera = FindObjectOfType <Camera>(); cursor = FindObjectOfType <CursorController>(); map = FindObjectOfType <TileMap>(); Invoke("SetEnemyOrder", 1f); }
private void Initialize() { if (_pixelGridSnapper == null) { _pixelGridSnapper = new PixelGridSnapper(_texelsPerUnit, _pixelsPerTexel); } _camera = FindObjectOfType <Camera>(); _soundManager = FindObjectOfType <SoundManager>(); _cursorController = FindObjectOfType <CursorController>(); _cutscenePlayer = FindObjectOfType <Cutscene>(); _uiManager = FindObjectOfType <UiManager>(); _levelGenerationController = FindObjectOfType <LevelGenerationController>(); _playerController = FindObjectOfType <PlayerController>(); _deadline = FindObjectOfType <DeadlineIdentifier>().gameObject; _camera.orthographicSize = (float)Screen.height / _texelsPerUnit / 2 / _pixelsPerTexel; _currentGameState = GameState.mainMenu; if (_shouldStartFromGameplay) { _shouldStartFromGameplay = false; _soundManager.StartNewGameWhithoutCutScene(); StartGameplay(); } else { Invoke("DeactivateObjectsBeforeStart", 0.1f); } }
private void Start() { if (Instance == null) { Instance = this; } }
private void CheckCursorPos(Vector2 cursorPos) { var cursorRight = cursorPos.x >= Screen.width - _borderSize; var cursorLeft = cursorPos.x <= _borderSize; var cursorUp = cursorPos.y >= Screen.height - _borderSize; var cursorDown = cursorPos.y <= _borderSize; if (cursorRight || cursorLeft || cursorUp || cursorDown) { if (!_moveCamera) { _moveCamera = true; _movingCamera ??= StartCoroutine(TryMoveCamera()); } } else { if (_moveCamera) { CursorController.ResetCursorState(); } _moveCamera = false; if (_movingCamera != null) { StopCoroutine(_movingCamera); _movingCamera = null; } } }
private void Awake() { // NOTE: we need to set the quality settings before renderer pipeline is copy and modified SetupQualitySettings(); SetupRendererPipeline(); cameraController = Object.FindObjectOfType <CameraController>(); cursorController = Object.FindObjectOfType <CursorController>(); mouseCatcher = InitialSceneReferences.i?.mouseCatcher; if (mouseCatcher != null) { mouseCatcher.enabled = false; } if (DCLCharacterController.i) { defaultCharacterPosition = DCLCharacterController.i.transform.position; DCLCharacterController.i.initialPositionAlreadySet = true; DCLCharacterController.i.characterAlwaysEnabled = false; DCLCharacterController.i.gameObject.SetActive(false); } if (cameraController) { cameraController.gameObject.SetActive(false); } if (cursorController) { cursorController.gameObject.SetActive(false); } SceneController.i?.fpsPanel.SetActive(false); SetCaptureKeyboardInputEnabled(false); }
// Use this for initialization void Start() { controller = new Controller(); cursor = GameObject.Find("Cursor"); cursorTransform = cursor.GetComponent <Transform>(); cursorController = cursor.GetComponent <CursorController>(); if (inverseX) { xInv = -1; } else { xInv = 1; } if (inverseY) { yInv = -1; } else { yInv = 1; } }
// Use this for initialization void Start() { // インスタンスの初期化 phaseManager = this; // エリア描画用関連の読み込み attackArea = new GameObject("AttackArea"); activeArea = new GameObject("activeArea"); attackArea.transform.parent = transform; activeArea.transform.parent = transform; // プレイヤーターンから始める TurnChange(Enums.ARMY.ALLY); attackBtn = GameObject.Find("CanvasUI/ActiveUI/AttackButton").GetComponent <Button>(); recoveryBtn = GameObject.Find("CanvasUI/ActiveUI/RecoveryButton").GetComponent <Button>(); waitingBtn = GameObject.Find("CanvasUI/ActiveUI/EndButton").GetComponent <Button>(); turnEndBtn = GameObject.Find("CanvasUI/ActiveUI/TurnEndButton").GetComponent <Button>(); battleStandbyUI.SetActive(false); //各ボタンの無効化 attackBtn.interactable = false; recoveryBtn.interactable = false; waitingBtn.interactable = false; // カーソル更新時に呼び出す処理の登録 CursorController.AddCallBack((Vector3 newPos) => { cursorPos = newPos; }); // シーンをロード //SceneManager.LoadScene("conversation", LoadSceneMode.Additive); }
private void OnUnitMouseExitOnBoard(UnitDisplay unit) { unit.CardDisplay.OverHighlightOff(); CursorController.SetDefault(); this.boardCreator.RemoveAllBlinks(); this.boardCreator.ShowPathReach(this.selectedUnit); }
public static void PickAction(Unit unit, int actionIndex) { CursorController.Cancel(); SetState(State.PickTarget); selectedActionIndex = actionIndex; CursorController.ShowActionCursors(unit, actionIndex); }
public static void CancelAttack() { SetState(State.PickAction); CursorController.HideAttackCursors(); CursorController.HideConfirmAttackCursors(); Menu.Refresh(); }
private void Awake() { animator = GetComponent <Animator>(); tapGesture = GetComponent <TapGesture>(); cursorRef = FindObjectOfType <CursorController>(); leAudio = GetComponent <AudioSource>(); }
private void OnUnitMouseExitOnBoard(UnitDisplay unit) { this.boardCreator.RemoveAllBlinks(); unit.CardDisplay.OverHighlightOff(); CursorController.SetDefault(); }
void Awake() { if (instance == null) instance = this; Cursor.SetCursor(cursorTex, Vector2.zero, CursorMode.Auto); }
public void DrawLine(DrawMethodArgs args) { PhysicsScene scene = demo.Engine.Factory.PhysicsSceneManager.Get(args.OwnerSceneIndex); PhysicsObject objectBase = scene.Factory.PhysicsObjectManager.Get(args.OwnerIndex); if (!objectBase.EnableDrawing) { return; } PhysicsObject physicsObjectWithActiveCamera = scene.GetPhysicsObjectWithActiveCamera(0); if (physicsObjectWithActiveCamera == null) { return; } PhysicsCamera activeCamera = physicsObjectWithActiveCamera.Camera; if (activeCamera == null) { return; } GL.Disable(EnableCap.DepthTest); GL.DepthMask(false); float time = args.Time; CursorController cursorController = physicsObjectWithActiveCamera.InternalControllers.CursorController; if ((cursorController != null) && cursorController.IsDragging) { activeCamera.View.GetViewMatrix(ref view); activeCamera.Projection.GetProjectionMatrix(ref projection); world = matrixIdentity; cursorController.GetAnchor1(ref startPosition); cursorController.GetAnchor2(ref endPosition); render.SetWorld(ref world); render.SetView(ref view); render.SetProjection(ref projection); render.Apply(); GL.Begin(PrimitiveType.Lines); GL.Color3(0.0f, 1.0f, 0.6f); GL.Vertex3(startPosition); GL.Color3(1.0f, 1.0f, 1.0f); GL.Vertex3(endPosition); GL.End(); } GL.DepthMask(true); GL.Enable(EnableCap.DepthTest); }
private void OnTileMouseExitOnBoard(TileDisplay tile) { this.hoveredTile = null; tile.HighlightOff(); CursorController.SetDefault(); this.boardCreator.RemoveAllBlinks(); this.boardCreator.ShowPathReach(this.selectedUnit); }
public static void FinishAction() { // CursorController.ShowMoveCells(); CursorController.ResetPath(); CursorController.HideAttackCursors(); CursorController.HideConfirmAttackCursors(); instance.Whatever(); }
public static void FinishMoving() { CursorController.ShowMoveCells(); CursorController.ResetPath(); TurnController.Next(); UnfreezeInputs(); Menu.Refresh(); }
private void InitiateCursor(CursorController target, Team team) { target.gameObject.SetActive(true); target.cursorTeam = team; target.SpriteRenderer.DOFade(1.0f, 0.1f); target.ResetPosition(); target.gamestate = this; }
private void Awake() { cursorCtrl = CursorController.Instance; mNorBtn_Start = Global.FindChild(transform, "StartNormal").transform; mPressBtn_Start = Global.FindChild(transform, "StartPress").transform; ButtonEvent.ButtonTriggerEvent += ButtonTriggerEvent; }