Ejemplo n.º 1
0
 public void SetSpawner(Spawner2 spawner )
 {
     current_node = spawner.startNode;
     agent.Warp (spawner.startNode.real_transform.position);
     agent.ResetPath ();
     agent.SetDestination (spawner.startNode.real_transform.position);
 }
Ejemplo n.º 2
0
    public override void Activate()
    {
        base.Activate ();

        tracked_enemy = null;
        current_node = null;
        id = global_id_counter ++;
        parameters.hp_current = parameters.hp_max;
    }
Ejemplo n.º 3
0
 public override void Activate()
 {
     base.Activate ();
     tracked_enemy = null;
     current_node = null;
     enemy_range_penalty_factor = 0;
     squad = null;
     id = global_id_counter ++;
     parameters.hp_current = parameters.hp_max;
 }
Ejemplo n.º 4
0
 public void MoveToNextNode()
 {
     var available_nodes = current_node [side];
     if (available_nodes.Length > 0) {
         current_node = available_nodes [game_controller.mutationTables [id % game_controller.mutationTables.Length] % available_nodes.Length];
         agent.SetDestination(current_node.real_transform.position);
     } else {
         current_node = null;
         agent.Stop();
     }
 }
Ejemplo n.º 5
0
        public void TwoNodesOfDifferenceTypeWithTheSameIdShouldNotBeEqual()
        {
            // arrange
            var node1 = new Node1("node1");
            var node2 = new Node2("node1");

            // act
            var equal = EqualityComparer<Node>.Default.Equals(node1, node2);

            // Assert
            Assert.That(equal, Is.False, "Nodes are equal");
        }
Ejemplo n.º 6
0
        public TestTreeData()
        {
            Tree = new Tree <string>();

            Node1 = Tree.AddChild("node1");
            Node2 = Tree.AddChild("node2");
            Node3 = Tree.AddChild("node3");

            Node11 = Node1.AddChild("node11");

            Node21 = Node2.AddChild("node21");
            Node22 = Node2.AddChild("node22");

            Node211 = Node21.AddChild("node211");
        }
Ejemplo n.º 7
0
Archivo: Grid2.cs Proyecto: Flint270/A-
    void CreateGrid()
    {
        grid = new Node2[gridSizeX, gridSizeY];
        Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.up * gridWorldSize.y / 2;

        for (int x = 0; x < gridSizeX; x++)
        {
            for (int y = 0; y < gridSizeY; y++)
            {
                Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
                bool    walkable   = !(Physics.CheckSphere(worldPoint, nodeRadius, unwalkableMask));
                grid[x, y] = new Node2(walkable, worldPoint);
            }
        }
    }
    public void AddBannerToXml(string tempPath, string ImageName2, string ImageCoupon, string PageName, string PageId, string UserId, string virtualpathmobile, string BannerId)
    {
        XmlDocument xmldoc   = new XmlDocument();
        string      homepath = Session["HomePath"].ToString();

        xmldoc.Load(Session["HomePath"].ToString() + BannerOrder.BannerXml);
        //Create a new node
        XmlNodeList Node;

        Node = xmldoc.GetElementsByTagName("bannerName");
        XmlElement banners           = xmldoc.CreateElement("banners");
        XmlElement banner            = xmldoc.CreateElement("banner");
        XmlElement name              = xmldoc.CreateElement("name");
        XmlElement body              = xmldoc.CreateElement("body");
        XmlElement imagePath         = xmldoc.CreateElement("imagePath");
        XmlElement link              = xmldoc.CreateElement("link");
        XmlElement PageNames         = xmldoc.CreateElement("PageNames");
        XmlElement virtualmobilepath = xmldoc.CreateElement("virtualmobilepath1");
        XmlElement BannerId1         = xmldoc.CreateElement("BannerId");

        name.InnerText              = "New";
        body.InnerText              = "Lorem Ipsum";
        imagePath.InnerText         = "../StoreData/BannerNew/" + ImageName2;
        link.InnerText              = Session["HomePath"] + "PrintCoupon1.aspx?CouponID=" + ImageCoupon + "&PageName=" + PageName + "&PageId=" + PageId + "&UserId=" + UserId;
        PageNames.InnerText         = PageName;
        virtualmobilepath.InnerText = "../StoreData/MobileBannerNew/" + ImageName2;
        BannerId1.InnerText         = BannerId;

        banner.AppendChild(name);
        banner.AppendChild(body);
        banner.AppendChild(imagePath);
        banner.AppendChild(link);
        banner.AppendChild(PageNames);
        banner.AppendChild(virtualmobilepath);
        banner.AppendChild(BannerId1);
        int tempNodeId1 = 0;

        tempNodeId1 = GetPagesNode(Convert.ToInt32(PageId), Convert.ToInt32(UserId));
        XmlNodeList Node1;

        Node1 = xmldoc.GetElementsByTagName("banners");
        Node1.Item(tempNodeId1).AppendChild(banner);       // Important Count
        XmlNodeList Node2;

        Node2 = xmldoc.GetElementsByTagName("bannerName");
        Node2.Item(tempNodeId1).FirstChild.InnerText = Node1.Item(tempNodeId1).ChildNodes.Count.ToString();
        xmldoc.Save(ContentManager.GetPhysicalPath(Session["HomePath"].ToString() + BannerOrder.BannerXml));
    }
Ejemplo n.º 9
0
    public int MaxDepth(Node2 root)
    {
        if (root == null)
        {
            return(0);
        }

        int nMax = 0;

        foreach (Node2 n in root.children)
        {
            nMax = Math.Max(nMax, MaxDepth(n));
        }

        return(nMax + 1);
    }
Ejemplo n.º 10
0
        //RemoveLast: Removes the Tail Node

        public void RemoveTail()
        {
            var size    = SizeOf();
            var current = _head;

            while (current != _tail && current != null)
            {
                if (current.Next == _tail)
                {
                    _tail      = current;
                    _tail.Next = null;
                }

                current = current.Next;
            }
        }
Ejemplo n.º 11
0
        private void ReadNode(Node2 node, List <int> myList)
        {
            var numChildNodes = Pop(myList);
            var numMetaDatas  = Pop(myList);

            for (var nodeIndex = 0; nodeIndex < numChildNodes; nodeIndex++)
            {
                var childNode = new Node2();
                ReadNode(childNode, myList);
                node.ChildNodes.Add(childNode);
            }
            for (var nodeIndex = 0; nodeIndex < numMetaDatas; nodeIndex++)
            {
                node.MetaData.Add(Pop(myList));
            }
        }
Ejemplo n.º 12
0
        public TriangleBVHItem RayIntersect(ref Ray ray, ref float hitdist)
        {
            if (ray.Intersects(Box) == false)
            {
                return(null);
            }

            TriangleBVHItem hit = null;

            if (Triangles != null)
            {
                for (int i = 0; i < Triangles.Length; i++)
                {
                    var tri = Triangles[i];
                    var v1  = tri.Corner1;
                    var v2  = tri.Corner2;
                    var v3  = tri.Corner3;
                    if (ray.Intersects(ref v1, ref v2, ref v3, out float d) && (d < hitdist) && (d > 0))
                    {
                        hitdist = d;
                        hit     = tri;
                    }
                }
            }
            if (Node1 != null)
            {
                var hd = hitdist;
                var h  = Node1.RayIntersect(ref ray, ref hd);
                if ((h != null) && (hd < hitdist))
                {
                    hitdist = hd;
                    hit     = h;
                }
            }
            if (Node2 != null)
            {
                var hd = hitdist;
                var h  = Node2.RayIntersect(ref ray, ref hd);
                if ((h != null) && (hd < hitdist))
                {
                    hitdist = hd;
                    hit     = h;
                }
            }

            return(hit);
        }
 /// <summary>
 /// Sección del texto donde se resuelven operaciones matemáticas
 /// </summary>
 void GetBegin()
 {
     ///Pregunta si el token actual es igual a begin
     if (tokenList[index].tokenType.Equals(TokenType.BEGIN))
     {
         Node2 Begin = new Node2(tokenList[index]); ///Crea un nodo begin
         Begin.name = tokenList[index].lexeme;      //El nodo begin tiene el valor al elemento actual
         first.AddNode(Begin);                      ///Añade el nodo al primer elemento del árbol
         Assign();
         PrintVars();
         Debug.Log("You've arrived to the operations zone");
     }
     else
     {
         error += "Missing Begin Section!\n";
     }
 }
Ejemplo n.º 14
0
    private List <Node2> NearRecursive(Node2 node, Node2 x_new, List <Node2> near, float minDistance)
    {
        Vector3 pos      = x_new.pos;
        float   xDist    = pos[0] - node.pos[0];
        float   zDist    = pos[2] - node.pos[2];
        float   distance = Mathf.Sqrt(Mathf.Pow(xDist, 2) + Mathf.Pow(zDist, 2));

        if ((distance < minDistance) && (x_new != node) && (x_new.parent != node))
        {
            near.Add(node);
        }
        foreach (Node2 childNode in node.children)
        {
            near = NearRecursive(childNode, x_new, near, minDistance);
        }
        return(near);
    }
Ejemplo n.º 15
0
        private bool Triangulate()
        {
            FaceExList dynamics = new FaceExList(this.m_nodes.Count);

            this.m_faces.Clear();
            this.m_faces.Capacity = this.m_nodes.Count * 2;
            bool flag;

            if (this.m_nodes == null)
            {
                flag = false;
            }
            else if (this.m_nodes.Count < 3)
            {
                flag = false;
            }
            else
            {
                this.CreateSuperBox(dynamics);
                List <FaceEx> F    = new List <FaceEx>();
                int           num1 = this.get_SuperBoxIndex(1) + 1;
                int           num2 = this.get_SuperBoxIndex(2) - 1;
                for (int C = num1; C <= num2; ++C)
                {
                    Node2 node = this.m_nodes[C];
                    dynamics.MigrateStaticFaces(this.m_faces, node.x);
                    F.Clear();
                    if (dynamics.CullFaces(node.x, node.y, F) != 0)
                    {
                        EdgeList edgeList = new EdgeList(F);
                        edgeList.TrimHighValenceEdges();
                        int num3 = edgeList.Count - 1;
                        for (int index = 0; index <= num3; ++index)
                        {
                            dynamics.AddFace(edgeList[index].A, edgeList[index].B, C, this.m_nodes);
                        }
                    }
                }
                dynamics.MigrateRemainingFaces(this.m_faces);
                this.DestroySuperBox();
                this.SolveStaticOrientation();
                flag = true;
            }
            return(flag);
        }
Ejemplo n.º 16
0
        public void Construction2()
        {
            // Arrange
            var graph = new Graph <Node2, Edge2>();

            // Act
            Node2 node1, node2;

            graph.Add(node1 = new Node2());
            graph.Add(node2 = new Node2());
            Edge2 edge;

            graph.Add(edge = new Edge2(node1, node2, 1));

            // Assert
            edge.MyEdgeProp.ShouldBe(1);
            edge.Reverse.MyEdgeProp.ShouldBe(-1);
        }
Ejemplo n.º 17
0
Archivo: Grid2.cs Proyecto: Flint270/A-
    void OnDrawGizmos()
    {
        Gizmos.DrawWireCube(transform.position, new Vector3(gridWorldSize.x, gridWorldSize.y));

        if (grid != null)
        {
            Node2 playerNode = NodeFromWorldPoint(player.position);
            foreach (Node2 n in grid)
            {
                Gizmos.color = (n.walkable) ? Color.white : Color.red;
                if (playerNode == n)
                {
                    Gizmos.color = Color.black;
                }
                Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter - .1f));
            }
        }
    }
Ejemplo n.º 18
0
        /// <summary>
        /// function to add the value to the D-LL at the end
        /// </summary>
        /// <param name="value"></param>
        public void Add(int value)
        {
            Node2 <int> node = new Node2 <int>(value);

            //case-1:list is empty, then initilize the head and tail
            if (head == null)
            {
                head = node;
                tail = node;
            }
            //case-2:list has atleast 1 ele, then append to the end
            else
            {
                node.Previous = tail; //init the back ref
                tail.Next     = node;
                tail          = node;
            }
        }
Ejemplo n.º 19
0
        //add in the last
        public Node2 AddLast(int data)
        {
            Node2 newNode = new Node2(data);

            if (head == null)
            {
                return(head = newNode);
            }
            else
            {
                Node2 n = head;
                while (n.next != null)
                {
                    n = n.next;
                }
                return(n.next = newNode);
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// function to search a value in the D-LL
        /// </summary>
        /// <param name="value">value to search</param>
        /// <returns>result</returns>
        public bool Search(int value)
        {
            Node2 <int> temp = head;

            ////traverse throught the list till the item is found or end is reached
            while (temp != null && temp.Value != value)
            {
                temp = temp.Next;
            }

            //check if the entire list is traversed
            if (temp == null)
            {
                return(false);
            }

            return(true);
        }
    public IList <IList <int> > LevelOrder(Node2 root)
    {
        IList <IList <int> > result = new List <IList <int> >();

        if (root == null)
        {
            return(result);
        }

        result.Add(new List <int>());
        result[0].Add(root.val);

        foreach (Node2 n in root.children)
        {
            LevelOrderLevel(n, 1, result);
        }

        return(result);
    }
Ejemplo n.º 22
0
 private void BuildResult(Node2 node, ref string result)
 {
     if (node.Master.Any())
     {
         var nodes = node.Master.OrderByDescending(x => x.Letter);
         //result += string.Join("", nodes.Select(x => x.Letter));
         foreach (var m in nodes)
         {
             if (result.IndexOf(m.Letter) == -1)
             {
                 result += m.Letter;
             }
         }
         foreach (var m in nodes)
         {
             BuildResult(m, ref result);
         }
     }
 }
    private void LevelOrderLevel(Node2 root, int level, IList <IList <int> > result)
    {
        if (root == null)
        {
            return;
        }

        if (level >= result.Count)
        {
            result.Add(new List <int>());
        }

        result[level].Add(root.val);

        foreach (Node2 n in root.children)
        {
            LevelOrderLevel(n, level + 1, result);
        }
    }
Ejemplo n.º 24
0
        public long SolveA(string input)
        {
            // 2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2
            // A-----------------------------m-m-m
            //     B----m--m--m C----------m
            //                      D----m

            // I don't know what part 2 is, but I can assume it's some tree-traversal thing.
            // So don't do the easy algorithm where we just walk through and add numbers.
            // Let's actually build the tree.

            var myList     = Parser.Tokenize(input, ' ').Select(x => int.Parse(x)).ToList();
            var parentNode = new Node2();

            ReadNode(parentNode, myList);

            // Now, traverse, and get the total.
            return(parentNode.GetMetaDataSum());
        }
Ejemplo n.º 25
0
        public static void Part2()
        {
            //The bridge you've built isn't long enough; you can't jump the rest of the way.
            //In the example above, there are two longest bridges:
            // 0 / 2--2 / 2--2 / 3--3 / 4
            // 0 / 2--2 / 2--2 / 3--3 / 5
            //Of them, the one which uses the 3 / 5 component is stronger; its strength is 0 + 2 + 2 + 2 + 2 + 3
            // + 3 + 5 = 19.
            //What is the strength of the longest bridge you can make? If you can make multiple bridges of the
            //longest length, pick the strongest one.

            IList <Node2> components         = new List <Node2>();
            int           maxStrengthLongest = 0;
            int           longestBridge      = 0;

            string line;

            using (StringReader reader = new StringReader(Input))
            {
                while ((line = reader.ReadLine()) != null)
                {
                    var component = line.Split('/').Select(p => int.Parse(p));
                    components.Add(new Node2 {
                        A = component.First(), B = component.Last()
                    });
                }
            }

            var roots = components.Where(c => c.A == 0 || c.B == 0);

            foreach (Node2 rootNode in roots)
            {
                Node2 root = new Node2
                {
                    A = rootNode.A == 0 ? rootNode.A : rootNode.B,
                    B = rootNode.A == 0 ? rootNode.B : rootNode.A,
                };
                root.AddChildren(ref components, ref maxStrengthLongest, ref longestBridge);
            }

            Debug.WriteLine("Max length: " + longestBridge);
            Debug.WriteLine("Max strength: " + maxStrengthLongest);
        }
Ejemplo n.º 26
0
        /// <summary>Make sure all triangles are oriented counter-clockwise</summary>
        private void SolveStaticOrientation()
        {
            int num = this.m_faces.Count - 1;

            for (int index = 0; index <= num; ++index)
            {
                int   a     = this.m_faces[index].A;
                int   b     = this.m_faces[index].B;
                int   c     = this.m_faces[index].C;
                Node2 node1 = this.m_nodes[a];
                Node2 node2 = this.m_nodes[b];
                Node2 node3 = this.m_nodes[c];
                if (Line2.Side(node1.x, node1.y, node2.x, node2.y, node3.x, node3.y) == Side2.Right)
                {
                    this.m_faces[index].B = c;
                    this.m_faces[index].C = b;
                }
            }
        }
Ejemplo n.º 27
0
        public override void Delete(bool onlyEdgeDeleted)
        {
            _Draw(new Pen(Color.White, Thickness + 1));

            base.Delete(onlyEdgeDeleted);

            // redraw the nodes
            Node1.Visualizer.Draw(Node1.GetState());
            Node2.Visualizer.Draw(Node2.GetState());

            Program.Presenter.EdgeHolder.RemoveEdge(this);
            Program.Presenter.EdgeHolder.RedrawAllEdges();
            Program.Presenter.NodeHolder.RedrawAllNodes();

            //if (Program.Presenter.cb_selfStab.Checked && onlyEdgeDeleted)
            //{
            //    Task.Run(() => Node1.UserDefined_SingleInitiatorProcedure(Node1));
            //    Task.Run(() => Node2.UserDefined_SingleInitiatorProcedure(Node2));
            //}
        }
Ejemplo n.º 28
0
        private Node2 NearestRecursive(Node2 node, Vector3 pos, Node2 x_nearest, float minDistance)
        {
            float xDist    = pos[0] - node.pos[0];
            float zDist    = pos[2] - node.pos[2];
            float distance = Mathf.Sqrt(Mathf.Pow(xDist, 2) + Mathf.Pow(zDist, 2));

            if (distance < minDistance)
            {
                x_nearest   = node;
                minDistance = distance;
            }
            foreach (Node2 childNode in node.children)
            {
                x_nearest   = NearestRecursive(childNode, pos, x_nearest, minDistance);
                xDist       = pos[0] - x_nearest.pos[0];
                zDist       = pos[2] - x_nearest.pos[2];
                minDistance = Mathf.Sqrt(Mathf.Pow(xDist, 2) + Mathf.Pow(zDist, 2));
            }
            return(x_nearest);
        }
Ejemplo n.º 29
0
        /* As banner rotating through flash so that we need add this information to the .XML file */
        public void AddBannerToXml(string tempPath, string ImageName2, string ImageCoupon, string PageName)
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(Session["HomePath"].ToString() + "banners_Cat.xml");
            //Create a new node
            XmlNodeList Node;

            Node = xmldoc.GetElementsByTagName("bannerName");
            XmlElement banners   = xmldoc.CreateElement("banners");
            XmlElement banner    = xmldoc.CreateElement("banner");
            XmlElement name      = xmldoc.CreateElement("name");
            XmlElement body      = xmldoc.CreateElement("body");
            XmlElement imagePath = xmldoc.CreateElement("imagePath");
            XmlElement link      = xmldoc.CreateElement("link");
            XmlElement PageNames = xmldoc.CreateElement("PageNames");

            name.InnerText      = "New";
            body.InnerText      = "Lorem Ipsum";
            imagePath.InnerText = "../StoreData/BannerNew/" + ImageName2;
            //link.InnerText = Session["HomePath"] + "PrintCoupon.aspx?CouponID=" + ImageCoupon + "&PageName=" + ddlPage.SelectedItem.Text;
            link.InnerText      = Session["HomePath"] + "PrintCoupon1.aspx?CouponID=" + ImageCoupon + "&PageName=" + ddlPage.SelectedItem.Text + "&PageId=" + Convert.ToInt32(ddlPage.SelectedValue) + "&UserId=" + Convert.ToInt32(ddlUserType.SelectedValue);
            PageNames.InnerText = PageName;
            banner.AppendChild(name);
            banner.AppendChild(body);
            banner.AppendChild(imagePath);
            banner.AppendChild(link);
            banner.AppendChild(PageNames);
            int tempNodeId1 = 0;

            tempNodeId1 = GetPagesNode();
            XmlNodeList Node1;

            Node1 = xmldoc.GetElementsByTagName("banners");
            Node1.Item(tempNodeId1).AppendChild(banner);   // Important Count
            XmlNodeList Node2;

            Node2 = xmldoc.GetElementsByTagName("bannerName");
            Node2.Item(tempNodeId1).FirstChild.InnerText = Node1.Item(tempNodeId1).ChildNodes.Count.ToString();
            xmldoc.Save(ContentManager.GetPhysicalPath(Session["HomePath"].ToString() + "banners_Cat.xml"));
        }
Ejemplo n.º 30
0
        public override string ToString()
        {
            string toString = "";

            if (Node1 != null)
            {
                toString += "Node1:" + Node1.ToString();
            }

            if (Node2 != null)
            {
                toString += "Node2:" + Node2.ToString();
            }

            if (Link != null)
            {
                toString += "Link:" + Link.ToString();
            }

            return(toString);
        }
Ejemplo n.º 31
0
 public void AddChildren(ref IList <Node2> components, ref int maxStrength, ref int maxLength)
 {
     foreach (Node2 component in components.Where(c => !InChain(c)))
     {
         if (component.A == B)
         {
             var node = new Node2 {
                 A = component.A, B = component.B, Parent = this
             };
             Children.Add(node);
             if (node.Length > maxLength)
             {
                 maxLength   = node.Length;
                 maxStrength = node.Strength;
             }
             if (node.Length == maxStrength && node.Strength > maxStrength)
             {
                 maxStrength = node.Length;
             }
             node.AddChildren(ref components, ref maxStrength, ref maxLength);
         }
         if (component.B == B)
         {
             var node = new Node2 {
                 A = component.B, B = component.A, Parent = this
             };
             Children.Add(node);
             if (node.Length > maxLength)
             {
                 maxLength   = node.Length;
                 maxStrength = node.Strength;
             }
             if (node.Length == maxStrength && node.Strength > maxStrength)
             {
                 maxStrength = node.Length;
             }
             node.AddChildren(ref components, ref maxStrength, ref maxLength);
         }
     }
 }
Ejemplo n.º 32
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append(Node1.GetValue());
            if (Directed)
            {
                sb.Append(" --> ");
            }
            else
            {
                sb.Append(" <--> ");
            }

            sb.Append(Node2.GetValue());
            if (Node1 is WeightedGraphNode <T> || Node2 is WeightedGraphNode <T> )
            {
                sb.Append(" (").Append(Weight).Append(')');
            }

            return(sb.ToString());
        }
Ejemplo n.º 33
0
    public Node2 ChooseNewNode()
    {
        Node2 node   = null;
        bool  found  = false;
        int   curPos = control.subnodes.IndexOf(control.currentNode);

        while (!found)
        {
            if (curPos == (control.subnodes.Count - 1))
            {
                found = true;
                node  = null;
                break;
            }
            curPos++;
            node = control.subnodes[curPos];
            if (node.CheckConditions())
            {
                found = true;
            }
        }
        return(node);
    }
Ejemplo n.º 34
0
    protected void Awake()
    {
        //Finds these scripts to allow use of their properties
        engine = GetComponent <Engine> ();
        node   = GetComponent <Node> ();
        node2  = GetComponent <Node2> ();

        // Sets up a new FSM
        carStateMachine = new FSM <CarStates>();
        // This adds in all the new states into the state machine using variables declared
        carStateMachine.AddState(new Idle <CarStates>(CarStates.Idle, this, 3.0f));
        carStateMachine.AddState(new Launch <CarStates>(CarStates.Launch, this, 0f));
        carStateMachine.AddState(new Drive <CarStates>(CarStates.Drive, this, 0f));
        carStateMachine.AddState(new Finish <CarStates>(CarStates.Finish, this, 0f));
        // Sets Idle as first state to be in once plays been activated
        carStateMachine.SetInitialState(CarStates.Idle);

        // These are all the transitions of the states I will require within this program
        carStateMachine.AddTransition(CarStates.Idle, CarStates.Launch);
        carStateMachine.AddTransition(CarStates.Launch, CarStates.Drive);
        carStateMachine.AddTransition(CarStates.Drive, CarStates.Finish);
        carStateMachine.AddTransition(CarStates.Finish, CarStates.Idle);
    }
Ejemplo n.º 35
0
        static Node2 insert2(Node2 head, int data)
        {
            Node2 p = new Node2(data);


            if (head == null)
            {
                head = p;
            }
            else if (head.next == null)
            {
                head.next = p;
            }
            else
            {
                Node2 start = head;
                while (start.next != null)
                {
                    start = start.next;
                }
                start.next = p;
            }
            return(head);
        }
Ejemplo n.º 36
0
 public void SetSpawner(Spawner2 spawner, Vector3 offset )
 {
     transform.position = spawner.transform.position + offset;
     current_node = spawner.startNode;
     SetDestination (spawner.startNode.real_transform.position);
 }