feat: added dragon colors to editor
This commit is contained in:
parent
d8419cb9a4
commit
409b7b5955
15 changed files with 114 additions and 120 deletions
|
@ -2,6 +2,7 @@ extends Resource
|
|||
class_name DragonOutfit
|
||||
|
||||
|
||||
@export var allow_null: bool
|
||||
@export var outfits: Array[Texture2D]
|
||||
var index: int = 0
|
||||
|
||||
|
@ -12,6 +13,21 @@ func _init(outfits: Array[Texture2D] = []):
|
|||
|
||||
func pick_next() -> Texture2D:
|
||||
index += 1
|
||||
if allow_null:
|
||||
return _pick_nullable()
|
||||
else:
|
||||
return _pick_non_nullable()
|
||||
|
||||
|
||||
func pick_previous() -> Texture2D:
|
||||
index -= 1
|
||||
if allow_null:
|
||||
return _pick_nullable()
|
||||
else:
|
||||
return _pick_non_nullable()
|
||||
|
||||
|
||||
func _pick_nullable():
|
||||
index %= (len(outfits) + 1)
|
||||
if index == 0:
|
||||
return null
|
||||
|
@ -19,6 +35,11 @@ func pick_next() -> Texture2D:
|
|||
return outfits[index - 1]
|
||||
|
||||
|
||||
func _pick_non_nullable():
|
||||
index %= len(outfits)
|
||||
return outfits[index]
|
||||
|
||||
|
||||
func get_index(texture: Texture2D) -> int:
|
||||
return outfits.find(texture)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue