Esempio n. 1
0
	/// <summary>
	/// Dynamically creates a new map icon on the KGFMapSystem.
	/// </summary>
	/// <remarks>
	/// Use this method to create a new map icon based on a KGFMapIcon template and world space coordinates.
	/// This method will instantiate the KGFMapIcon template passed as second parameter at the given world space position.
	/// </remarks>
	/// <example>
	/// How to create a new map icon dynamically at runtime
	/// <code>
	/// using UnityEngine;
	/// using System;
	/// 
	/// public class MyMinimapController : MonoBehaviour
	/// {
	/// 	private KGFMapSystem itsKGFMapSystem;	//reference to the map system
	///
	/// 	public KGFMapIcon itsKGFMapIconTemplate = null;	//template for creating new icons
	///
	/// 	public void Start()
	/// 	{
	/// 		itsKGFMapSystem = KGFAccessor.GetObject<KGFMapSystem>();	//get the KGFMapSystem by using the KGFAccessor class
	///
	/// 		if(itsKGFMapSystem != null && itsKGFMapIconTemplate)
	/// 		{
	/// 			itsKGFMapSystem.CreateIcon(new Vector3(0.0f,0.0f,0.0f),itsKGFMapIconTemplate);	//create new mapicon at positon zero.
	/// 		}
	/// 	}
	/// }
	/// </code>
	/// </example>
	/// <param name="theWorldPoint">Vector3: The world space coordinates where the new KGFMapIcon should be created</param>
	/// <param name="theMapIcon">KGFMapIcon: The KGFMapIcon that is used as a template for the new instance.</param>
	/// <returns>KGFMapIcon: The new instantiated KGFMapIcon</returns>
	public KGFMapIcon CreateIcon(Vector3 theWorldPoint,KGFMapIcon theMapIcon)
	{
		KGFMapIcon aNewIcon = CreateIconInternal(theWorldPoint,theMapIcon,itsContainerUser);
		itsListUserIcons.Add(aNewIcon);
		return aNewIcon;
	}
Esempio n. 2
0
	/// <summary>
	/// Removes a map icon that was dynamically created
	/// </summary>
	/// <remarks>
	/// Use this method to delete a KGFMapIcon that was created by the CreateIcon(Vector3 theWorldPoint,KGFMapIcon theMapIcon) method.
	/// </remarks>
	/// <example>
	/// How to delete a map icon at runtime
	/// <code>
	/// using UnityEngine;
	/// using System;
	/// 
	/// public class MyMinimapController : MonoBehaviour
	/// {
	/// 	private KGFMapSystem itsKGFMapSystem; // internal reference to the KGFMapSystem
	///
	/// 	public KGFMapIcon itsKGFMapIconTemplate = null; // template for creating the new icon
	///
	/// 	private KGFMapIcon itsNewKGFMapIcon = null; // The new KGFMapIcon instance
	///
	/// 	public void Start()
	/// 	{
	/// 		itsKGFMapSystem = KGFAccessor.GetObject<KGFMapSystem>();	//get the KGFMapSystem by using the KGFAccessor class
	///
	/// 		if(itsKGFMapSystem != null && itsKGFMapIconTemplate)
	/// 		{
	/// 			itsNewKGFMapIcon = itsKGFMapSystem.CreateIcon(new Vector3(0.0f,0.0f,0.0f),itsKGFMapIconTemplate);	//create new mapicon at positon zero.
	/// 		}
	/// 	}
	///
	/// 	public void Update()
	/// 	{
	/// 		if(Input.GetKeyDown(KeyCode.R))
	/// 		{
	/// 			if(itsKGFMapSystem != null && itsNewKGFMapIcon != null)
	/// 			{
	/// 				itsKGFMapSystem.RemoveIcon(itsNewKGFMapIcon);
	/// 			}
	///			}
	///		}
	/// }
	/// 
	/// </code>
	/// </example>
	/// <param name="theMapIcon">KGFMapIcon: The KGFMapIcon was created using the CreateIcon(Vector3 theWorldPoint,KGFMapIcon theMapIcon) method</param>
	public void RemoveIcon(KGFMapIcon theIcon)
	{
		if (itsListUserIcons.Contains(theIcon))
		{
			UnregisterMapIcon(theIcon);
			itsListUserIcons.Remove(theIcon);
		}
		else
		{
			LogError("Not a user created icon",name,this);
		}
	}
Esempio n. 3
0
	KGFMapIcon CreateIconInternal(Vector3 theWorldPoint,KGFMapIcon theIcon,Transform theParent)
	{
		GameObject aGameObject = (GameObject)GameObject.Instantiate(theIcon.gameObject);
		aGameObject.name = "Flag";
		aGameObject.transform.parent = itsContainerFlags;
		aGameObject.transform.position = theWorldPoint;
		return aGameObject.GetComponent<KGFMapIcon>();
	}
	public override void Reset ()
	{
		MapIcon = null;
		ToolTipText = "";
	}
	public override void Reset ()
	{
		MapIcon = null;
		ArrowUsage = true;
	}
	public override void Reset ()
	{
		MapIcon = null;
		IconColor = Color.white;
	}
	public override void Reset ()
	{
		MapIcon = null;
	}