Exemplo n.º 1
0
    public IEnumerator Move()
    {
        WaitForSeconds delay = new WaitForSeconds(delayBetweenMovements);

        while (true)
        {
            MazeCellEdge edge = currentCell.RandomPassage();
            yield return(delay);

            if (!edge.otherCell.zombieOnCell)
            {
                StartCoroutine(AnimateMovements(edge.direction));
                yield return(1);

                SetLocation(edge.otherCell);
                Rotate(edge.direction);
            }
        }
    }
Exemplo n.º 2
0
 public void SetEdge(MazeDirection dir, MazeCellEdge edge) {
     this.edges[(int)dir] = edge;
     this.initedEdgeCount += 1;
 }
Exemplo n.º 3
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge;
     initializedEdgeCount += 1;
 }
Exemplo n.º 4
0
    private void DestroyMazeCellEdge(MazeCell cell, MazeDirection dir)
    {
        MazeCellEdge edge = cell.GetEdge(dir);

        Destroy(edge.gameObject);
    }
Exemplo n.º 5
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge;
     initializedEdgeCount += 1;
 }
Exemplo n.º 6
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge;
 }
Exemplo n.º 7
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     this.edges[(int)direction] = edge;
     this.initializedEdgeCount++;
 }
Exemplo n.º 8
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge; //checks the direction and takes that edge
     initializedEdgeCount += 1;    //adds 1 count to the initialzed edges
 }
Exemplo n.º 9
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge;
 }
Exemplo n.º 10
0
    public void help()
    {
        //Debug.Log("HELP!!!");
        if (currentCell.getPassages() > 2)
        {
            MazeCellEdge suggest              = currentCell.GetEdges()[1];
            PriorityQueue <HelperNode> open   = new PriorityQueue <HelperNode>();
            PriorityQueue <HelperNode> closed = new PriorityQueue <HelperNode>();
            open.Enqueue(new HelperNode(currentCell, getDistance(currentCell), 0, getDistance(currentCell), currentCell.GetEdges()[1]));
            bool flag = false;
            while (!flag && !open.isEmpty())
            {
                HelperNode q = open.Dequeue();
                foreach (MazeCellEdge edge in q.getMazeCell().GetEdges())
                {
                    if (edge is MazePassage)
                    {
                        MazeCell     newCell = edge.otherCell;
                        int          g       = q.getG() + 1;
                        int          h       = getDistance(newCell);
                        int          f       = g + h;
                        MazeCellEdge e;
                        if (q.getMazeCell() == currentCell)
                        {
                            e = edge;
                        }
                        else
                        {
                            e = q.getEdge();
                        }
                        if (newCell.getIsWinner())
                        {
                            flag    = true;
                            suggest = e;
                            break;
                        }
                        if (!(open.contains(newCell, f) || closed.contains(newCell, f)))
                        {
                            open.Enqueue(new HelperNode(newCell, f, g, h, e));
                            //Debug.Log("New Node");
                        }
                    }
                }
                closed.Enqueue(new HelperNode(q.getMazeCell(), q.getPriority(), q.getG(), q.getH(), q.getEdge()));
                //Debug.Log("Bye Node");
            }
            //Do fun gui stuff
            Debug.Log(suggest.direction);
            System.Random rng = new System.Random();
            int           helper;
            if (Data.Difficulty == 1)
            {
                helper = 1;
            }
            else if (Data.Difficulty == 2)
            {
                helper = rng.Next(1, 5);
            }
            else
            {
                helper = rng.Next(1, 9);
            }
            string s = "Helper " + helper + " Suggests:\nGo ";
            switch (suggest.direction)
            {
            case MazeDirection.North:
                if (helper == 1 || helper == 5)
                {
                    s += "Up";
                }
                else if (helper == 3 || helper == 7)
                {
                    s += "Down";
                }
                else if (helper == 2 || helper == 8)
                {
                    s += "Right";
                }
                else
                {
                    s += "Left";
                }
                break;

            case MazeDirection.East:
                if (helper == 4 || helper == 8)
                {
                    s += "Up";
                }
                else if (helper == 2 || helper == 6)
                {
                    s += "Down";
                }
                else if (helper == 1 || helper == 7)
                {
                    s += "Right";
                }
                else
                {
                    s += "Left";
                }
                break;

            case MazeDirection.South:
                if (helper == 3 || helper == 7)
                {
                    s += "Up";
                }
                else if (helper == 1 || helper == 5)
                {
                    s += "Down";
                }
                else if (helper == 4 || helper == 6)
                {
                    s += "Right";
                }
                else
                {
                    s += "Left";
                }
                break;

            default:
                if (helper == 2 || helper == 6)
                {
                    s += "Up";
                }
                else if (helper == 4 || helper == 8)
                {
                    s += "Down";
                }
                else if (helper == 3 || helper == 5)
                {
                    s += "Right";
                }
                else
                {
                    s += "Left";
                }
                break;
            }
            text.newDirection(s);
        }
    }
Exemplo n.º 11
0
 public void setEdge(MazeCellEdge e)
 {
     edge = e;
 }
Exemplo n.º 12
0
 public void SetEdge(MazeDirection direction, MazeCellEdge edge)
 {
     edges[(int)direction] = edge;
     // Increase count whenever a wall is set up
     initializedEdgeCount += 1;
 }
Exemplo n.º 13
0
 public void SetEdge(MazeDirection dir, MazeCellEdge edge)
 {
     this.edges[(int)dir]  = edge;
     this.initedEdgeCount += 1;
 }
	public void SetEdge (MazeDirection direction, MazeCellEdge edge) {
		if (!(edge is MazePassage))
			++WallCount;
		edges[(int)direction] = edge;
		++ initializedEdgeCount;
	}
Exemplo n.º 15
0
 public void SetEdge(MazeCellEdge _edge, mazeDirection _direction)
 {
     edges[(int)_direction] = _edge;
     initializedEdges++;
 }