public static ShapeBehavior GetInstance(this ShapeBehaviorType type) { switch (type) { case ShapeBehaviorType.Movement: return(ShapeBehaviorPool <MovementShapeBehavior> .Get()); case ShapeBehaviorType.Rotation: return(ShapeBehaviorPool <RotationShapeBehavior> .Get()); case ShapeBehaviorType.Oscillation: return(ShapeBehaviorPool <OscillationShapeBehavior> .Get()); case ShapeBehaviorType.Satellite: return(ShapeBehaviorPool <SatelliteShapeBehavior> .Get()); case ShapeBehaviorType.Growing: return(ShapeBehaviorPool <GrowingShapeBehavior> .Get()); case ShapeBehaviorType.Dying: return(ShapeBehaviorPool <DyingShapeBehavior> .Get()); } UnityEngine.Debug.Log("Forgot to suport " + type); return(null); }
public static ShapeBehavior GetInstance(this ShapeBehaviorType type) { switch (type) { case ShapeBehaviorType.Movement: return(ShapeBehaviorPool <MovementShapeBehavior> .Get()); case ShapeBehaviorType.Rotation: return(ShapeBehaviorPool <RotationShapeBehavior> .Get()); case ShapeBehaviorType.Oscillation: return(ShapeBehaviorPool <OscillationShapBehavior> .Get()); case ShapeBehaviorType.Satellite: return(ShapeBehaviorPool <SatelliteShapeBehavior> .Get()); case ShapeBehaviorType.Growing: return(ShapeBehaviorPool <GrowingShapeBehavior> .Get()); case ShapeBehaviorType.Dying: return(ShapeBehaviorPool <DyingShapeBehavior> .Get()); case ShapeBehaviorType.Lifecycle: return(ShapeBehaviorPool <LifecycleShapeBehavior> .Get()); } return(null); }
ShapeBehavior AddBehavior(ShapeBehaviorType type) { switch (type) { case ShapeBehaviorType.Movement: return(AddBehavior <MovementShapeBehavior>()); case ShapeBehaviorType.Rotation: return(AddBehavior <RotationShapeBehavior>()); } Debug.LogError("Forgot to suppory" + type); return(null); }
public static ShapeBehavior GetInstance(this ShapeBehaviorType type) { switch (type) { case ShapeBehaviorType.Movement: return(ShapeBehaviorPool <MovementShapeBehavior> .Get()); case ShapeBehaviorType.Rotation: return(ShapeBehaviorPool <RotationShapeBehavior> .Get()); case ShapeBehaviorType.Oscillation: return(ShapeBehaviorPool <OscillationShapBehavior> .Get()); } return(null); }
// "this" is added to turn it into an extension method public static ShapeBehavior GetInstance(this ShapeBehaviorType type) { // When loading shape behavior, read and enumeration value and then add the correct behavior component switch (type) { case ShapeBehaviorType.Movement: return(ShapeBehaviorPool <MovementShapeBehavior> .Get()); case ShapeBehaviorType.Rotation: return(ShapeBehaviorPool <RotationShapeBehavior> .Get()); case ShapeBehaviorType.Oscillation: return(ShapeBehaviorPool <OscillationShapeBehavior> .Get()); } UnityEngine.Debug.Log("Forgot to support " + type); return(null); }