OldEntityClass.GetBehaviorByType C# (CSharp) Method

GetBehaviorByType() private method

private GetBehaviorByType ( BehaviorType btype ) : Behavior,
btype BehaviorType
return Behavior,
    Behavior GetBehaviorByType(BehaviorType btype)
    {
        Behavior behavior = null;
        Behavior[] behaviors = GetComponents<Behavior> ();

        foreach (Behavior beh in behaviors)
        {
            if (beh.type == btype)
            {
                behavior = beh;
                break;
            }
        }

        return behavior;
    }