Пример #1
0
    private void PlaceItem(Game.AddressItem item, int address)
    {
        ItemBehavior behavior = GameObject.Instantiate <ItemBehavior>(this.itemPool);
        Vector3      pos      = this.map.addressToPos(address);

        behavior.transform.position = new Vector3(
            pos.x * MapLoader.FieldUnit.x + MapLoader.FieldUnit.x * 0.5f,
            pos.y * this.CurrentFloor() * MapLoader.FieldUnit.y + MapLoader.FieldUnit.y * 0.5f,
            pos.z * MapLoader.FieldUnit.z - MapLoader.FieldUnit.z * 0.5f
            );
        behavior.transform.parent = this.mapRoot.transform;
        behavior.SetSurface(item);
        behavior.SetLookAtCamera(this.mainCamera.GetComponent <Camera>());
        behavior.gameObject.SetActive(true);
        this.placedItems.Add(address, behavior);
    }