예제 #1
0
    // Use this for initialization
    public override void Start()
    {
        Instance = this;

        theCity = GameObject.FindGameObjectWithTag("City").GetComponent<CityManager>();

        player = GameObject.FindGameObjectWithTag("Player");

        kaiju = player.GetComponent<Kaiju>();

        cityWidth = theCity.getWidth();

        float x = theCity.gameObject.transform.position.x;

        if (x < 1)
        {
            // just incase this is 0 and messes with the math.
            x = 1;
        }

        float z = theCity.gameObject.transform.position.z;

        if (z < 1)
        {
            // just incase this is 0 and messes with the math.
            z = 1;
        }

        //X of City * width in tiles * width of tiles.

        cityBoundary.x = x + theCity.getWidth() * 2;

        cityBoundary.z = z + theCity.getDepth() * 2;

        StartCoroutine("Spawn");

        base.Start();
    }