Exemplo n.º 1
0
        /// <summary>
        /// Creates the animal's move behavior.
        /// </summary>
        /// <param name="type">The type of animal.</param>
        /// <returns>Returns the intended movement behavior.</returns>
        public static IMoveBehavior CreateMoveBehavior(MoveBehaviorType type)
        {
            IMoveBehavior animalMove = null;

            switch (type)
            {
            case MoveBehaviorType.Fly:
                animalMove = new FlyBehavior();
                break;

            case MoveBehaviorType.Pace:
                animalMove = new PaceBehavior();
                break;

            case MoveBehaviorType.Swim:
                animalMove = new SwimBehavior();
                break;

            case MoveBehaviorType.Climb:
                animalMove = new ClimbBehavior();
                break;

            case MoveBehaviorType.Hover:
                animalMove = new HoverBehavior();
                break;

            case MoveBehaviorType.NoMove:
                animalMove = new NoMoveBehavior();
                break;
            }

            return(animalMove);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create move behavior.
        /// </summary>
        /// <param name="type"> The type of move behavior.</param>
        /// <returns> A move behavior.</returns>
        public static IMoveBehavior CreateMoveBehavior(MoveBehaviorType type)
        {
            IMoveBehavior moveBehavior = null;

            // Depending on type, change behavior.
            switch (type)
            {
            case MoveBehaviorType.Fly:
                moveBehavior = new FlyBehavior();
                break;

            case MoveBehaviorType.Pace:
                moveBehavior = new PaceBehavior();
                break;

            case MoveBehaviorType.Swim:
                moveBehavior = new SwimBehavior();
                break;

            case MoveBehaviorType.NoMove:
                moveBehavior = new NoMoveBehavior();
                break;
            }
            return(moveBehavior);
        }
Exemplo n.º 3
0
        public static IMoveBehavior CreateMoveBehavior(MoveBehaviorType type)
        {
            IMoveBehavior result = null;

            switch (type)
            {
            case MoveBehaviorType.Fly:
                result = new FlyBehavior();
                break;

            case MoveBehaviorType.Pace:
                result = new PaceBehavior();
                break;

            case MoveBehaviorType.Swim:
                result = new SwimBehavior();
                break;

            case MoveBehaviorType.Climb:
                result = new ClimbBehavior();
                break;

            case MoveBehaviorType.Hover:
                result = new HoverBehavior();
                break;

            case MoveBehaviorType.Hop:
                result = new HopBehavior();
                break;

            case MoveBehaviorType.NoMove:
                result = new NoMoveBehavior();
                break;
            }

            return(result);
        }