Пример #1
0
 public void Awake()
 {
     topo = GetComponent <PlanetTopography>();
     foreach (WaypointEdge edge in edges)
     {
         float uCoordA, vCoordA, uCoordB, vCoordB;
         topo.getUVCoords(edge.one, out uCoordA, out vCoordA, edge.two, out uCoordB, out vCoordB);
         linkNodes(edge.one, uCoordA, vCoordA, edge.two, uCoordB, vCoordB);
     }
 }
Пример #2
0
    //------------------------------------------------------------------------
    // awake callbacks
    //------------------------------------------------------------------------

    public void Awake()
    {
        gameManager = GameManager.Instance;
        walkerBody  = GetComponent <Rigidbody>();

        GameObject planet = GameObject.FindGameObjectWithTag(Tags.Planet);

        graph = planet.GetComponent <WaypointGraph>();
        topo  = planet.GetComponent <PlanetTopography>();
        awake();
    }
Пример #3
0
    public void Awake()
    {
        gameManager = GameManager.Instance;
        walker      = GetComponent <WaypointWalker>();
        robert      = GameObject.FindGameObjectWithTag(Tags.Pacman);
        topo        = GameObject.FindGameObjectWithTag(Tags.Planet).GetComponent <PlanetTopography>();

        modesTable = gameManager.virusModesForCurrentLevel();
        resetMode();

        awake();
    }
Пример #4
0
    // Use this for initialization
    void Update()
    {
        if (done)
        {
            return;
        }
        graph      = GetComponent <WaypointGraph> ();
        topography = GetComponent <PlanetTopography> ();

        nodePellet = new HashSet <int> ();
        int count = 0;

        print(graph.edges.Count);

        foreach (WaypointEdge edge in graph.edges)
        {
            if (edge.one.pacmanWalkable && edge.two.pacmanWalkable)
            {
                List <Vector3> positions = new List <Vector3> ();
                topography.getPelletPositions(edge.one, edge.two, out positions);
                for (int i = 1; i < positions.Count - 1; ++i)
                {
                    Instantiate(pellet, positions[i], Quaternion.identity);
                    count++;
                }
                if (!nodePellet.Contains(edge.one.GetInstanceID()))
                {
                    nodePellet.Add(edge.one.GetInstanceID());
                    GameObject p = pellet;
                    if (edge.one.powerPellet)
                    {
                        p = powerPellet;
                    }
                    Instantiate(p, positions[0], Quaternion.identity);
                    count++;
                }
                if (!nodePellet.Contains(edge.two.GetInstanceID()))
                {
                    nodePellet.Add(edge.two.GetInstanceID());
                    GameObject p = pellet;
                    if (edge.two.powerPellet)
                    {
                        p = powerPellet;
                    }
                    Instantiate(p, positions[positions.Count - 1], Quaternion.identity);
                    count++;
                }
            }
        }
        GameManager.Instance.levelData.pelletsTotal = count;

        done = true;
    }