Example #1
0
    private void Spawn(GameObject spawn, Transform destination)
    {
        //GameObject MarioSpawned = Instantiate(Mariobros, new Vector3(spawn.transform.position.x + Random.Range(-15, 12.5f), spawn.transform.position.y, spawn.transform.position.z + Random.Range(-15 , 10)), Quaternion.identity);
        GameObject MarioSpawned = Instantiate(Mariobros, new Vector3(spawn.transform.position.x, spawn.transform.position.y, spawn.transform.position.z), Quaternion.identity);

        MarioSpawned.transform.parent = ListOfMarios.transform;
        MarioSpawned.name             = " " + count;
        MarioMove script = MarioSpawned.GetComponent <MarioMove>();

        script.directionW = directionW;
        script.astar      = astar;
        script.Graph      = astar.Graph;
        BoxCollider bc   = MarioSpawned.GetComponentInChildren <BoxCollider>();
        Vector3     size = bc.size;

        bc.size = new Vector3(size.x, size.y, size.z * Zvision);
        Vector3 auxxx = MarioSpawned.transform.position;

        auxxx.z = MarioSpawned.transform.position.z + size.z * Zvision + bc.transform.localPosition.z * MarioSpawned.transform.localScale.z - 1.125f / 4f;  //- MarioSpawned.transform.localScale.z/2f;

        Debug.DrawLine(MarioSpawned.transform.position, auxxx, Color.black);
        Vector3 center = bc.center;

        center.z            = center.z + (bc.size.z - size.z) / 2f; bc.center = center;
        script._destination = destination.transform;
        script.funnelMAX    = Vector3.Distance(MarioSpawned.transform.position, auxxx);
        ++count;
        //script.Graph = astar.Graph;
    }
Example #2
0
    private void Spawn()
    {
        GameObject MarioSpawned = Instantiate(Mariobros, new Vector3(35 + Random.Range(-30, 25.0f), 20, -45 + Random.Range(-30, 20)), transform.rotation);

        MarioSpawned.transform.parent = ListOfMarios.transform;
        MarioSpawned.name             = " " + count;
        MarioMove script = MarioSpawned.GetComponent <MarioMove>();

        script._destination = this.gameObject.transform.GetChild(3).transform;
        ++count;
        //script.Graph = astar.Graph;
    }
Example #3
0
    private void Spawn()
    {
        GameObject MarioSpawned = Instantiate(Mariobros, new Vector3(spawn.transform.position.x + Random.Range(-15, 12.5f), spawn.transform.position.y, spawn.transform.position.z + Random.Range(-15, 10)), Quaternion.identity);

        MarioSpawned.transform.parent = ListOfMarios.transform;
        MarioSpawned.name             = " " + count;
        MarioMove script = MarioSpawned.GetComponent <MarioMove>();

        script.directionW = directionW;
        script.astar      = astar;
        script.Graph      = astar.Graph;
        BoxCollider bc   = MarioSpawned.GetComponentInChildren <BoxCollider>();
        Vector3     size = bc.size;

        bc.size = new Vector3(size.x, size.y, size.z * Zvision);
        Vector3 center = bc.center;

        center.z            = center.z + (bc.size.z - size.z) / 2f; bc.center = center;
        script._destination = destination.transform;
        ++count;
    }