public ToggleLimitsButton(Level Target, Surface.SurfaceType Type) { target = Target; type = Type; switch (type) { case Surface.SurfaceType.Absorbant: basicId = "Absorbant Walls: "; break; case Surface.SurfaceType.Refractive: basicId = "Refractive Walls: "; break; case Surface.SurfaceType.Reflective: basicId = "Reflective Walls: "; break; default: basicId = "Whaats?"; break; } addOption(0); addOption(1); addOption(2); addOption(3); addOption(5); addOption(8); currentValue = 1; execute(); }
public void Update() { if (!parent.isFiring()) { position += 15* input.LStickPosition(); } FixPosition(); if (input.IsCreateTowerNewlyPressed()) region.AddSpawnPoint(new SpawnPoint(position, 1000f, region)); if (input.IsCancelSurfaceNewlyPressed()) { if (selected_2 != null && !selected_2.built) region.RemoveTower(selected_2); if(selected != null && !selected.built) region.RemoveTower(selected); selected = null; c_build = false; } if (input.IsIncrementTowerNewlyPressed()) { incrementTowerIndex(); if (c_build) { if (!selected_2.built) { Tower temp = selected_2; selected_2 = parent.m_towers[tower_index]; temp_surface.changeTower(selected_2); temp.ClearSurfaces(); region.RemoveTower(temp); } else selected_2 = parent.m_towers[tower_index]; position = selected_2.position; Vector2 distance = selected.position - position; while (distance.LengthSquared() > 10000) { incrementTowerIndex(); selected_2 = parent.m_towers[tower_index]; position = selected_2.position; distance = selected.position - position; } temp_surface.changeTower(selected_2); } else selectTower(parent.m_towers[tower_index]); } if (input.IsDecrementTowerNewlyPressed()) { decrementTowerIndex(); if (c_build) { if (!selected_2.built){ Tower temp = selected_2; selected_2 = parent.m_towers[tower_index]; temp_surface.changeTower(selected_2); temp.ClearSurfaces(); region.RemoveTower(temp); }else selected_2 = parent.m_towers[tower_index]; position = selected_2.position; Vector2 distance = selected.position - position; while (distance.LengthSquared() > 14400) { incrementTowerIndex(); selected_2 = parent.m_towers[tower_index]; position = selected_2.position; distance = selected.position - position; } temp_surface.changeTower(selected_2); } else selectTower(parent.m_towers[tower_index]); } if (c_build) { Vector2 distance = selected.position - position; if (distance.LengthSquared() > 14400){ distance.Normalize(); position = selected.position - distance * 120f; } if (!selected_2.built) { selected_2.position = position; } temp_surface.ChangeType(c_build_type); } if (input.IsCreateSurfaceNewlyPressed() && parent.legalSurface(c_build_type)) { if (c_build) { selected.Anchor(); selected_2.Anchor(); c_temp = Vector2.Zero; temp_surface.built = true; c_build = false; selected.UnHighlight(); selected = null; selected_2 = null; temp_surface = null; parent.incrementSurface(c_build_type); }else { if (selected == null) buildTower(); else buildTower(selected); } } if (input.IsToggleBuildNewlyPressed()) { region.AddPrism(new AntiPrism(region, position)); } if (input.IsSetReflectiveNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Reflective)) c_build_type = Surface.SurfaceType.Reflective; if (input.IsSetAbsorbantNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Absorbant)) c_build_type = Surface.SurfaceType.Absorbant; if (input.IsSetRefractiveNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Refractive)) c_build_type = Surface.SurfaceType.Refractive; if (input.createPrismNewlyPressed()) { region.AddPrism(position); } }