⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aitankcontroller.h.svn-base

📁 坦克大战游戏完整全套源代码
💻 SVN-BASE
字号:
#ifndef AI_TANK_CONTROLLER_H
#define AI_TANK_CONTROLLER_H

#include <queue>
#include <list>

#include "caPoint2d.h"
#include "common/controlEntity.h"

using std::queue;
using std::list;
using cAni::Point2f;

class Map;

class AiTankController : public SingleController
{
public:
    AiTankController();
    virtual ~AiTankController();

    virtual void think();
    void attacheMap(Map *map);
    
    void goTo(const Point2f &pos); // findPath and go
    void resetOperates();

protected:
    void OnDettach(iAttacheeEntity &entity);

    void moveTo(const Point2f &pos, const Point2f &nextPos); // directly move
    void turnTo(const Point2f &pos);
    void aimTo(const Point2f &pos);

    bool findPathTo(const Point2f &pos, list<Point2f> &result);

    void stepMoveTo();

    void scanAround(); 

    Entity &getTankEntity()
    {
        return entity->getEntity();
    }
    bool bForward;
    bool bLeft;
    bool bRight;
    bool bBackward;
    bool bFire;
    bool bShoot;

    bool bCheckMoveTo;
    Point2f moveToPos, nextMoveToPos;
    struct Operate
    {
        enum CommandId
        {
            CI_MoveTo,
        };
        Operate(CommandId id) : commond(id)
        {
        }
        CommandId commond;
        list<Point2f> wayPoints;
    };
    queue<Operate> operates;

    SingleAttacher mapAttacher;
};

#endif//AI_TANK_CONTROLLER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -