#pragma once
#include "Entity.h"
#include "EntityStateSplash.h"
#define CS_ENEMY_ANT_CREATENAME L"CS_enemy_ant"
//敌人:红蚂蚁
class CS_Enemy_Ant :
    public ActionEntity
{
public:
    CS_Enemy_Ant();
    void Init(std::weak_ptr<Entity> self) override;
    void Step() override;
    void SetState(int stateID, int lr) override;
    bool Hurt(std::weak_ptr<Entity> src, int getDamage, float angle, bool bTakedown, int elemType, float shockForce, float heavy, int* outRealDamage) override;
    void Destroy() override;
private:
    EntityStateSplash stateSplash;
    //物理信息
   //地面
    const float ground_gravity_default = 0x48 / ts;
    const float ground_max_fall_speed = 0x4ff / ts;
    const float ground_move = 0x50 / ts;
    //水中
    const float inwater_gravity_default = 0x48 / 2 / ts;
    const float inwater_max_fall_speed = 0x5ff / 2 / ts;
    const float inwater_move = 0x50 / 2 / ts;
    //使用的物理信息
    float gravity_default;//当前默认重力
    float max_fall_speed;//当前最大下落速度
    float move;//当前移动速度
    float gravity;//当前重力
    bool attachWall = false;//吸附在墙上
    int disableAttachWallCounter = 0;
    int struggleCounter = 0;
    int dir = 0;
    //闪光
    void(CS_Enemy_Ant::* StateFunc)() = nullptr;//状态函数
    void SetPhysice(bool bInWater);//设置地面物理或水中物理
    void StepControl();//执行控制
    void StepGravity();//执行重力
    void SetEntityRect(int dir);
    //状态函数
    void StateMove();//移动状态
    void StateFall();//下落状态
    void StateStruggle();//挣扎状态
    //攻击区域
    std::weak_ptr<Entity> atkEntity;
    float lastX = 0;
    float lastY = 0;
};

std::shared_ptr<Entity> CreateCS_Enemy_Ant();