using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Passer {

    /// <summary>
    /// Possessions can be owned by an Humanoid
    /// </summary>
    /// 
    /// \image html PossessionInspector.png
    /// 
    /// * %Possession type, see Possession::possessionType
	/// * %Cross site allowed, see Possession::crossSite
	/// * %Is unique, see Possession::isUnique
    /// 
    /// \version 4
    public class Possessable : MonoBehaviour {

        /// <summary>
        /// The possession type
        /// </summary>
        public enum Type {
            Generic, ///< A generic Possession
            Avatar, ///< An avatar can be worn by a Humanoid
        }
        /// <summary>
        /// The Type of Possession
        /// </summary>
        public Type possessionType;

        /// <summary>
        /// If true, this Posession can be taken to other Sites.
        /// </summary>
        /// Non cross site possessions will be removed from the Humanoid's possessions
        /// when they leave the site.
        public bool crossSite = true;

        /// <summary>
        /// An unique Possession can be possessed only once.
        /// </summary>
        public bool isUnique = false;

        public string siteLocation {
            get {
                if (SiteNavigator.currentSite == null)
                    return "";

                string siteLocation = SiteNavigator.currentSite.siteLocation;
                siteLocation = siteLocation.Substring(0, siteLocation.LastIndexOf("/"));
                return (siteLocation + "/possessions");
            }
        }

        public string assetPath;
    }
}