示例#1
0
func (self *Character) AddSkill(id types.Id) {
	self.writeLock(func() {
		if !self.HasSkill(id) {
			return
		}
		if self.Skills == nil {
			self.Skills = utils.Set{}
		}
		self.Skills.Insert(id.Hex())
	})
}
示例#2
0
func (self *Character) HasSkill(id types.Id) bool {
	self.ReadLock()
	defer self.ReadUnlock()
	return self.Skills.Contains(id.Hex())
}
示例#3
0
func (self *Character) RemoveSkill(id types.Id) {
	self.writeLock(func() {
		self.Skills.Remove(id.Hex())
	})
}