-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFairytaleCharacter.java
More file actions
27 lines (27 loc) · 1.15 KB
/
Copy pathFairytaleCharacter.java
File metadata and controls
27 lines (27 loc) · 1.15 KB
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
package lab4;
public class FairytaleCharacter extends Creature {
private boolean isFlying = false;
private Entity purpose;
public FairytaleCharacter(){
super();
}
public FairytaleCharacter(String name){
super(name);
}
public FairytaleCharacter(String name, int age){
super(name, age);
}
public void flyWithSomebody(Creature creature, TypeOfHolder typeOfHolder, Entity purpose) {
isFlying = true;
this.purpose = purpose;
System.out.println(getName() + " летит с человеком по имени " + creature.getName() + ", способ крепления: " + typeOfHolder.getType() + ", цель полета: " + purpose.getInformation() + ".");
}
public void stopFlying() {
isFlying = false;
System.out.println(getName() + " закончил лететь, достигнув цели: " + purpose.getInformation() + ".");
}
public void canDoSomethingLikeAnimal(String animal, TypeOfAction typeOfAction, Entity object) {
isFlying = false;
System.out.println(getName() + " может " + typeOfAction.getType() + " (объект - " + object.getName() + ") как " + animal + ".");
}
}