Class MoveToAi

  • All Implemented Interfaces:
    com.badlogic.gdx.ai.msg.Telegraph, Component, java.io.Serializable


    public class MoveToAi
    extends java.lang.Object
    implements com.badlogic.gdx.ai.msg.Telegraph, java.io.Serializable, Component
    A component that will move the connected MovableEntity to a position. Will keep the speed but if it falsl udner a threshold will use this.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MoveToAi​(Point goal)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean atGoal​(float dt)
      Can the goal be reached by the next frame?
      void dispose​()
      removes itself from parent
      Point getGoal​()  
      float getMinspeed​()
      Get the value of minspeed
      boolean handleMessage​(com.badlogic.gdx.ai.msg.Telegram msg)  
      void setMinspeed​(float minspeed)
      Set the value of minspeed
      void setParent​(AbstractEntity body)  
      void update​(float dt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MoveToAi

        public MoveToAi​(Point goal)
        Parameters:
        goal -
    • Method Detail

      • getMinspeed

        public float getMinspeed​()
        Get the value of minspeed
        Returns:
        the value of minspeed
      • setMinspeed

        public void setMinspeed​(float minspeed)
        Set the value of minspeed
        Parameters:
        minspeed - new value of minspeed
      • update

        public void update​(float dt)
        Specified by:
        update in interface Component
        Parameters:
        dt -
      • atGoal

        public boolean atGoal​(float dt)
        Can the goal be reached by the next frame?
        Parameters:
        dt - delta time in ms for this this frame
        Returns:
        if position is near the goal
      • handleMessage

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

        public Point getGoal​()
        Returns:
      • dispose

        public void dispose​()
        Description copied from interface: Component
        removes itself from parent
        Specified by:
        dispose in interface Component