コード例 #1
0
	/// <summary>
	/// binds the event handler's activities to states with the
	/// same names found on components down the hierarchy
	/// </summary>
	protected void BindStateToActivity(vp_Activity a)
	{

		BindStateToActivityOnStart(a);
		BindStateToActivityOnStop(a);

	}
コード例 #2
0
	/// <summary>
	/// binds the event handler's start activity to states with
	/// the same names found on components down the hierarchy
	/// </summary>
	protected void BindStateToActivityOnStart(vp_Activity a)
	{

		if (!ActivityInitialized(a))
			return;

		string s = a.EventName;

		a.StartCallbacks +=
		delegate()
		{
			foreach (vp_Component c in m_StateTargets)
			{
				c.SetState(s, true, true);
			}
		};
		// NOTE: this delegate currently won't show up in an event dump

	}
コード例 #3
0
    /// <summary>
    /// binds the event handler's stop activity to states with
    /// the same names found on components down the hierarchy
    /// </summary>
    protected void BindStateToActivityOnStop(vp_Activity a)
    {
        if (!ActivityInitialized(a))
        {
            return;
        }

        string s = a.EventName;

        a.StopCallbacks +=
            delegate()
        {
            foreach (vp_Component c in m_StateTargets)
            {
                c.SetState(s, false, true);
            }
        };
        // NOTE: this delegate currently won't show up in an event dump
    }
コード例 #4
0
	/// <summary>
	/// returns true if the passed activity has been initialized
	/// yet, false if not
	/// </summary>
	private bool ActivityInitialized(vp_Activity a)
	{

		if (a == null)
		{
			Debug.LogError("Error: (" + this + ") Activity is null.");
			return false;
		}

		if (string.IsNullOrEmpty(a.EventName))
		{
			Debug.LogError("Error: (" + this + ") Activity not initialized. Make sure the event handler has run its Awake call before binding layers.");
			return false;
		}

		return true;

	}
コード例 #5
0
 /// <summary>
 /// binds the event handler's activities to states with the
 /// same names found on components down the hierarchy
 /// </summary>
 protected void BindStateToActivity(vp_Activity a)
 {
     BindStateToActivityOnStart(a);
     BindStateToActivityOnStop(a);
 }