private void setCurrentState() { if (((SubmarineMover)GetParent().GetComponent("SubmarineMover")).GetSurfaced()) { currentController = Radar; } else { currentController = Sonar; } }
/** * Determine if there is a direct line-of-sight path between a starting * position and an ending position. * * @param starPos * Starting position vector. * * @param endPos * Ending positional vector. * * @return * true if a direct line can be drawn between the starting and ending * position and all crossed tiles are valid tiles. */ public static bool LineOfSightPathBetween(Vector3 startPos, Vector3 endPos) { int x0 = (int)startPos.x, y0 = (int)startPos.y; int x1 = (int)endPos.x, y1 = (int)endPos.y; List <Terrain> intersects = BaseDetectorController.GetIntersectingTerrains(x0, y0, x1, y1); foreach (Terrain t in intersects) { if (!ValidTerrain(t)) { return(false); } } return(true); }
public override bool CanSeeElevation(GameObject obj) { return(BaseDetectorController.IsInAir(obj)); }
public override bool CanSeeElevation(GameObject obj) { // can see anything on ground or in the air return(BaseDetectorController.IsOnSurface(obj) || BaseDetectorController.IsInAir(obj)); }