コード例 #1
0
 private void DetermineSelectedOnTower()
 {
     if (ConstructNodeManager.GetInfo(SelectedPosition, out NodeInfo result))
     {
         SelectedPosition = MapIns.WorldToCell(result.GameObject.transform.position).ZToZero();
     }
 }
コード例 #2
0
ファイル: NavAgent.cs プロジェクト: dqtoy/Assets
        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();
            }
        }
コード例 #3
0
    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);
            }
        }
    }
コード例 #4
0
    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());
            }
        }
    }