示例#1
0
    AIStrategy GetOrCreateStrategyForAction(AIAction action)
    {
        var type = StrategyManager.GetStrategyTypeForAction(action);

        if (type == null)
        {
            print("No strategy for action: " + action.GetType().Name);
            return(null);
        }
        var comp = GetComponent(type);

        if (comp == null)
        {
            comp = gameObject.AddComponent(type);
        }
        return(comp as AIStrategy);
    }