private void DetermineSelectedOnTower() { if (ConstructNodeManager.GetInfo(SelectedPosition, out NodeInfo result)) { SelectedPosition = MapIns.WorldToCell(result.GameObject.transform.position).ZToZero(); } }
public void MoveFinish() { Vector3Int currentCell = MapIns.WorldToCell(transform.position).ZToZero(); if (!Remote.Binding()) { if (MapIns.GetNearestPosition(currentCell, out Vector3Int result)) { // StartMove(currentCell, result); // main thread // AsyncStartMove(currentCell, result); // another thread AgentController.MoveAgent(this, currentCell, result, currentEnemy); curMoveStep = 0; } } else { Stop(); } }
private void Update() { if (selectConditions.Evaluate()) { try { Vector3 mousePos = CrossInput.Position; //#if UNITY_ANDROID && !UNITY_EDITOR // AndroidAdbLog.LogInfo(mousePos); // //AndroidAdbLog.LogInfo(Input.GetTouch(0).position); //#endif bool raycastHitted = Physics.Raycast( CameraRaycaster.ScreenPointToRay(mousePos), out RaycastHit hitInfo, CameraRaycaster.farClipPlane); if (raycastHitted) { SelectedPosition = MapIns.WorldToCell(hitInfo.point).ZToZero(); DetermineSelectedOnTower(); // DetermineSelectedOnRSS(hitInfo); selectedCallback?.Invoke(SelectedPosition); } } catch (System.Exception e) { //#if UNITY_ANDROID && !UNITY_EDITOR // AndroidAdbLog.LogInfo(e.ToString()); //#endif Debugger.Log(e.ToString()); Debugger.Log(Input.mousePosition); } } }
private void CameraChanged() { if (!isWaiting) { List <Vector3Int> conners = MapIns.WorldToCell(CameraBinding.Conners); bool isCreateNew = false; for (int i = 0; i < conners.Count; i++) { QuadNode overlapNode = RSSPositionTree.Retrieve(conners[i]); currentOverlapNodeId[i] = overlapNode != null ? overlapNode.Id : -1; if (overlapNode != null) { isCreateNew = AddPositionForCreate(overlapNode) || isCreateNew; } } ReleaseRssOutside(); if (isCreateNew) { StartCoroutine(WaitForCreateComplete()); } } }