public void Place(BuidingProfile building) { if (_currentPlaced != null) { return; } GameObject ghost = Instantiate(building.BuildingView); _currentPlaced = new PlacedEntity(ghost.GetComponent <BuildingView>(), ghost.GetComponent <CollisionTrigger>(), building); }
public void Update() { var inputModule = (CustomStandaloneInputModule)EventSystem.current.currentInputModule; if (_currentPlaced != null) { if (Input.GetMouseButtonDown(0) && _currentPlaced.TryPlace()) { _currentPlaced = null; } else { _currentPlaced.MoveView(ProjectOnGrid(inputModule.GetMousePositionOnGameObject())); } } }