Ejemplo n.º 1
0
		public KGFMarkerEventArgs(KGFIMapIcon theMarker)
		{
			itsMarker = theMarker;
		}
Ejemplo n.º 2
0
	/// <summary>
	/// Tells you if a specific KGFMapIcon is currently visible on the KGFMapSystem
	/// </summary>
	/// <remarks>
	/// Use this method if you want to know if a specific KGFMapIcon is currently vivible on the KGFMapSystem.
	/// The icon can be invisible because it is outside the visible map area, or it can be invisible because it is hidden.
	/// </remarks>
	/// <example>
	/// How to find out if a specific KGFMapIcon is visible on the KGFMapSystem at runtime
	/// <code>
	/// using UnityEngine;
	/// using System;
	/// 
	/// public class MyMinimapController : MonoBehaviour
	/// {
	/// 	public KGFMapSystem itsKGFMapSystem;	//references to the KGFMapSystem
	/// 	public KGFMapIcon[] itsKGFMapIcons;		//array of KGFMapIcons
	///
	/// 	public void Update()
	/// 	{
	/// 		if(itsKGFMapSystem != null && itsKGFMapIcons != null)
	/// 		{
	/// 			foreach(KGFMapIcon aMapIcon in itsKGFMapIcons)
	/// 			{
	/// 				if(itsKGFMapSystem.GetIsVisibleOnMap(aMapIcon))
	/// 					Debug.Log("KGFMapIcon: "+aMapIcon.gameObject.name+" is visible");
	/// 				else
	/// 					Debug.Log("KGFMapIcon: "+aMapIcon.gameObject.name+" is not visible");
	///
	/// 			}
	/// 		}
	/// 	}
	/// }
	/// </code>
	/// </example>
	/// <param name="theMapIcon">The KGFMapIcon you want to check for visibility</param>
	/// <returns>bool true if the KGFMapIcon is inside the map area and visible, false if the KGFMapIcon is outside the map area or hidden</returns>
	public bool GetIsVisibleOnMap(KGFIMapIcon theMapIcon)
	{
		for (int i=itsListMapIcons.Count-1;i>=0;i--)
		{
			mapicon_listitem_script aListItem = itsListMapIcons[i];
			if (aListItem.itsMapIcon == theMapIcon)
			{
				return (!aListItem.GetIsArrowVisible() && aListItem.GetMapIconVisibilityEffective());
			}
		}
		return false;
	}
Ejemplo n.º 3
0
	/// <summary>
	/// Unregister a map icon
	/// </summary>
	/// <param name="theMapIcon"></param>
	void UnregisterMapIcon(KGFIMapIcon theMapIcon)
	{
		mapicon_listitem_script anIconToRemove = null;
		for (int i=0;i<itsListMapIcons.Count;i++)
		{
			mapicon_listitem_script anItem = itsListMapIcons[i];
			if (anItem.itsMapIcon == theMapIcon)
			{
				anIconToRemove = anItem;
				break;
			}
		}
		if(anIconToRemove != null)
		{
			LogInfo("Removed map icon of "+anIconToRemove.itsMapIconTransform.gameObject.GetObjectPath(),name,this);
			anIconToRemove.Destroy();
			itsListMapIcons.Remove(anIconToRemove);
		}
	}
Ejemplo n.º 4
0
	/// <summary>
	/// Register map icon
	/// </summary>
	/// <param name="theMapIcon"></param>
	void RegisterIcon(KGFIMapIcon theMapIcon)
	{
		// create copy of static representation
		GameObject aSpatialArrow = null;
		// create copy of representation
		GameObject aSpatialNewMapIcon = null;
		
		aSpatialNewMapIcon = theMapIcon.GetRepresentation();
		if(aSpatialNewMapIcon == null)
		{
			LogError("missing icon representation for: "+theMapIcon.GetGameObjectName(),name,this);
			return;
		}
		
		UpdateIconLayer(theMapIcon);
		
		if (theMapIcon.GetTextureArrow() != null)
		{
			aSpatialArrow = GenerateTexturePlane(theMapIcon.GetTextureArrow(),itsDataModuleMinimap.itsShaders.itsShaderMapIcon);
			aSpatialArrow.transform.parent = itsContainerIconArrows;
			aSpatialArrow.transform.localPosition = Vector3.zero;
			aSpatialArrow.transform.localScale = Vector3.one;
			aSpatialArrow.GetComponent<MeshRenderer>().material.renderQueue = 3200;
			SetLayerRecursively(aSpatialArrow.gameObject,itsLayerMinimap);
		}
		
		// reparent it
		aSpatialNewMapIcon.transform.parent = itsContainerIcons;
		aSpatialNewMapIcon.transform.position = Vector3.zero;
		SetLayerRecursively(aSpatialNewMapIcon.gameObject,itsLayerMinimap);

		// remember it
		mapicon_listitem_script aNewItem = new mapicon_listitem_script();
		aNewItem.itsModule = this;
		aNewItem.itsMapIcon = theMapIcon;
		aNewItem.itsRepresentationInstance = aSpatialNewMapIcon;
		aNewItem.itsRepresentationInstanceTransform = aSpatialNewMapIcon.transform;
		aNewItem.itsRotate = theMapIcon.GetRotate();
		
		aNewItem.itsRepresentationArrowInstance = aSpatialArrow;
		aNewItem.itsMapIconTransform = theMapIcon.GetTransform();
		aNewItem.SetVisibility(true);
		if (aSpatialArrow != null)
			aNewItem.itsRepresentationArrowInstanceTransform = aSpatialArrow.transform;
		aNewItem.itsCachedRepresentationSize = GetGameObjectSize(aSpatialNewMapIcon);
		itsListMapIcons.Add(aNewItem);
		itsListMapIcons.Sort(CompareMapIcons);
		
		aNewItem.UpdateIcon();
		UpdateIconScale();
		
		LogInfo(string.Format("Added icon of category '{0}' for '{1}'",theMapIcon.GetCategory(),theMapIcon.GetTransform().name),name,this);
	}
Ejemplo n.º 5
0
	/// <summary>
	/// set foreground or background rendering of icons (if they should disappear behind fog of war or not)
	/// </summary>
	/// <param name="anIcon"></param>
	void UpdateIconLayer(KGFIMapIcon theMapIcon)
	{
		GameObject aSpatialNewMapIcon = theMapIcon.GetRepresentation();
		MeshRenderer []aListRepRenderer = aSpatialNewMapIcon.GetComponentsInChildren<MeshRenderer>();
		CleanClickIconsList();
		foreach (MeshRenderer aRepRenderer in aListRepRenderer)
		{
			if (itsDataModuleMinimap.itsFogOfWar.itsHideMapIcons && !itsListClickIcons.Contains(theMapIcon))
			{
				aRepRenderer.sharedMaterial.renderQueue = 3000;
			}else
			{
				aRepRenderer.sharedMaterial.renderQueue = 3200;
			}
		}
	}
Ejemplo n.º 6
0
	/// <summary>
	/// Update the map icon (color, texture)
	/// </summary>
	/// <param name="theIcon"></param>
	public void UpdateIcon(KGFIMapIcon theIcon)
	{
		foreach (mapicon_listitem_script anItem in itsListMapIcons)
		{
			if (anItem.itsMapIcon == theIcon)
			{
				anItem.UpdateIcon();
			}
		}
	}