Show / Hide Table of Contents

Class PlantSim

Inheritance
System.Object
PlantSim
Namespace: Eco.Simulation
Assembly: Eco.Simulation.dll
Syntax
public class PlantSim : Object

Constructors

PlantSim()

Declaration
public PlantSim()

Fields

PlantCellCache

Declaration
public PlantCache PlantCellCache
Field Value
Type Description
PlantCache

Properties

All

Declaration
public IEnumerable<Plant> All { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Plant>

NumPlants

Declaration
public int NumPlants { get; }
Property Value
Type Description
System.Int32

NutrientLayers

Declaration
public Dictionary<string, AccumulatingPuller> NutrientLayers { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, AccumulatingPuller>

Methods

AllFertileSpaces(WorldArea)

Declaration
public IEnumerable<Vector3i> AllFertileSpaces(WorldArea worldRange)
Parameters
Type Name Description
WorldArea worldRange
Returns
Type Description
System.Collections.Generic.IEnumerable<Vector3i>

AnyPlantsWithinRange(WrappedWorldPosition3i, Single, Predicate<Plant>)

Declaration
public bool AnyPlantsWithinRange(WrappedWorldPosition3i pos, float radius, Predicate<Plant> predicate)
Parameters
Type Name Description
WrappedWorldPosition3i pos
System.Single radius
System.Predicate<Plant> predicate
Returns
Type Description
System.Boolean

Clear()

Declaration
public void Clear()

DestroyPlant(Plant, DeathType, Boolean, Object)

Declaration
public void DestroyPlant(Plant plant, DeathType deathType, bool addToPuller = true, object killer = null)
Parameters
Type Name Description
Plant plant
DeathType deathType
System.Boolean addToPuller
System.Object killer

EnumerableOfArea(WorldArea, PlantSpecies)

Use this as low-memory allocation option for iterating over plants in area. Internally it will use a lock and pooled list to get plants and release the pooled list in the end of iteration. Can be used with linq methods, like Sum, but HyperLinq is prefered since it won't create allocations.

Declaration
public PlantsInAreaEnumerable EnumerableOfArea(WorldArea area, PlantSpecies species = null)
Parameters
Type Name Description
WorldArea area
PlantSpecies species
Returns
Type Description
PlantsInAreaEnumerable

Fertile(Vector2i)

Declaration
public bool Fertile(Vector2i pos)
Parameters
Type Name Description
Vector2i pos
Returns
Type Description
System.Boolean

FertileSpaces(WorldArea, Boolean)

Declaration
public IEnumerable<Vector3i> FertileSpaces(WorldArea worldArea, bool underwater = false)
Parameters
Type Name Description
WorldArea worldArea
System.Boolean underwater
Returns
Type Description
System.Collections.Generic.IEnumerable<Vector3i>

ForEachPlant(Action<Plant>)

Declaration
public void ForEachPlant(Action<Plant> action)
Parameters
Type Name Description
System.Action<Plant> action

GetPlant(Vector3i)

Declaration
public Plant GetPlant(Vector3i position)
Parameters
Type Name Description
Vector3i position
Returns
Type Description
Plant

GetPlant(WorldPosition3i)

Declaration
public Plant GetPlant(WorldPosition3i position)
Parameters
Type Name Description
WorldPosition3i position
Returns
Type Description
Plant

GetPlant(WrappedWorldPosition3i)

Declaration
public Plant GetPlant(WrappedWorldPosition3i position)
Parameters
Type Name Description
WrappedWorldPosition3i position
Returns
Type Description
Plant

KillPlant(Plant, DeathType, Boolean)

Turn the plant into a gross dead version. Leave the block and the plant entry.

Declaration
public void KillPlant(Plant plant, DeathType deathType, bool addToPuller = true)
Parameters
Type Name Description
Plant plant
DeathType deathType
System.Boolean addToPuller

MarkAllDirty()

Declaration
public void MarkAllDirty()

OnPlantBlockDestroyed(Plant)

Declaration
public void OnPlantBlockDestroyed(Plant plant)
Parameters
Type Name Description
Plant plant

PlantsInBounds(Vector2, Vector2)

Enumerates plants in bounds specified by center point and extents.

Declaration
public PlantsInAreaEnumerable PlantsInBounds(Vector2 center, Vector2 extents)
Parameters
Type Name Description
Vector2 center
Vector2 extents
Returns
Type Description
PlantsInAreaEnumerable

PlantsWithinRange(Vector2, Single, Predicate<Plant>)

Declaration
public IEnumerable<Plant> PlantsWithinRange(Vector2 pos, float radius, Predicate<Plant> predicate)
Parameters
Type Name Description
Vector2 pos
System.Single radius
System.Predicate<Plant> predicate
Returns
Type Description
System.Collections.Generic.IEnumerable<Plant>

PlantsWithinRange(Vector3, Single, Predicate<Plant>)

Declaration
public IEnumerable<Plant> PlantsWithinRange(Vector3 pos, float radius, Predicate<Plant> predicate)
Parameters
Type Name Description
System.Numerics.Vector3 pos
System.Single radius
System.Predicate<Plant> predicate
Returns
Type Description
System.Collections.Generic.IEnumerable<Plant>

SpawnPlant(PlantSpecies, WorldPosition3i, Boolean)

Declaration
public Plant SpawnPlant(PlantSpecies species, WorldPosition3i pos, bool addToPuller = true)
Parameters
Type Name Description
PlantSpecies species
WorldPosition3i pos
System.Boolean addToPuller
Returns
Type Description
Plant

Tick()

Declaration
public void Tick()

TotalFertility(WorldArea, Boolean)

Calculates total fertility over worldArea. Either for ground or underwater blocks.

Declaration
public float TotalFertility(WorldArea worldArea, bool underwater)
Parameters
Type Name Description
WorldArea worldArea
System.Boolean underwater
Returns
Type Description
System.Single

UpRootPlant(Plant)

Declaration
public void UpRootPlant(Plant plant)
Parameters
Type Name Description
Plant plant
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾