/// <summary> /// Constructor /// </summary> /// <param name="resType">Resource Type</param> /// <param name="amount">Resource Amount</param> /// <param name="isInfinite">Is it infinite?</param> public ResourceSourceData(ResourceType resType, int amount, bool isInfinite = false) { m_ResourceType = resType; Amount = amount; IsInfinite = isInfinite; }
/// <summary> /// Constructor, initialize variables, register resource /// </summary> /// <param name="resourceSourceWrapper">Reference to the Unity Resource Source Wrapper</param> /// <param name="position">Position of the Resource</param> /// <param name="resourceType">Type of the Resource</param> /// <param name="amount">Amount of the Resource</param> /// <param name="isInfinite">Is the resource infinite?</param> public ResourceSource(ResourceSourceWrapper resourceSourceWrapper, Vector3 position, ResourceType resourceType = ResourceType.Water, int amount = 10, bool isInfinite = false) { m_Position = position; AstarPath p = AstarPath.active; m_NearestNode = p.GetNearest(position).node; m_ResourceSourceData = new ResourceSourceData(resourceType, amount, isInfinite); ResourceSourceWrapperRef = resourceSourceWrapper; PlanetDatalayer.Instance.GetManager <ResourceManager>().RegisterResourceSource(this); }