Class 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
    • 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:
        update in class AbstractEntity
        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
      • handleMessage

        public boolean handleMessage​(com.badlogic.gdx.ai.msg.Telegram msg)
        Specified by:
        handleMessage in interface com.badlogic.gdx.ai.msg.Telegraph
      • setLaserHidden

        public void setLaserHidden​(boolean hidden)
        Parameters:
        hidden -
      • isLoaded

        public boolean isLoaded​()
        Returns: