package com.ezardlabs.lostsector.objects.environment;

import com.ezardlabs.dethsquare.Animator;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.Component;
import com.ezardlabs.lostsector.objects.warframes.Warframe;

public class Locker extends Component {
	private final boolean locked;
	private boolean unlocking = false;

	public Locker(boolean locked) {
		this.locked = locked;
	}

	@Override
	public void onTriggerEnter(Collider other) {
		if (!locked && !unlocking && other.gameObject.name.equals("Player")) {
			unlocking = true;
			//noinspection ConstantConditions
			gameObject.getComponent(Animator.class).play("unlock");
			Warframe w = (Warframe) other.gameObject.getComponentOfType(Warframe.class);
			//noinspection ConstantConditions
			w.addHealth(20);
			w.addEnergy(25);
		}
	}
}
@@ -90,95 +90,284 @@
 imat
-or;%0Aimport com.ezardlabs.dethsquare.Collider;%0Aimport com.ezardlabs.dethsquare.Component
+ion;%0Aimport com.ezardlabs.dethsquare.AnimationType;%0Aimport com.ezardlabs.dethsquare.Animator;%0Aimport com.ezardlabs.dethsquare.Collider;%0Aimport com.ezardlabs.dethsquare.Component;%0Aimport com.ezardlabs.dethsquare.TextureAtlas;%0Aimport com.ezardlabs.dethsquare.TextureAtlas.Sprite
 ;%0Aim
@@ -496,16 +496,48 @@
 locked;%0A
+%09private final TextureAtlas ta;%0A
 %09private
@@ -594,16 +594,33 @@
 n locked
+, TextureAtlas ta
 ) %7B%0A%09%09th
@@ -639,16 +639,541 @@
 locked;%0A
+%09%09this.ta = ta;%0A%09%7D%0A%0A%09@Override%0A%09public void start() %7B%0A%09%09super.start();%0A%09%09gameObject.renderer.setTextureAtlas(ta, 100, 200);%0A%09%09if (locked) %7B%0A%09%09%09gameObject.renderer.setSprite(ta.getSprite(%22lockred%22));%0A%09%09%7D else %7B%0A%09%09%09gameObject.renderer.setSprite(ta.getSprite(%22lock0%22));%0A%09%09%09gameObject.animator.addAnimations(new Animation(%22unlock%22,%0A%09%09%09%09%09new Sprite%5B%5D%7Bta.getSprite(%22lock1%22),%0A%09%09%09%09%09%09%09ta.getSprite(%22lock2%22),%0A%09%09%09%09%09%09%09ta.getSprite(%22lock3%22),%0A%09%09%09%09%09%09%09ta.getSprite(%22lock4%22),%0A%09%09%09%09%09%09%09ta.getSprite(%22lock5%22)%7D, AnimationType.ONE_SHOT, 125));%0A%09%09%7D%0A
 %09%7D%0A%0A%09@Ov

Make locker objects self-contained