private void OnPlaceObject(Vector3 pz) { MapPoint mp = new MapPoint(Mathf.FloorToInt(pz.x), Mathf.FloorToInt(pz.y)); CellController cellPrefab = selectedPrefab.GetComponent <CellController>(); if (cellPrefab.PrefabValidatePosition(M, mp, selectedRotation)) { CellObjectController cobj = ReplaceCell(mp, cellPrefab).GetComponent <CellObjectController>(); if (cobj != null) { M.UI.bCostsPanel.Expences.AddValue(cobj.Cost); } Phantom.RemovePhantom(); } }