public void setHurtEnemy() { state = 1; DrawComponent drawComp = ( DrawComponent )myEnt.getComponent(GlobalVars.DRAW_COMPONENT_NAME); if (drawComp != null) { int imgIndex = drawComp.getSprite().currentImageIndex; drawComp.setSprite(this.goodShooterName, false); drawComp.getSprite().currentImageIndex = imgIndex; } }
public void setHurtPlayer() { state = 0; DrawComponent drawComp = ( DrawComponent )myEnt.getComponent(GlobalVars.DRAW_COMPONENT_NAME); if (drawComp != null) { int imgIndex = drawComp.getSprite().currentImageIndex; drawComp.setSprite(this.badSpriteName, false); drawComp.getSprite().currentImageIndex = imgIndex; } }
public void setActive(bool val) { this.activated = val; DrawComponent drawComp = ( DrawComponent )myEnt.getComponent(GlobalVars.DRAW_COMPONENT_NAME); if (drawComp == null) { Console.WriteLine("Error: Trying to activate a switch with no draw component."); return; } if (isActive()) { drawComp.setSprite(animImageName); AnimationComponent animComp = ( AnimationComponent )myEnt.getComponent(GlobalVars.ANIMATION_COMPONENT_NAME); animComp.imageAfterCycleName = checkedImageName; animComp.animationOn = true; } else { drawComp.setSprite(uncheckedImageName); } }