Moved switches to their own package inside materials

This commit is contained in:
cognitivegears 2014-04-21 23:21:21 -05:00
parent 97bc20059c
commit e3c76fa9d3
18 changed files with 49 additions and 31 deletions

View File

@ -12,6 +12,8 @@ import com.droidquest.devices.ContactSensor;
import com.droidquest.devices.SmallChip;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.Switch;
import com.droidquest.materials.switches.Switch1;
import java.awt.*;

View File

@ -15,6 +15,9 @@ import com.droidquest.devices.StormShield;
import com.droidquest.items.Button;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.ElevatorSwitch;
import com.droidquest.materials.switches.SwitchA;
import com.droidquest.materials.switches.SwitchB;
import java.awt.*;

View File

@ -10,6 +10,10 @@ import com.droidquest.decorations.Graphix;
import com.droidquest.devices.SmallChip;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.Switch4A;
import com.droidquest.materials.switches.Switch4B;
import com.droidquest.materials.switches.Switch4C;
import com.droidquest.materials.switches.Switch4D;
import java.awt.*;

View File

@ -10,6 +10,7 @@ import com.droidquest.decorations.Arrow;
import com.droidquest.decorations.Graphix;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.Switch;
import java.awt.*;

View File

@ -11,6 +11,7 @@ import com.droidquest.decorations.Graphix;
import com.droidquest.devices.DirectionalSensor;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.Switch;
import java.awt.*;

View File

@ -8,6 +8,7 @@ import com.droidquest.decorations.Arrow;
import com.droidquest.devices.*;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.MazeLock;
import java.awt.*;

View File

@ -9,6 +9,7 @@ import com.droidquest.decorations.Arrow;
import com.droidquest.devices.*;
import com.droidquest.items.*;
import com.droidquest.materials.*;
import com.droidquest.materials.switches.MazeLock;
import java.awt.*;

View File

@ -11,7 +11,7 @@ import com.droidquest.items.*;
import com.droidquest.materials.Material;
import com.droidquest.materials.PanicButton;
import com.droidquest.materials.Portal;
import com.droidquest.materials.Switch;
import com.droidquest.materials.switches.Switch;
import java.awt.*;

View File

@ -1,9 +1,10 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.Room;
import com.droidquest.decorations.Arrow;
import com.droidquest.items.Item;
import com.droidquest.materials.ElevatorOutPortal;
import com.droidquest.materials.Switch;
import com.droidquest.materials.Material;
public class ElevatorSwitch extends Switch {
private int animationState = 0;
@ -45,7 +46,7 @@ public class ElevatorSwitch extends Switch {
animationState++;
break;
case 3:
if (ElevatorOutPortal.outRoom == level.rooms.elementAt(11)) {
if (ElevatorOutPortal.outRoom == Material.level.rooms.elementAt(11)) {
for (int a = 0; a < room.arrows.size(); a++) {
Arrow arrow = room.arrows.elementAt(a);
arrow.direction = Arrow.DIR_UP;

View File

@ -1,6 +1,7 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.materials.Switch;
import com.droidquest.items.Item;
import com.droidquest.materials.Material;
public class MazeLock extends Switch {
@ -12,15 +13,15 @@ public class MazeLock extends Switch {
public void TouchedByItem(Item item) {
if (paintbrush == null) {
paintbrush = level.paintbrush;
paintbrush = Material.level.paintbrush;
}
if (!value) {
level.paintbrush = null;
Material.level.paintbrush = null;
value = true;
}
else {
level.paintbrush = paintbrush;
Material.level.paintbrush = paintbrush;
value = false;
}
}

View File

@ -1,7 +1,8 @@
package com.droidquest.materials;
package com.droidquest.materials.switches;
import com.droidquest.Room;
import com.droidquest.items.Item;
import com.droidquest.materials.Material;
import javax.swing.*;
import java.awt.*;

View File

@ -1,7 +1,8 @@
package com.droidquest.materials;
package com.droidquest.materials.switches;
import com.droidquest.items.Item;
import com.droidquest.items.Train;
import com.droidquest.materials.Material;
public class Switch1 extends Switch {
private transient Train train;
@ -12,8 +13,8 @@ public class Switch1 extends Switch {
public void TouchedByItem(Item item) {
if (train == null) {
for (int a = 0; a < level.items.size(); a++) {
Item t = level.items.elementAt(a);
for (int a = 0; a < Material.level.items.size(); a++) {
Item t = Material.level.items.elementAt(a);
if (t.getClass().toString().endsWith("Train")) {
train = (Train) t;
}

View File

@ -1,7 +1,7 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.Room;
import com.droidquest.materials.Switch;
import com.droidquest.items.Item;
public class Switch4A extends Switch {
int count = 0;

View File

@ -1,7 +1,7 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.items.Item;
import com.droidquest.materials.Material;
import com.droidquest.materials.Switch;
public class Switch4B extends Switch {
private transient Switch4A sw = null;
@ -12,8 +12,8 @@ public class Switch4B extends Switch {
public void TouchedByItem(Item item) {
if (sw == null) {
for (int a = 0; a < level.materials.size(); a++) {
Material mat = level.materials.elementAt(a);
for (int a = 0; a < Material.level.materials.size(); a++) {
Material mat = Material.level.materials.elementAt(a);
if (mat instanceof Switch4A) {
sw = (Switch4A) mat;
}

View File

@ -1,7 +1,7 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.items.Item;
import com.droidquest.materials.Material;
import com.droidquest.materials.Switch;
public class Switch4C extends Switch {
private transient Switch4A sw = null;
@ -12,8 +12,8 @@ public class Switch4C extends Switch {
public void TouchedByItem(Item item) {
if (sw == null) {
for (int a = 0; a < level.materials.size(); a++) {
Material mat = level.materials.elementAt(a);
for (int a = 0; a < Material.level.materials.size(); a++) {
Material mat = Material.level.materials.elementAt(a);
if (mat instanceof Switch4A) {
sw = (Switch4A) mat;
}

View File

@ -1,7 +1,7 @@
package com.droidquest.items;
package com.droidquest.materials.switches;
import com.droidquest.items.Item;
import com.droidquest.materials.Material;
import com.droidquest.materials.Switch;
public class Switch4D extends Switch {
private transient Switch4A sw = null;
@ -12,8 +12,8 @@ public class Switch4D extends Switch {
public void TouchedByItem(Item item) {
if (sw == null) {
for (int a = 0; a < level.materials.size(); a++) {
Material mat = level.materials.elementAt(a);
for (int a = 0; a < Material.level.materials.size(); a++) {
Material mat = Material.level.materials.elementAt(a);
if (mat instanceof Switch4A) {
sw = (Switch4A) mat;
}

View File

@ -1,4 +1,4 @@
package com.droidquest.materials;
package com.droidquest.materials.switches;
import com.droidquest.items.Item;
@ -11,7 +11,7 @@ public class SwitchA extends Switch {
// something like that.
public SwitchA() {
super(Switch.ROT_LEFT);
super(ROT_LEFT);
}
public void TouchedByItem(Item item) {

View File

@ -1,8 +1,9 @@
package com.droidquest.materials;
package com.droidquest.materials.switches;
import com.droidquest.decorations.TextBox;
import com.droidquest.items.Item;
import com.droidquest.items.Sentry;
import com.droidquest.materials.Material;
public class SwitchB extends Switch {
private transient SwitchA switchA = null;
@ -10,7 +11,7 @@ public class SwitchB extends Switch {
private transient Sentry sentry = null;
public SwitchB() {
super(Switch.ROT_LEFT);
super(ROT_LEFT);
}
public void TouchedByItem(Item item) {