public override bool IsReady() { if (avoidExits) { if (!GameManager.Instance.Dungeon | GameManager.Instance.Dungeon.data == null | !m_aiActor.specRigidbody) { return(false); } DungeonData data = GameManager.Instance.Dungeon.data; CellData cellSafe = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.LowerLeft).ToIntVector2(VectorConversions.Floor)); CellData cellSafe2 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.LowerRight).ToIntVector2(VectorConversions.Floor)); CellData cellSafe3 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.UpperLeft).ToIntVector2(VectorConversions.Floor)); CellData cellSafe4 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.UpperRight).ToIntVector2(VectorConversions.Floor)); if (cellSafe != null && cellSafe2 != null && cellSafe3 != null && cellSafe4 != null) { if (cellSafe.isExitCell | cellSafe2.isExitCell | cellSafe3.isExitCell | cellSafe4.isExitCell) { return(false); } } else { return(false); } } if (avoidWalls) { if (!GameManager.Instance.Dungeon | GameManager.Instance.Dungeon.data == null | !m_aiActor.specRigidbody) { return(false); } DungeonData data = GameManager.Instance.Dungeon.data; CellData cellSafe = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.LowerLeft).ToIntVector2(VectorConversions.Floor)); CellData cellSafe2 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.LowerRight).ToIntVector2(VectorConversions.Floor)); CellData cellSafe3 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.UpperLeft).ToIntVector2(VectorConversions.Floor)); CellData cellSafe4 = data.GetCellSafe(PhysicsEngine.PixelToUnit(m_aiActor.specRigidbody.PrimaryPixelCollider.UpperRight).ToIntVector2(VectorConversions.Floor)); if (cellSafe != null && cellSafe2 != null && cellSafe3 != null && cellSafe4 != null) { if (cellSafe.isNextToWall | cellSafe2.isNextToWall | cellSafe3.isNextToWall | cellSafe4.isNextToWall) { return(false); } } else { return(false); } } return(base.IsReady()); }