72 lines
1.5 KiB
Java
72 lines
1.5 KiB
Java
package gameplay.actions;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import gameplay.frames.Frame;
|
|
import gameplay.input.ButtonIG;
|
|
|
|
public class Throw implements Action {
|
|
|
|
/**
|
|
* Defines if the throw is a special one (E.G. a Moonsault Press ) or a normal one
|
|
*/
|
|
private boolean isSpecial;
|
|
|
|
/**
|
|
* The suite of Inputs to have the move come out.
|
|
* For example, a Moonsault Press would be something like
|
|
* {{LEFT},{DOWN,LEFT},{DOWN},{DOWN,RIGHT},{RIGHT},{RIGHT,UP},{UP},{A}}
|
|
*/
|
|
private ButtonIG[][] command;
|
|
|
|
/**
|
|
* The different sections of the throw
|
|
*/
|
|
private ThrowPart[] parts;
|
|
|
|
@Override
|
|
public ArrayList<Frame> getFrame() {
|
|
ArrayList<Frame> res = new ArrayList<Frame>();
|
|
|
|
//browse parts
|
|
for(int i = 0; i < this.parts.length; i++) {
|
|
|
|
//stock current tab of frames
|
|
Frame[] tmp = this.parts[i].getFrames();
|
|
int size = tmp.length;
|
|
if(this.parts[i].getisActive()) {
|
|
if(this.parts[i].hasHit()) {
|
|
for(int j = 0; j < size; j++) {
|
|
res.add(tmp[i]);
|
|
}
|
|
}
|
|
}else {
|
|
//browse the tab of frames and add it into a list
|
|
for(int j = 0; j < size; j++) {
|
|
res.add(tmp[i]);
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
|
|
@Override
|
|
public ButtonIG[][] getCommand() {
|
|
return this.command;
|
|
}
|
|
|
|
public Throw(boolean isSpecial, ThrowPart[] parts) {
|
|
this.isSpecial = isSpecial;
|
|
this.parts = parts;
|
|
}
|
|
|
|
public Throw() {
|
|
}
|
|
|
|
public Throw(boolean isSpecial, ButtonIG[][] command, ThrowPart[] parts) {
|
|
this.isSpecial = isSpecial;
|
|
this.command = command;
|
|
this.parts = parts;
|
|
}
|
|
}
|