-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObject.java
75 lines (53 loc) · 1.71 KB
/
Object.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package Icefield;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public abstract class Object {
public String Name;
//++Each object get an owner after being retrived by this owner
public Figure owner;
// Condition for visibility of the object
public boolean isSeen;
//++
public boolean used = false;
// Position of the object
public int x;
public int y;
protected Cell STATE;
public static void showOnGUI(Object ob)
{
System.out.println("This is a "+ ob.Name +", press any key to pick");
// Logic: show this object in GUI
}
public static void Used(Object ob, Figure figure, String input, String output) {
//First it will be shown on the GUI of the game
showOnGUI(ob);
//This part is just for the skeleton. In the main program, this logic will be replaced with another one that can be implemented on GUI
Scanner sc = new Scanner(System.in);
char ch = sc.next().charAt(0);
System.out.println(ob.Name+" was taken!");
//These two lines below makes the link between this instance and the owner's pocket (items list)
//implementation shall be completed in figure class
ob.owner = figure;
ob.owner.CollectItem(ob);
ob.used = true;
}
public static boolean isUsed(Object ob) {
// Logic: Check whether charge is used or not!
return ob.used;
}
// ADDED BY MURAD AND TOGHRUL
public void setState(Cell STATE) {
this.STATE = STATE;
}
}
public Cell getState() {
return this.STATE;
}
}
}