Class Weapon
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.Renderable
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
-
- com.bombinggames.wurfelengine.extension.shooting.Weapon
-
- All Implemented Interfaces:
com.badlogic.gdx.ai.msg.Telegraph
public class Weapon extends AbstractEntity implements com.badlogic.gdx.ai.msg.Telegraph
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
colissionRadius
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
sprite
-
-
Constructor Summary
Constructors Constructor Description Weapon(byte weaponid, AbstractGameObject parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Deletes the object from the map and every other container.PointgetFixedPos()PointgetImpactPoint()returns the position of the laserdot, the point where the aiming impactsintgetReloadingTime()intgetShots()intgetShotsLoaded()intgetWeaponId()booleanhandleMessage(com.badlogic.gdx.ai.msg.Telegram msg)voidignoreBlock(byte id)booleanisLoaded()voidreload()reloads the weaponvoidsetAimDir(com.badlogic.gdx.math.Vector3 dir)voidsetFireSound(java.lang.String fire, boolean bustSound)voidsetFixedPos(Point fixedPos)The point where the weapon returns after shooting.voidsetLaserHidden(boolean hidden)voidsetMaxDistance(float maxDistance)voidsetReload(java.lang.String reload)voidshoot()shoots the weapon. like holding the trigger downvoidupdate(float dt)Manages the weapon-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
addComponent, collidesWith, getCollidingEntities, getCollidingEntities, getComponents, getComponents, getCoord, getCoveredBlocks, getDimensionZ, getHealth, getLightlevelB, getLightlevelG, getLightlevelR, getMass, getName, getPoint, getPosition, getRegisteredEntities, getSpriteCategory, getSpriteId, getSpriteValue, hasPosition, heal, isIndestructible, isInMemoryArea, isMarkedDS, isOnGround, isSavedPersistent, markAsVisitedDS, registerEngineEntities, registerEntity, removeComponent, removeFromMap, requestChunk, setDamageSounds, setDimensionZ, setHealth, setIndestructible, setLightlevel, setMass, setName, setPosition, setPosition, setSavePersistent, setSpriteCategory, setSpriteId, setSpriteValue, setUseRawDelta, shouldBeDisposed, spawn, takeDamage, useRawDelta
-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
getColor, getDepth, getPixmap, getRotation, getScaling, getSprite, getSprite, getSpritesheet, getSpritesheetPath, getTextureDiffuse, getTextureNormal, isHidden, loadSheet, render, render, setColor, setCustomSpritesheet, setHidden, setRotation, setScaling, shouldBeRendered, staticDispose, updateSpriteCache
-
-
-
-
Constructor Detail
-
Weapon
public Weapon(byte weaponid, AbstractGameObject parent)- Parameters:
weaponid-parent- the object which holds the weapon
-
-
Method Detail
-
setFixedPos
public void setFixedPos(Point fixedPos)
The point where the weapon returns after shooting.- Parameters:
fixedPos-
-
setMaxDistance
public void setMaxDistance(float maxDistance)
- Parameters:
maxDistance-
-
getFixedPos
public Point getFixedPos()
- Returns:
- can be null
-
getWeaponId
public int getWeaponId()
- Returns:
- the weapon's id
-
update
public void update(float dt)
Manages the weapon- Overrides:
updatein classAbstractEntity- Parameters:
dt- t in ms
-
setAimDir
public void setAimDir(com.badlogic.gdx.math.Vector3 dir)
- Parameters:
dir-
-
shoot
public void shoot()
shoots the weapon. like holding the trigger down
-
ignoreBlock
public void ignoreBlock(byte id)
- Parameters:
id-
-
reload
public void reload()
reloads the weapon
-
getShotsLoaded
public int getShotsLoaded()
- Returns:
-
getShots
public int getShots()
- Returns:
-
getReloadingTime
public int getReloadingTime()
- Returns:
-
setFireSound
public void setFireSound(java.lang.String fire, boolean bustSound)- Parameters:
fire-bustSound- true if one sound per bust. false to play sound at every shot.
-
setReload
public void setReload(java.lang.String reload)
- Parameters:
reload-
-
getImpactPoint
public Point getImpactPoint()
returns the position of the laserdot, the point where the aiming impacts- Returns:
- a copy
-
dispose
public void dispose()
Description copied from class:AbstractEntityDeletes the object from the map and every other container. The opposite to spawn() but also sets a flag to remove it completely.- Overrides:
disposein classAbstractEntity- See Also:
AbstractEntity.shouldBeDisposed(),AbstractEntity.removeFromMap()
-
handleMessage
public boolean handleMessage(com.badlogic.gdx.ai.msg.Telegram msg)
- Specified by:
handleMessagein interfacecom.badlogic.gdx.ai.msg.Telegraph
-
setLaserHidden
public void setLaserHidden(boolean hidden)
- Parameters:
hidden-
-
isLoaded
public boolean isLoaded()
- Returns:
-
-