Moved switches to their own package inside materials
This commit is contained in:
81
src/com/droidquest/materials/switches/ElevatorSwitch.java
Normal file
81
src/com/droidquest/materials/switches/ElevatorSwitch.java
Normal file
@@ -0,0 +1,81 @@
|
||||
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.Material;
|
||||
|
||||
public class ElevatorSwitch extends Switch {
|
||||
private int animationState = 0;
|
||||
// 0=open
|
||||
// 1=closing
|
||||
// 2=closing
|
||||
// 3=switch arrow, switch outRoom
|
||||
// 4=opening
|
||||
// 5=opening
|
||||
private transient static Room room;
|
||||
|
||||
public ElevatorSwitch() {
|
||||
super(Switch.ROT_LEFT);
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
room = item.room;
|
||||
if (animationState == 0) {
|
||||
animationState = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void Animate() {
|
||||
super.Animate();
|
||||
switch (animationState) {
|
||||
case 0:
|
||||
value = false;
|
||||
break;
|
||||
case 1:
|
||||
// Play sound
|
||||
value = true;
|
||||
room.SetMaterial(0, 7, 4);
|
||||
room.SetMaterial(0, 10, 4);
|
||||
animationState++;
|
||||
break;
|
||||
case 2:
|
||||
room.SetMaterial(0, 8, 4);
|
||||
room.SetMaterial(0, 9, 4);
|
||||
animationState++;
|
||||
break;
|
||||
case 3:
|
||||
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;
|
||||
arrow.y = 66;
|
||||
}
|
||||
ElevatorOutPortal.SetOutRoom(9);
|
||||
}
|
||||
else {
|
||||
for (int a = 0; a < room.arrows.size(); a++) {
|
||||
Arrow arrow = room.arrows.elementAt(a);
|
||||
arrow.direction = Arrow.DIR_DOWN;
|
||||
arrow.y = 94;
|
||||
}
|
||||
ElevatorOutPortal.SetOutRoom(11);
|
||||
}
|
||||
animationState++;
|
||||
break;
|
||||
case 4:
|
||||
room.SetMaterial(0, 8, 12);
|
||||
room.SetMaterial(0, 9, 12);
|
||||
animationState++;
|
||||
break;
|
||||
case 5:
|
||||
room.SetMaterial(0, 7, 12);
|
||||
room.SetMaterial(0, 10, 12);
|
||||
animationState = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
29
src/com/droidquest/materials/switches/MazeLock.java
Normal file
29
src/com/droidquest/materials/switches/MazeLock.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.droidquest.materials.switches;
|
||||
|
||||
import com.droidquest.items.Item;
|
||||
import com.droidquest.materials.Material;
|
||||
|
||||
|
||||
public class MazeLock extends Switch {
|
||||
private transient static Item paintbrush;
|
||||
|
||||
public MazeLock() {
|
||||
super(Switch.ROT_DOWN);
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
if (paintbrush == null) {
|
||||
paintbrush = Material.level.paintbrush;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
Material.level.paintbrush = null;
|
||||
value = true;
|
||||
}
|
||||
else {
|
||||
Material.level.paintbrush = paintbrush;
|
||||
value = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -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.*;
|
@@ -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;
|
||||
}
|
168
src/com/droidquest/materials/switches/Switch4A.java
Normal file
168
src/com/droidquest/materials/switches/Switch4A.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.droidquest.materials.switches;
|
||||
|
||||
import com.droidquest.Room;
|
||||
import com.droidquest.items.Item;
|
||||
|
||||
public class Switch4A extends Switch {
|
||||
int count = 0;
|
||||
private int doorState = 0;
|
||||
transient Room room = null;
|
||||
|
||||
public Switch4A() {
|
||||
super(Switch.ROT_UP);
|
||||
GenerateIcons();
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
if (!value) {
|
||||
value = true;
|
||||
count++;
|
||||
room = item.room;
|
||||
}
|
||||
}
|
||||
|
||||
public void Animate() {
|
||||
super.Animate();
|
||||
|
||||
if (doorState == 0 && count == 4) {
|
||||
doorState = 1;
|
||||
}
|
||||
|
||||
switch (doorState) {
|
||||
case 1:
|
||||
room.SetMaterial(8, 3, 0);
|
||||
room.SetMaterial(9, 3, 0);
|
||||
room.SetMaterial(10, 3, 0);
|
||||
room.SetMaterial(11, 3, 0);
|
||||
room.SetMaterial(8, 8, 0);
|
||||
room.SetMaterial(9, 8, 0);
|
||||
room.SetMaterial(10, 8, 0);
|
||||
room.SetMaterial(11, 8, 0);
|
||||
room.SetMaterial(12, 4, 0);
|
||||
room.SetMaterial(12, 5, 0);
|
||||
room.SetMaterial(12, 6, 0);
|
||||
room.SetMaterial(12, 7, 0);
|
||||
room.SetMaterial(13, 4, 4);
|
||||
room.SetMaterial(13, 7, 4);
|
||||
room.SetMaterial(7, 4, 0);
|
||||
room.SetMaterial(7, 5, 0);
|
||||
room.SetMaterial(7, 6, 0);
|
||||
room.SetMaterial(7, 7, 0);
|
||||
room.SetMaterial(6, 4, 4);
|
||||
room.SetMaterial(6, 7, 4);
|
||||
doorState++;
|
||||
break;
|
||||
case 2:
|
||||
room.SetMaterial(8, 2, 0);
|
||||
room.SetMaterial(9, 2, 0);
|
||||
room.SetMaterial(10, 2, 0);
|
||||
room.SetMaterial(11, 2, 0);
|
||||
room.SetMaterial(12, 2, 0);
|
||||
room.SetMaterial(7, 9, 0);
|
||||
room.SetMaterial(8, 9, 0);
|
||||
room.SetMaterial(9, 9, 0);
|
||||
room.SetMaterial(10, 9, 0);
|
||||
room.SetMaterial(11, 9, 0);
|
||||
room.SetMaterial(13, 4, 0);
|
||||
room.SetMaterial(13, 5, 0);
|
||||
room.SetMaterial(13, 6, 0);
|
||||
room.SetMaterial(13, 7, 0);
|
||||
room.SetMaterial(14, 4, 4);
|
||||
room.SetMaterial(14, 7, 4);
|
||||
room.SetMaterial(6, 4, 0);
|
||||
room.SetMaterial(6, 5, 0);
|
||||
room.SetMaterial(6, 6, 0);
|
||||
room.SetMaterial(6, 7, 0);
|
||||
room.SetMaterial(5, 4, 4);
|
||||
room.SetMaterial(5, 7, 4);
|
||||
doorState++;
|
||||
break;
|
||||
case 3:
|
||||
room.SetMaterial(8, 1, 0);
|
||||
room.SetMaterial(9, 1, 0);
|
||||
room.SetMaterial(10, 1, 0);
|
||||
room.SetMaterial(11, 1, 0);
|
||||
room.SetMaterial(8, 10, 0);
|
||||
room.SetMaterial(9, 10, 0);
|
||||
room.SetMaterial(10, 10, 0);
|
||||
room.SetMaterial(11, 10, 0);
|
||||
room.SetMaterial(14, 4, 0);
|
||||
room.SetMaterial(14, 5, 0);
|
||||
room.SetMaterial(14, 6, 0);
|
||||
room.SetMaterial(14, 7, 0);
|
||||
room.SetMaterial(15, 4, 4);
|
||||
room.SetMaterial(15, 7, 4);
|
||||
room.SetMaterial(5, 4, 0);
|
||||
room.SetMaterial(5, 5, 0);
|
||||
room.SetMaterial(5, 6, 0);
|
||||
room.SetMaterial(5, 7, 0);
|
||||
room.SetMaterial(4, 4, 4);
|
||||
room.SetMaterial(4, 7, 4);
|
||||
doorState++;
|
||||
break;
|
||||
case 4:
|
||||
Room temproom = room.rightRoom; // KeyTunnel Left
|
||||
temproom.SetMaterial(2, 3, 0);
|
||||
for (int a = 0; a < 8; a++) {
|
||||
temproom.SetMaterial(8, a + 1, 0);
|
||||
temproom.SetMaterial(12, a + 1, 0);
|
||||
temproom.SetMaterial(16, a + 1, 0);
|
||||
}
|
||||
temproom = temproom.rightRoom; // KeyTunnel Right
|
||||
for (int a = 0; a < 8; a++) {
|
||||
temproom.SetMaterial(3, a + 1, 0);
|
||||
temproom.SetMaterial(7, a + 1, 0);
|
||||
temproom.SetMaterial(11, a + 1, 0);
|
||||
}
|
||||
temproom = room.leftRoom; // MineField top right
|
||||
for (int Y = 0; Y < 12; Y++) {
|
||||
for (int X = 0; X < 20; X++) {
|
||||
if (temproom.RoomArray[Y][X] == 8) {
|
||||
temproom.SetMaterial(X, Y, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
temproom = temproom.leftRoom; // MineField top left
|
||||
for (int Y = 0; Y < 12; Y++) {
|
||||
for (int X = 0; X < 20; X++) {
|
||||
if (temproom.RoomArray[Y][X] == 8) {
|
||||
temproom.SetMaterial(X, Y, 11);
|
||||
}
|
||||
if (temproom.RoomArray[Y][X] == 16) {
|
||||
temproom.SetMaterial(X, Y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
temproom = temproom.downRoom; // MineField bottom left
|
||||
for (int Y = 0; Y < 12; Y++) {
|
||||
for (int X = 0; X < 20; X++) {
|
||||
if (temproom.RoomArray[Y][X] == 8) {
|
||||
temproom.SetMaterial(X, Y, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
temproom = temproom.rightRoom; // MineField bottom right
|
||||
for (int Y = 0; Y < 12; Y++) {
|
||||
for (int X = 0; X < 20; X++) {
|
||||
if (temproom.RoomArray[Y][X] == 8) {
|
||||
temproom.SetMaterial(X, Y, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
temproom = room.upRoom;
|
||||
temproom.SetMaterial(19, 5, 0);
|
||||
temproom.SetMaterial(19, 6, 0);
|
||||
temproom.SetMaterial(19, 7, 0);
|
||||
temproom = temproom.rightRoom;
|
||||
temproom = temproom.upRoom;
|
||||
temproom = temproom.leftRoom;
|
||||
temproom = temproom.leftRoom;
|
||||
temproom.SetMaterial(19, 5, 0);
|
||||
temproom.SetMaterial(19, 6, 0);
|
||||
doorState++;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
29
src/com/droidquest/materials/switches/Switch4B.java
Normal file
29
src/com/droidquest/materials/switches/Switch4B.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.droidquest.materials.switches;
|
||||
|
||||
import com.droidquest.items.Item;
|
||||
import com.droidquest.materials.Material;
|
||||
|
||||
public class Switch4B extends Switch {
|
||||
private transient Switch4A sw = null;
|
||||
|
||||
public Switch4B() {
|
||||
super(Switch.ROT_RIGHT);
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
if (sw == null) {
|
||||
for (int a = 0; a < Material.level.materials.size(); a++) {
|
||||
Material mat = Material.level.materials.elementAt(a);
|
||||
if (mat instanceof Switch4A) {
|
||||
sw = (Switch4A) mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
value = true;
|
||||
sw.count++;
|
||||
sw.room = item.room;
|
||||
}
|
||||
}
|
||||
}
|
29
src/com/droidquest/materials/switches/Switch4C.java
Normal file
29
src/com/droidquest/materials/switches/Switch4C.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.droidquest.materials.switches;
|
||||
|
||||
import com.droidquest.items.Item;
|
||||
import com.droidquest.materials.Material;
|
||||
|
||||
public class Switch4C extends Switch {
|
||||
private transient Switch4A sw = null;
|
||||
|
||||
public Switch4C() {
|
||||
super(Switch.ROT_DOWN);
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
if (sw == null) {
|
||||
for (int a = 0; a < Material.level.materials.size(); a++) {
|
||||
Material mat = Material.level.materials.elementAt(a);
|
||||
if (mat instanceof Switch4A) {
|
||||
sw = (Switch4A) mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
value = true;
|
||||
sw.count++;
|
||||
sw.room = item.room;
|
||||
}
|
||||
}
|
||||
}
|
30
src/com/droidquest/materials/switches/Switch4D.java
Normal file
30
src/com/droidquest/materials/switches/Switch4D.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.droidquest.materials.switches;
|
||||
|
||||
import com.droidquest.items.Item;
|
||||
import com.droidquest.materials.Material;
|
||||
|
||||
public class Switch4D extends Switch {
|
||||
private transient Switch4A sw = null;
|
||||
|
||||
public Switch4D() {
|
||||
super(Switch.ROT_LEFT);
|
||||
}
|
||||
|
||||
public void TouchedByItem(Item item) {
|
||||
if (sw == null) {
|
||||
for (int a = 0; a < Material.level.materials.size(); a++) {
|
||||
Material mat = Material.level.materials.elementAt(a);
|
||||
if (mat instanceof Switch4A) {
|
||||
sw = (Switch4A) mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
value = true;
|
||||
sw.count++;
|
||||
sw.room = item.room;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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) {
|
@@ -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) {
|
Reference in New Issue
Block a user