예제 #1
0
    void Start()
    {
        if (player == null) {
            player = GameObject.Find ("Player").transform;
        }

        float vertExtent = Camera.main.orthographicSize;
        float horzExtent = vertExtent * Screen.width / Screen.height;

        mapGenScript = GameObject.Find ("Map Generator").GetComponent<MapGenerator>();
        maxPosition = mapGenScript.GetTilePositionInScene(new Coord(mapGenScript.width-1,mapGenScript.height-1));
        float mapX = maxPosition.x;
        float mapY = maxPosition.y;

        xMax = mapX - horzExtent;
        xMin = horzExtent - mapX;
        yMax = mapY - vertExtent;
        yMin = vertExtent - mapY;
    }
    void Start()
    {
        //		this.audioSource = this.GetComponent<AudioSource>();

        if (player == null) {
            player = GameObject.Find ("Player").transform;
        }

        this.playerRigidBody = player.GetComponent<Rigidbody2D>();
        this.playerController = player.GetComponent<PlayerController>();
        this.audioDelegate = GameObject.Find ("Audio Delegate");
        this.audioController = audioDelegate.GetComponent<AudioController>();

        MoveToPlayer();

        float vertExtent = Camera.main.orthographicSize;
        float horzExtent = vertExtent * Screen.width / Screen.height;

        mapGenScript = GameObject.Find ("Map Generator").GetComponent<MapGenerator>();
        maxPosition = mapGenScript.GetTilePositionInScene(new Coord(mapGenScript.width-1,mapGenScript.height-1));
        float mapX = maxPosition.x;
        float mapY = maxPosition.y;

        xMax = mapX - horzExtent;
        xMin = horzExtent - mapX;
        yMax = mapY - vertExtent;
        yMin = vertExtent - mapY;
    }