Exemple #1
0
    public void CreateZombie()
    {
        if (_labyrinth == null || player == null || zombiePrefab == null)
        {
            return;
        }

        LFLabyrinthNode spawnNode = _labyrinth.RandomFreeNodeWithOutPosition(player.transform.position);
        GameObject      zombie    = Instantiate(zombiePrefab, spawnNode.WorldPosition, Quaternion.identity);

        zombie.transform.parent = enemyContainer.transform;
        zombie.GetComponent <LFEnemyMove>().pathFinder = _pathFinder;
        zombie.GetComponent <LFEnemyMove>().speed      = startZombieSpeed;
        _enemyList.Add(zombie);
    }
    public List <LFGridNode> RandomNodePath(Vector3 startPos)
    {
        LFGridNode startNode  = _grid.GridNodeFromWorldPosition(startPos);
        LFGridNode targetNode = _grid.GridNodeFromWorldPosition(_labyrinth.RandomFreeNodeWithOutPosition(startPos).WorldPosition);

        return(FindNodePath(startNode, targetNode));
    }