コード例 #1
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        switch (mapState)
        {
        case 1:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek algorithm";
            }
            steering = ai.Seek();
            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flee algorithm!";
            }
            steering = ai.Flee();
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Pursue algorithm!";
            }
            steering = ai.PursueWithDynamicArrive();
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Evade algorithm";
            }
            steering         = ai.Evade();
            steering.angular = ai.FaceAway().angular;
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Face algorithm";
            }
            steering = ai.Face();
            break;

        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Align algorithm";
            }
            steering = ai.Align();
            break;

        case 7:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Wander algorithm";
            }
            steering = ai.Wander();
            break;

        case 8:     // Static case
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nStatic NPC";
            }
            steering.linear  = Vector3.zero;
            steering.angular = 0;
            orientation      = 2f;
            break;

        case 9:     // Moves NPC towards left corner
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nMoving towards Left Corner";
            }
            steering.linear  = 2 * Vector3.forward + 3 * Vector3.left;
            steering.angular = 0f;
            break;
        }
        linear  = steering.linear;
        angular = steering.angular;

        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #2
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        if (this.gameObject.tag == "Red" && seekMousePos == true)
        {
            Vector3 MousePos = Input.mousePosition;
            MousePos.z = 30.0f;
            GameObject cameraRef = GameObject.FindGameObjectWithTag("MainCamera");
            Camera     cam       = cameraRef.GetComponent <Camera>();
            Vector3    targetPos = cam.ScreenToWorldPoint(MousePos);
            linear     = ai.Seek(targetPos);
            angular    = ai.Align(targetPos);
            this.phase = -1;
        }

        switch (phase)
        {
        case 0:
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nfollow the mouse pos";
            }
            break;

        case 1:
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flocking Algorithm";
            }
            linear = ai.Flocking().linear *flockingMixRate;
            Debug.Log(linear);
            angular  = ai.Flocking().angular *flockingMixRate;
            linear  += ai.DynamicPursue();
            angular += ai.face();
            DrawCircle(this.position + linear, 0.75f);

            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Part 3 algorithm";
            }
            ai.partThree          = true;
            ai.startPathFollowing = true;
            ai.partTwo            = false;

            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Third algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Fourth algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Fifth algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;
        }
        update(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #3
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        switch (mapState)
        {
        case 0:
            linear = ai.Seek();
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek algorithm";
            }
            break;

        case 1:
            linear = ai.Flee();
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flee algorithm";
            }
            // linear = ai.Pursue();   // For example
            // angular = ai.Face();    // For example

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 2:
            linear = ai.Arrive();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Arrive algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 3:
            linear = ai.Persue();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Pursue algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 4:
            linear = ai.Evade();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Evade algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 5:
            angular = ai.Align();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Align algorithm";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 6:
            linear  = ai.Arrive();
            angular = ai.Align();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Align and Arrive";
            }
            break;

        case 7:
            angular = ai.Face();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Face";
            }
            break;

        case 8:
            angular = ai.Face();
            linear  = ai.Arrive();
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Face and Arrive";
            }
            break;

        // ADD CASES AS NEEDED
        case 20:
            return;
        }
        UpdateMovement(linear, angular, Time.deltaTime);
        DrawCircle(linear, 1);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #4
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            mapState = 13;
        }

        switch (mapState)
        {
        case 0:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAt Rest";
            }
            stopped = true;
            linear  = Vector3.zero;
            angular = 0;
            break;

        case 1:
            //dynamic seek
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Seek with Obstacle Avoidance";
            }

            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            DrawLine(gameObject.transform.position, target.gameObject.transform.position);
            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Flee with Obstacle Avoidance";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleFlee().linear;
            angular = ai.Face().angular;
            DrawLine(gameObject.transform.position, target.gameObject.transform.position);
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nPursue with Arrive with Obstacle Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nEvade with Obstacle Avoidance";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleFlee().linear;
            angular = ai.Face().angular;
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Align";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Align().angular;
            break;

        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Face";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            break;

        case 7:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Wander";
            }
            stopped = false;
            ai.SetTarget(target);
            SteeringOutput s = ai.ObstacleWander();
            linear  = s.linear;
            angular = s.angular;

            break;

        case 8:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek with Collision Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.CollisionAvoidance().linear;
            angular = ai.Face().angular;
            break;

        case 9:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Path Follow";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.PathFollow().linear;
            angular = ai.Face().angular;
            break;

        case 10:
            break;

        case 11:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek with Collision Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.CollisionAvoidance().linear;
            angular = ai.Face().angular;
            break;

        case 12:
            ai.SetTarget(target);
            //Vector3 separationVector = ai.Separate().linear * weightSeparate;
            //Vector3 alignVector = ai.PursueArrive().linear * weightAlign;
            //Vector3 cohesionVector = ai.Cohesion().linear * weightCohesion;
            //linear = separationVector + alignVector + cohesionVector;
            linear  = ai.FlockBehavior(weightSeparate, weightAlign, weightCohesion).linear;
            angular = ai.Face().angular;

            /*
             * Vector3 rotateDirection = new Vector3(linear.x, 0, linear.z);
             *
             * // Rotate
             * if (rotateDirection.magnitude > 0)
             * {
             *  targetRotation = Quaternion.LookRotation(rotateDirection);
             *  Debug.DrawLine(transform.position, rotateDirection, Color.cyan);
             *  this.transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 180f * Time.deltaTime);
             *  //Debug.Log("Rotating");
             * }
             * else
             * {
             *  //Debug.Log("Nothing");
             * }
             */
            break;

        case 13:

            linear  = ai.Flock().linear;
            angular = ai.Face().angular;
            break;
        }
        if (mapState == 10)
        {
            return;
        }


        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #5
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        //SteeringOutput steering;
        switch (mapState)
        {
        case 1:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek algorithm";
            }

            steering = ai.Seek();


            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flee algorithm!";
            }

            steering = ai.Flee();
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Pursue algorithm!";
            }

            steering = ai.Pursue();
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Evade algorithm";
            }

            steering = ai.Evade();
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Face algorithm";
            }

            steering = ai.Face();
            break;

        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Align algorithm";
            }

            steering = ai.Align();
            break;

        case 7:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Wander algorithm";
            }

            steering = ai.Wander();
            break;
        }

        linear  = steering.linear;
        angular = steering.angular;

        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #6
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        //mapState = ai.GetComponent<SteeringBehavior>().aiAlgo;
        //print("Map state is: " + mapState);

        //clear the previous line drawn
        this.DestroyPoints();
        if (this.tag == "Debugger")
        {
            mapState = -1;
        }

        switch (mapState)
        {
        case -1:
            break;

        case 0:
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek";
            }
            //print("Seeking...");
            linear  = ai.Seek();
            angular = 0;

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 1:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flee";
            }

            linear  = ai.Flee();
            angular = 0;
            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Pursue";
            }

            linear  = ai.DynamicPursue();
            angular = 0;
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Evade";
            }

            linear  = ai.DynamicEvade();
            angular = 0;
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Align";
            }

            linear  = Vector3.zero;
            angular = ai.Align(ai.GetComponent <SteeringBehavior>().target.position);
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Face";
            }

            linear  = Vector3.zero;
            angular = ai.Align(ai.GetComponent <SteeringBehavior>().target.position);
            break;

        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Wander";
            }

            linear  = ai.Wander().linear;
            angular = ai.Wander().angular;
            break;

            // ADD CASES AS NEEDED
        }
        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
        //draw the new lines after changing the position
    }
コード例 #7
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        switch (mapState)
        {
        case 0:
            label.text = "";
            break;

        case 1:

            if (ai.GetComponent <SteeringBehavior>().tag == "Hunter")
            {
                linear     = ai.Seek();
                angular    = ai.Face();
                label.text = "1: dynamic seek + face";
            }
            else
            {
                label.text = "";
            }

            break;

        case 2:

            if (ai.GetComponent <SteeringBehavior>().tag == "Wolf")
            {
                linear     = ai.Flee();
                angular    = ai.FaceAway();
                label.text = "2:dynamic flee + faceaway";
            }
            else
            {
                label.text = "";
            }
            break;

        case 3:
            if (label)
            {
                label.text = "3: dynamic face ";
            }

            angular = ai.Face();

            break;

        case 4:

            if (ai.tag == "Hunter")
            {
                label.text = "4: dynamic wander";
                angular    = ai.Wander();
                linear     = ai.maxSpeed * new Vector3(Mathf.Sin(ai.GetComponent <NPCController>().orientation), 0, Mathf.Cos(ai.GetComponent <NPCController>().orientation));
            }
            else
            {
                label.text = "";
            }

            //linear = ai.Seek(); //--replace with the desired calls
            //angular = ai.Wander(out linear);
            break;

        case 5:

            if (ai.tag == "Hunter")
            {
                linear     = ai.Seek();
                angular    = ai.Face();
                label.text = "5:dynamic seek + face";
            }
            if (ai.tag == "Wolf")
            {
                linear     = ai.Flee();
                angular    = ai.FaceAway();
                label.text = "6:dynamic flee + faceaway";
            }
            break;

        case 6:

            if (ai.tag == "Hunter")
            {
                label.text = "6: dynamic arrive + face";
                linear     = ai.Arrive();
                angular    = ai.Face();
            }
            if (ai.tag == "Wolf")
            {
                label.text = "6:dynamic flee + faceaway";
                linear     = ai.Flee();
                angular    = ai.FaceAway();
            }
            break;

        case 7:


            if (ai.tag == "Hunter")
            {
                label.text = "7: dynamic pursue + arrive";
                Vector3 linear1 = ai.Arrive();

                Vector3 linear2 = ai.Pursue();
                if (linear1 != Vector3.zero)
                {
                    linear = linear1 + linear2;
                }
                else
                {
                    linear = linear1;
                }

                angular = ai.Face();
            }
            if (ai.tag == "Wolf")
            {
                label.text = "7: dynamic wander";
                angular    = ai.Wander();
                linear     = linear = ai.maxSpeed * new Vector3(Mathf.Sin(ai.GetComponent <NPCController>().orientation), 0, Mathf.Cos(ai.GetComponent <NPCController>().orientation));
                //linear = ai.Flee();
                //linear = ai.Evade();
            }
            break;

        case 8:


            if (ai.tag == "Hunter")
            {
                label.text = "8: dynamic pursue + face";
                linear     = ai.Pursue();
                angular    = ai.Face();
            }
            if (ai.tag == "Wolf")
            {
                label.text = "8: dynamic evade + faceaway";
                linear     = ai.Evade();
                angular    = ai.FaceAway();
            }
            break;

        case 9:


            if (ai.tag == "Hunter")
            {
                label.text = "9: dynamic align + pursue";
                linear     = ai.Pursue();
                angular    = ai.Align();
            }
            if (ai.tag == "Wolf")
            {
                label.text = "9: dynamic wander";
                angular    = ai.Wander();
                linear     = ai.maxSpeed * new Vector3(Mathf.Sin(ai.GetComponent <NPCController>().orientation), 0, Mathf.Cos(ai.GetComponent <NPCController>().orientation));
            }
            break;
            // ADD CASES AS NEEDED
        }
        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #8
0
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    /// jessie and patrick
    void FixedUpdate()
    {
        switch (mapState)
        {
        case 0:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nWandering...";
            }
            linear = ai.Wander(out angular);
            DrawCircle(ai.wanderCircleCenter, ai.wanderRadius);
            break;

        case 1:
            if (label)
            {
                // replace "First algorithm" with the name of the actual algorithm you're demoing
                // do this for each phase
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: dynamic evade algorithm";
            }
            linear = ai.Evade();
            // linear = ai.Pursue();   // For example
            // angular = ai.Face();    // For example

            // linear = ai.whatever();  -- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Pursue algorithm";
            }

            linear  = ai.Pursue();
            angular = ai.Face();
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: dyanamic Seek";
            }

            linear  = ai.Seek();
            angular = ai.Face();
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Flee algorithm";
            }

            linear = ai.Flee();      //-- replace with the desired calls
            // angular = ai.whatever();
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Spinning";
            }

            // linear = ai.whatever();  -- replace with the desired calls
            angular = 0.1f;
            break;

        // ADD CASES AS NEEDED
        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: dynamic align";
            }
            angular = ai.Align();
            break;

        case 7:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: dynamic arrive";
            }
            linear = ai.Arrive();
            DrawConcentricCircle(ai.slowRadiusL);
            break;

        case 8:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: dynamic face";
            }
            angular = ai.Face();
            break;
        }
        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }
コード例 #9
0
ファイル: NPCController.cs プロジェクト: Frombs28/Game-AI-2
    /// <summary>
    /// Depending on the phase the demo is in, have the agent do the appropriate steering.
    ///
    /// </summary>
    void FixedUpdate()
    {
        switch (mapState)
        {
        case 0:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAt Rest";
            }
            stopped = true;
            linear  = Vector3.zero;
            angular = 0;
            break;

        case 1:
            //dynamic seek
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Seek with Obstacle Avoidance";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            DrawLine(gameObject.transform.position, target.gameObject.transform.position);
            break;

        case 2:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Flee with Obstacle Avoidance";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleFlee().linear;
            angular = ai.Face().angular;
            DrawLine(gameObject.transform.position, target.gameObject.transform.position);
            break;

        case 3:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nPursue with Arrive with Obstacle Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            break;

        case 4:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nEvade with Obstacle Avoidance";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleFlee().linear;
            angular = ai.Face().angular;
            break;

        case 5:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Align";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Align().angular;
            break;

        case 6:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Face";
            }
            stopped = false;
            ai.SetTarget(target);
            linear  = ai.ObstacleSeek().linear;
            angular = ai.Face().angular;
            break;

        case 7:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Dynamic Wander";
            }
            stopped = false;
            ai.SetTarget(target);
            SteeringOutput s = ai.ObstacleWander();
            linear  = s.linear;
            angular = s.angular;

            break;

        case 8:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek with Collision Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.CollisionAvoidance().linear;
            angular = ai.Face().angular;
            break;

        case 9:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Path Follow";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.PathFollow().linear;
            angular = ai.Face().angular;
            break;

        case 10:
            break;

        case 11:
            if (label)
            {
                label.text = name.Replace("(Clone)", "") + "\nAlgorithm: Seek with Collision Avoidance";
            }
            stopped = false;
            //rotation = ai.Face(rotation, linear);
            ai.SetTarget(target);
            linear  = ai.CollisionAvoidance().linear;
            angular = ai.Face().angular;
            break;
        }
        if (mapState == 10)
        {
            return;
        }


        UpdateMovement(linear, angular, Time.deltaTime);
        if (label)
        {
            label.transform.position = Camera.main.WorldToScreenPoint(this.transform.position);
        }
    }