Files
2026-03-04 10:03:45 +08:00

87 lines
2.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Gaia
{
[Serializable]
public class ResourceProtoStamp
{
[Tooltip("Stamp name.")]
public string m_name;
[Tooltip("Stamp texture.")]
public Texture2D m_texture;
[Tooltip("How far from the terrains anchor point the tiling will start.")]
public bool m_stickToGround = true;
[Tooltip("DNA - Used by the spawner to control how and where the tree will be spawned.")]
public ResourceProtoDNA m_dna;
[Tooltip("SPAWN CRITERIA - Spawn criteria are run against the terrain to assess its fitness in a range of 0..1 for use by this resource. If you add multiple criteria then the fittest one will be selected.")]
public SpawnCritera[] m_spawnCriteria = new SpawnCritera[0];
public void Initialise(Spawner spawner)
{
SpawnCritera[] spawnCriteria = m_spawnCriteria;
for (int i = 0; i < spawnCriteria.Length; i++)
{
spawnCriteria[i].Initialise(spawner);
}
}
public bool HasActiveCriteria()
{
for (int i = 0; i < m_spawnCriteria.Length; i++)
{
if (m_spawnCriteria[i].m_isActive)
{
return true;
}
}
return false;
}
public bool ChecksTextures()
{
for (int i = 0; i < m_spawnCriteria.Length; i++)
{
if (m_spawnCriteria[i].m_isActive && m_spawnCriteria[i].m_checkTexture)
{
return true;
}
}
return false;
}
public bool ChecksProximity()
{
for (int i = 0; i < m_spawnCriteria.Length; i++)
{
if (m_spawnCriteria[i].m_isActive && m_spawnCriteria[i].m_checkProximity)
{
return true;
}
}
return false;
}
public void AddTags(ref List<string> tagList)
{
for (int i = 0; i < m_spawnCriteria.Length; i++)
{
if (m_spawnCriteria[i].m_isActive && m_spawnCriteria[i].m_checkProximity && !tagList.Contains(m_spawnCriteria[i].m_proximityTag))
{
tagList.Add(m_spawnCriteria[i].m_proximityTag);
}
}
}
public void AddStamps(ref List<string> stampList)
{
_ = m_texture != null;
}
}
}