Actor.gd 796 B

123456789101112131415161718192021222324252627282930
  1. extends CharacterBody2D
  2. class_name Actor
  3. #
  4. var inventory : ActorInventory = null
  5. var progress : ActorProgress = null
  6. var state : ActorCommons.State = ActorCommons.State.IDLE
  7. var stat : ActorStats = ActorStats.new()
  8. var type : ActorCommons.Type = ActorCommons.Type.NPC
  9. var nick : String = ""
  10. var data : EntityData = null
  11. #
  12. func SetData():
  13. pass
  14. func _init(_type : ActorCommons.Type = ActorCommons.Type.NPC, _data : EntityData = null, _nick : String = "", isManaged : bool = false):
  15. if not _data:
  16. return
  17. data = _data
  18. type = _type
  19. nick = _nick
  20. Callback.PlugCallback(ready, SetData)
  21. if type == ActorCommons.Type.PLAYER:
  22. inventory = ActorInventory.new(self)
  23. progress = ActorProgress.new(self, isManaged and type == ActorCommons.Type.PLAYER)
  24. stat.Init(self, data)