using System;
using UnityEngine;
namespace Gaia
{
///
/// determines how the scale is set when a tree
///
public enum SpawnScale { Fixed, Fitness, Random, FitnessRandomized }
///
/// Used to control how the terrain world proptotypes work
///
public struct ProtoDNAInst
{
public ResourceProtoDNA dna;
public Vector3 locationWU;
public Vector3 locationTU;
public int age;
}
[System.Serializable]
public class ResourceProtoDNA
{
[Tooltip("Radius from centre of object in world units for bounded area checks. Make this larger if you want more free space around your object when it is spawned.")]
public float m_boundsRadius = 1f; //The radius of this object - used to help calculate free area
//[Tooltip("The maximum distance a seed can be thrown when a new instance is spawned. Used to control spread area random clustered spawning.")]
//public float m_seedThrow = 12; //The distance a seed can be thrown
//[Tooltip("The minimum scale that this can be rendered into the world. For terrain details this is the minimum strength that detail will render at.")]
//public float m_minScale = 0.5f; //The minimum size this can grow as a % scale of original model
//[Tooltip("The maximum scale that this can be rendered into the world. For terrain details this is the maximum strength that detail will render at.")]
//public float m_maxScale = 1.5f; //The maximum size this can grow as a % scale of original model
//[Tooltip("Randomise the scale somewhere between minimum and maximum scale. If not selected then the scale will be proportionally influenced by the locations fitness.")]
//public bool m_rndScaleInfluence = false; //Allow the scale to be randomly influenced, otherwise pure fitness based
public float m_scaleMultiplier = 1f;
[Tooltip("Custom parameter to be interpreted by an extension if there is one. Use 'nograss' to exclude grass being grown within the volumne covered by the area bounds.")]
public string m_extParam = "";
[HideInInspector]
public int m_protoIdx = 0; //The prototype we are describing - internal use only - do not touch
///
/// Update the prototype index
///
///
public void Update(int protoIdx)
{
m_protoIdx = protoIdx;
}
///
/// Update based on what we know
///
/// The prototype we refer to
/// The width in world units
/// The height in world units
public void Update(int protoIdx, float width, float height)
{
m_protoIdx = protoIdx;
//m_width = width;
//m_height = height;
m_boundsRadius = width;
//m_seedThrow = Mathf.Max(m_width, m_height) * 1.5f;
}
///
/// Update based on what we know
///
/// The prototype we refer to
/// The width in world units
/// The height in world units
/// The minimim scale we will draw at
/// The maximum scale we will draw at
public void Update(int protoIdx, float width, float height, float minscale, float maxscale)
{
m_protoIdx = protoIdx;
//m_width = width;
//m_height = height;
//m_boundsRadius = m_width;
//m_seedThrow = Mathf.Max(m_width, m_height) * 3;
//m_minScale = minscale;
//m_maxScale = maxscale;
}
///
/// Return a scale between min and max that accounts for the fitness of the object
///
/// Fitness - range of 0..1
/// Scale
//public float GetScale(float fitness)
//{
// return m_minScale + ((m_maxScale - m_minScale) * fitness);
//}
///
/// Return a scale between min and max that accounts for the fitness of the object, plus a random override
///
/// Fitness - range of 0..1
/// Random value - range of 0..1
/// Scale
//public float GetScale(float fitness, float random)
//{
// return m_minScale + ((m_maxScale - m_minScale) * fitness * random);
//}
}
}