当前位置:网站首页>June 11, 2022 diary: Mr. Wang's spring, mixed in
June 11, 2022 diary: Mr. Wang's spring, mixed in
2022-06-12 23:48:00 【Tuen Mun pheasants call me chicks】
Recommend a Zero sound College Free public courses , Personally, I think the teacher spoke well , Share with you :[Linux,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK, Streaming media ,CDN,P2P,K8S,Docker,TCP/IP, coroutines ,DPDK Etc , Learn now ]
Background server :https://course.0voice.com/v1/course/intro?courseId=5&agentId=0
ANSER
template <typename...T>
class role : public T... // Take the passed template parameter as the parent of the template of this class
{
public:
role() : T()..., m_attack(0.0), m_defence(0.0), m_life(100.0) {
}// At the beginning, the attack power and defense power are both 0, Blood volume 100;
role(double att, double def, double life) : T()..., m_attack(att), m_defence(def), m_life(life) {
}
public:
double m_attack; // aggressivity
double m_defence; // Defense
double m_life; // Blood volume ( Health value )
};
template <typename...T>
class family
{
public:
vector< role<T...> > m_members;
//.... Other information
};
using role_npc = role<npcattr>;
using role_player = role<playerattr>;
using role_mixnpc = role<npcattr,playerattr>; // Convenient combination through mixing technology , Free assembly of various functions
using family_npc = family<npcattr>;
This programming method solves the following problems , It can be said that whoever uses it knows .
//role Character class , Representing game player , Including attack power , Defense , Blood volume ( Health value ):
class role
{
public:
// Constructors :
role() :m_attack(0.0), m_defence(0.0), m_life(100.0) {
}// At the beginning, the attack power and defense power are both 0, Blood volume 100;
role(double att,double def,double life):m_attack(att), m_defence(def), m_life(life) {
}
public:
double m_attack; // aggressivity
double m_defence; // Defense
double m_life; // Blood volume ( Health value )
//......
};
class family
{
public:
vector<role> m_members;
//.... Other information
};
// The monster 、NPC( Non player characters ). NPC classification :0: Represents this kind of decoration of game scenes NPC,1: On behalf of businessmen , Selling clothes .2: Delegates send game tasks to players . Talking to oneself .
template<typename T>
class family
{
public:
//vector<role> m_members;
vector<T> m_members;
//.... Other information
};
//npc Attribute class
struct npcattr
{
int m_sort; //npc species :0: Represents this kind of decoration of game scenes NPC,1: On behalf of businessmen , Selling clothes .2: Delegates send game tasks to players .
std::string m_lang; // Record a sentence you say to yourself
};
NPC class
class role_npc :public role
{
public:
// Constructors
role_npc(): role(), m_strucattr{
0,"" }{
}
role_npc(double att, double def, double life, int sort, std::string lang) :role(att, def, life), m_strucattr{
sort,lang } {
}
public:
npcattr m_strucattr;
};
边栏推荐
- 测试平台系列(97) 完善执行case部分
- 1111111111111111111111111111111111111111111111111111111
- Explanation and practice of implicit transformation and implicit parameters in Scala
- 數組
- How to load 100000 pieces of data in leaflet
- Pytorch loading model error resolution
- 21 Chundong University blasting safety online peacetime operation 123 [standard answer]
- [literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)
- Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
- Find out the data that can match the keyword key in field 1 or field 2 in the database table. If you want to display the matching data in field 1 first
猜你喜欢

Test platform series (97) perfect the case part

Pytorch loading model error resolution

Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies

支持Canvas的Leaflet.Path.DashFlow动态流向线

H5時代leaflet中還在用DivIcon?

36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA

Is divicon still used in leaflet in H5 era?

2022 electrician (elementary) operation certificate examination question bank and online simulation examination

2202-简历制作

基于Three.js海上风电数字孪生三维效果
随机推荐
Buuctf-[ciscn 2019 preliminary]love math
M_8:设计消息队列存储消息数据的 MySQL 表格
Tableau
Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
How to use Huawei cloud disaster tolerance solution to replace disaster recovery all-in-one machine
Xi'an Jiaotong 22nd autumn e-commerce technology online expansion resources (IV) [standard answer]
最全预告!华为云精彩议程火速收藏
Start blogging
〖Kubernetes指南⑤〗Label快速入门
Teach you how to grab ZigBee packets through cc2531 and parse encrypted ZigBee packets
Video tracker error troubleshooting
How to get Matplotlib figure size
How leaflet gracefully displays the bubble window of overlapping points
Explanation and practice of implicit transformation and implicit parameters in Scala
CV - baseline summary (development history from alexnet to senet)
Is the stock account opened by qiniu Gang safe and reliable?
Using baserecyclerviewadapterhelper to implement tree structure
How to load 100000 pieces of data in leaflet
QT actual combat case (38) -- using qpprocess class to realize the function of starting process