public T AddBehaviour <T>() where T : ShapeBehaviour, new() { T behaviour = ShapeBehaviourPool <T> .Get(); behaviourList.Add(behaviour); return(behaviour); }
public static ShapeBehaviour GetInstance(this ShapeBehaviourType type) { switch (type) { case ShapeBehaviourType.Movement: return(ShapeBehaviourPool <MovementShapeBehaviour> .Get()); case ShapeBehaviourType.Rotation: return(ShapeBehaviourPool <RotationShapeBehaviour> .Get()); case ShapeBehaviourType.Oscillation: return(ShapeBehaviourPool <OscillationShapeBehaviour> .Get()); case ShapeBehaviourType.Satellite: return(ShapeBehaviourPool <SatelliteShapeBehaviour> .Get()); case ShapeBehaviourType.Growing: return(ShapeBehaviourPool <GrowingShapeBehaviour> .Get()); case ShapeBehaviourType.Lifecycle: return(ShapeBehaviourPool <LifecycleShapeBehaviour> .Get()); } Debug.LogError("Forgot to support " + type); return(null); }