DEADSOFTWARE

Implement dependency injection for game classes #13
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / objects / Item.java
1 package ru.deadsoftware.cavedroid.game.objects;
3 import com.badlogic.gdx.graphics.g2d.Sprite;
5 import javax.annotation.CheckForNull;
7 public class Item {
9 private final String name;
10 private final String type;
11 @CheckForNull
12 private final Sprite tex;
14 public Item(String name, String type, @CheckForNull Sprite tex) {
15 this.name = name;
16 this.type = type;
17 this.tex = tex;
18 if (this.tex != null) {
19 this.tex.flip(false, true);
20 }
21 }
23 public Sprite getTexture() {
24 assert tex != null;
25 return tex;
26 }
28 public String getType() {
29 return type;
30 }
32 public boolean isBlock() {
33 return type.equals("block");
34 }
36 public String getName() {
37 return name;
38 }
40 }