plant tester + shado assets
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
extends EntityData
|
||||
class_name PlantData
|
||||
|
||||
signal updated(p : PlantData)
|
||||
signal disappeared(p : PlantData)
|
||||
signal updated(p: PlantData)
|
||||
signal disappeared(p: PlantData)
|
||||
|
||||
enum State {PLANTED, GROWING, MATURE, DEAD}
|
||||
|
||||
@export var archetype: PlantArchetype
|
||||
@export var plant_name : String
|
||||
@export var mutations : Array[PlantMutation]
|
||||
@export var day : int :
|
||||
set(v):
|
||||
@export var plant_name: String
|
||||
@export var mutations: Array[PlantMutation]
|
||||
@export var day: int:
|
||||
set(v):
|
||||
day = v
|
||||
updated.emit(self)
|
||||
@export var random_seed : int
|
||||
updated.emit(self )
|
||||
@export var random_seed: int
|
||||
|
||||
@export var leafs = 0 # +1 score
|
||||
@export var roots = 0 # +1 lifetime
|
||||
@@ -21,11 +21,11 @@ enum State {PLANTED, GROWING, MATURE, DEAD}
|
||||
# var texture_builder: TextureBuilder = preload("res://entities/plants/scripts/texture_builder/texture_builder.tres")
|
||||
|
||||
func _init(
|
||||
_position : Vector2 = Vector2.ZERO,
|
||||
_archetype : PlantArchetype = PlantArchetype.get_random(),
|
||||
_plant_name : String = Random.generate_random_word(),
|
||||
_mutations : Array[PlantMutation] = [],
|
||||
_day : int = 0,
|
||||
_position: Vector2 = Vector2.ZERO,
|
||||
_archetype: PlantArchetype = PlantArchetype.get_random(),
|
||||
_plant_name: String = Random.generate_random_word(),
|
||||
_mutations: Array[PlantMutation] = [],
|
||||
_day: int = 0,
|
||||
_random_seed = randi()
|
||||
):
|
||||
position = _position
|
||||
@@ -36,9 +36,9 @@ func _init(
|
||||
random_seed = _random_seed
|
||||
|
||||
for m in mutations:
|
||||
m.mutate_plant_data(self)
|
||||
m.mutate_plant_data(self )
|
||||
|
||||
static func generate_from_seed(plant_seed : Seed, plant_position : Vector2) -> PlantData:
|
||||
static func generate_from_seed(plant_seed: Seed, plant_position: Vector2) -> PlantData:
|
||||
return PlantData.new(
|
||||
plant_position,
|
||||
plant_seed.plant_archetype,
|
||||
@@ -56,7 +56,7 @@ func get_lifetime() -> int:
|
||||
var lifetime = archetype.lifetime + roots
|
||||
|
||||
for m in mutations:
|
||||
lifetime = m.mutate_lifetime(self, lifetime)
|
||||
lifetime = m.mutate_lifetime(self , lifetime)
|
||||
|
||||
return lifetime
|
||||
|
||||
@@ -64,15 +64,18 @@ func get_growing_time() -> int:
|
||||
var growing_time = archetype.growing_time
|
||||
|
||||
for m in mutations:
|
||||
growing_time = m.mutate_growing_time(self, growing_time)
|
||||
growing_time = m.mutate_growing_time(self , growing_time)
|
||||
|
||||
return growing_time
|
||||
|
||||
func get_score(state : State = get_state()) -> int:
|
||||
func get_score(state: State = get_state()) -> int:
|
||||
var score = archetype.base_score + leafs if state == State.MATURE else 0
|
||||
|
||||
var mult := 1
|
||||
|
||||
for m in mutations:
|
||||
score = m.mutate_score(self, score)
|
||||
score = m.mutate_score(self , score)
|
||||
mult = m.mutate_score_multiplier(self , mult)
|
||||
|
||||
return score
|
||||
|
||||
@@ -89,14 +92,14 @@ func get_seed_number(state = get_state()):
|
||||
var seed_number = archetype.seed_number if (state == State.MATURE or state == State.DEAD) else 0
|
||||
|
||||
for m in mutations:
|
||||
seed_number = m.mutate_seed_number(self, seed_number)
|
||||
seed_number = m.mutate_seed_number(self , seed_number)
|
||||
|
||||
return seed_number
|
||||
|
||||
func get_seed_random_loose():
|
||||
var seed_random_loose = archetype.seed_random_loose
|
||||
for m in mutations:
|
||||
seed_random_loose = m.mutate_seed_random_loose(self, seed_random_loose)
|
||||
seed_random_loose = m.mutate_seed_random_loose(self , seed_random_loose)
|
||||
|
||||
return seed_random_loose
|
||||
|
||||
@@ -107,4 +110,4 @@ func get_random_seed_income():
|
||||
)
|
||||
|
||||
func disappear():
|
||||
disappeared.emit(self)
|
||||
disappeared.emit(self )
|
||||
|
||||
Reference in New Issue
Block a user