下面展示遊戲角色實體類設計
。
using system.collections;
using system.collections.generic;
using unityengine;
namespace mr_lbs
.client.unity3d
///
/// 稀有度
///
public
enum raregrade : int
;public
enum monsterdeathtype : int
///
/// 怪物當前的型別,特指當前稀有度下受技能影響的型別
///
public
enum monstercurrenttype
public struct numericvalue
// public struct skillnumericvalue
//
public
class
monsteritem
set}
public int count
set}
//是否由隨機盒子**現
public bool inbox
set}
}[system.serializable]
public
class
monster
public
monster
(monster monster)
int level;
int maxhealth;
int damage;
raregrade raregrade;
int holywaterconsume;
//聖水消耗值
float movespeed;
//移動速度,該值不變.
string pettype;
//寵物型別(寵物,建築,僱傭兵)
float vision;
//射程
int brothers;
numericvalue numericvalue;
public numericvalue numericvalue
// numericvalue.skill1level = attack.level;
// numericvalue.skill1damage = attack.damage;
if(skillc ==
null
) numericvalue.skill1level = skillc.level;
numericvalue.skill1damage = skillc.damage;
if(skillb ==
null
) numericvalue.skill2level = skillb.level;
numericvalue.skill2damage = skillb.damage;
if(skilla ==
null
) numericvalue.skill3level = skilla.level;
numericvalue.skill3damage = skilla.damage;
if(skills ==
null
) numericvalue.skill4level = skills.level;
numericvalue.skill4damage = skills.damage;
return numericvalue;
}set
attack.level = numericvalue.monsterlevel;
attack.damage = numericvalue.basedamage;
if(skillc ==
null
) skillc.level = numericvalue.skill1level;
skillc.damage = numericvalue.skill1damage;
if(skillb ==
null
) skillb.level = numericvalue.skill2level;
skillb.damage = numericvalue.skill2damage;
if(skilla ==
null
) skilla.level = numericvalue.skill3level;
skilla.damage = numericvalue.skill3damage;
if(skills ==
null
) skills.level = numericvalue.skill4level;
skills.damage = numericvalue.skill4damage;}}
//型別,對應inventorycode
string sort;
string name;
long id;
long uid;
//普通攻擊無等級,或者可以認為跟怪的等級一樣,傷害等同於怪的基礎傷害
// skill attack;
list skilllist;
skill d
; skill c
; skill b
; skill a
; skill s
; monsterstate state;
monsterdeathtype deathtype;
int health;
string des;
gameobject body;
public monsterdeathtype deathtype
set}
public int damage
set}
public gameobject body
set}
public string sort
set}
public string des
set}
public long uid
set}
public long id
set}
public int health
set}
public int maxhealth
set}
public monsterstate state
set}
public skill skills
set}
public skill skilla
set}
public skill skillb
set}
public skill skillc
set}
public skill attack
set}
public string name
set}
public int level
set}
public raregrade raregrade
set}
public int holywaterconsume
set}
public float movespeed
set}
public float vision
public list skilllist
public string pettype
public int brothers
}}
Lombok 簡化實體類開發
使用步驟 1.在idea中安裝lombok外掛程式 2.在專案中匯入lombok的jar包 org.projectlombokgroupid lombokartifactid 1.18.8version providedscope dependency 3.在實體類上使用註解 getter and ...
VS外掛程式開發(生成實體類)
寫了n年的 回頭過來看,其中有80 都是重複的 深入研究vs外掛程式開發,應用到工作中,讓自己減少基礎的 開發,增加開發效率 1 新增解決方案 extensiblity vsix project 2 新增專案 custom command 3 command1package.vsct 引數介紹 gu...
C 開發之XmlString與實體類物件的相互轉換
1.xmlstring轉化成實體類物件 xmlstring轉化成實體類物件即xml的解析並給實體類賦值。比如,將xml解析並生成cost實體類 public static object getcosts string xmlstring return mycosts 附xml樣式如下 100 12....