Changeset 8edd04e in lost-haven for main/Location.java
- Timestamp:
- Jun 7, 2020, 3:04:32 PM (5 years ago)
- Branches:
- master
- Children:
- a49176d
- Parents:
- 155577b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/Location.java
r155577b r8edd04e 1 1 package main; 2 2 3 import java.util. *;3 import java.util.PriorityQueue; 4 4 5 5 public class Location { 6 private Land land;7 private Structure structure;8 private PriorityQueue<Creature> creatures;9 10 public Location(Land land, Structure structure) {11 this.land = land;12 this.structure = structure;13 this.creatures = new PriorityQueue<Creature>();14 }15 6 16 public void addCreature(Creature creature) { 17 creatures.add(creature); 18 } 19 20 public Land getLand() { 21 return land; 22 } 7 private Land land; 8 private Structure structure; 9 private PriorityQueue<Creature> creatures; 23 10 24 public Structure getStruct() { 25 return structure; 26 } 27 28 public void setLand(Land type) { 29 land = type; 30 } 31 32 public void setStruct(Structure type) { 33 structure = type; 34 } 35 36 public boolean isPassable() { 37 return land.isPassable() && structure.isPassable(); 38 } 11 public Location(Land land, Structure structure) { 12 this.land = land; 13 this.structure = structure; 14 this.creatures = new PriorityQueue<Creature>(); 15 } 16 17 public void addCreature(Creature creature) { 18 this.creatures.add(creature); 19 } 20 21 public void spawnCreature(Creature creature, Point loc) { 22 Creature newC = creature.copy(); 23 newC.setLoc(loc); 24 this.creatures.add(newC); 25 } 26 27 public Land getLand() { 28 return this.land; 29 } 30 31 public Structure getStruct() { 32 return this.structure; 33 } 34 35 public PriorityQueue<Creature> getCreatures() { 36 return this.creatures; 37 } 38 39 public void setLand(Land type) { 40 this.land = type; 41 } 42 43 public void setStruct(Structure type) { 44 this.structure = type; 45 } 46 47 public boolean isPassable() { 48 return (this.land.isPassable() && this.structure.isPassable()); 49 } 39 50 }
Note:
See TracChangeset
for help on using the changeset viewer.