예제 #1
0
        private bool IsShipInDetonationRange(GenericShip ship, GameObject bombObject)
        {
            List <Vector3> bombPoints = BombsManager.GetBombPoints();

            foreach (var localBombPoint in bombPoints)
            {
                Vector3 globalBombPoint = bombObject.transform.TransformPoint(localBombPoint);
                foreach (var globalShipBasePoint in ship.ShipBase.GetStandPoints().Select(n => n.Value))
                {
                    if (Board.BoardManager.GetRangeBetweenPoints(globalBombPoint, globalShipBasePoint) == 1)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #2
0
        private void CheckDistanceAdvanced()
        {
            float minDistance = float.MaxValue;

            foreach (Vector3 bombPoint in BombsManager.GetBombPoints(Bomb))
            {
                MeshCollider obstacleCollider      = Obstacle.ObstacleGO.GetComponentInChildren <MeshCollider>();
                Vector3      obstacleColliderPoint = obstacleCollider.ClosestPoint(bombPoint);

                float distanceBetweenEdges = Vector3.Distance(bombPoint, obstacleColliderPoint);
                if (distanceBetweenEdges < minDistance)
                {
                    minDistance = distanceBetweenEdges;
                }
            }

            Range = Mathf.Max(1, Mathf.CeilToInt(minDistance / Board.DISTANCE_INTO_RANGE));
        }
예제 #3
0
        private bool CheckDistanceSimple()
        {
            foreach (Vector3 bombPoint in BombsManager.GetBombPoints(Bomb))
            {
                float distanceBetween = Vector3.Distance(bombPoint, Obstacle.ObstacleGO.transform.position);

                Range = Mathf.Max(1, Mathf.CeilToInt(distanceBetween / Board.DISTANCE_INTO_RANGE));

                if (Range == 1)
                {
                    return(true);
                }
                if (Range > 4)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
        private bool CheckDistanceSimple()
        {
            foreach (Vector3 bombPoint in BombsManager.GetBombPoints(Bomb))
            {
                float distanceBetween = Vector3.Distance(bombPoint, Obstacle.ObstacleGO.transform.position);

                Range = Board.DistanceToRange(distanceBetween);

                if (Range == 1)
                {
                    return(true);
                }
                if (Range > 4)
                {
                    return(true);
                }
            }

            return(false);
        }