using UnityEngine;
using System.Collections;

public abstract class Process : MonoBehaviour {


    /// <summary>
    /// State the process is attached
    /// </summary>
    public StateMachine.STATE state;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}


    /// <summary>
    /// Set the process (in)active and allow to do stuff before or after
    /// </summary>
    /// <param name="active">True if need to active, false if need to disable.</param>
    /// <seealso cref="BeforeActivation"/>
    /// <seealso cref="BeforeInactivation"/>
    /// <seealso cref="AfterActivation"/>
    /// <seealso cref="AfterInactivation"/>
    /// 
    public void SetActive(bool active)
    {
    	if(active)
    		BeforeActivation();
    	else
    		BeforeInactivation();

       	gameObject.SetActive(active);

    	if(active)
    		AfterActivation();
    	else
    		AfterInactivation();
    }

    /// <summary>
    ///     Method called before a call of SetActive(true)
    /// </summary>
    /// <seealso cref="SetActive(bool)"/>
    public virtual void BeforeActivation()
    {

    }

    /// <summary>
    ///     Method called before a call of SetActive(false)
    /// </summary>
    /// <seealso cref="SetActive(bool)"/>
    public virtual void BeforeInactivation()
    {

    }

    /// <summary>
    ///     Method called after a call of SetActive(true)
    /// </summary>
    /// <seealso cref="SetActive(bool)"/>
    public virtual void AfterActivation()
    {

    }

    /// <summary>
    ///     Method called after a call of SetActive(false)
    /// </summary>
    /// <seealso cref="SetActive(bool)"/>
    public virtual void AfterInactivation()
    {

    }

    /// <summary>
    /// Custom initialization called by the StateMachine
    /// </summary>
    /// <seealso cref="StateMachine"/>
    public virtual void Init()
    {

    }
}
